mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-18 06:15:02 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
679c6343e6 | ||
|
|
fe1be5f7e9 | ||
|
|
91fdecff78 |
+29
-86
@@ -1,102 +1,45 @@
|
||||
# Changelog
|
||||
|
||||
## 0.16.0 - 2026-11-16
|
||||
## 0.16.0-beta.2 - 2026-11-11
|
||||
|
||||
- **Background tasks:** See and stop background tasks above the composer for Claude Code, Codex and OpenCode v2. ([#6220](https://github.com/getpaseo/paseo/pull/6220), [#9162](https://github.com/getpaseo/paseo/pull/9162), [#9635](https://github.com/getpaseo/paseo/pull/9635) by [@fxlelouarn](https://github.com/fxlelouarn))
|
||||
- **Built-in plugin gallery:** Browse, search and install plugins without leaving Paseo. Manage their settings and updates from the same page. ([#9752](https://github.com/getpaseo/paseo/pull/9752))
|
||||
- **Command center tabs:** Switch between Workspaces, Files and Actions, with recent workspaces shown first. Search now includes archived workspaces and matches agent titles within their workspace. ([#9689](https://github.com/getpaseo/paseo/pull/9689))
|
||||
- **Plugin sidebar views:** Plugins can replace the sidebar with their own workspace and agent layout across connected hosts. Choose a view per device in Settings → Sidebar. ([#8906](https://github.com/getpaseo/paseo/pull/8906))
|
||||
- **Plugin composer controls:** Plugins can add composer controls, edit drafts and attachments, and change agent settings. They can also add New workspace items and save metadata on agents and workspaces. ([#8744](https://github.com/getpaseo/paseo/pull/8744), [#9209](https://github.com/getpaseo/paseo/pull/9209), [#9207](https://github.com/getpaseo/paseo/pull/9207), [#9734](https://github.com/getpaseo/paseo/pull/9734) by [@michaelmwu](https://github.com/michaelmwu))
|
||||
- **Arrange Usage cards:** Drag provider cards into your preferred order and turn off cards you do not want in the sidebar summary. Choose the host from Usage settings. ([#9660](https://github.com/getpaseo/paseo/pull/9660), [#9740](https://github.com/getpaseo/paseo/pull/9740), [#9748](https://github.com/getpaseo/paseo/pull/9748), [#9780](https://github.com/getpaseo/paseo/pull/9780))
|
||||
- **Quieter app reopening:** Returning to an unchanged chat no longer flashes “Updating messages.” Paseo keeps healthy connections open and recovers dropped connections when you return. After reconnecting, an up-to-date chat no longer shows an extra update toast. ([#9242](https://github.com/getpaseo/paseo/pull/9242), [#8651](https://github.com/getpaseo/paseo/pull/8651), [#9086](https://github.com/getpaseo/paseo/pull/9086), [#8855](https://github.com/getpaseo/paseo/pull/8855), [#9116](https://github.com/getpaseo/paseo/pull/9116), [#9558](https://github.com/getpaseo/paseo/pull/9558) by [@adamcstephens](https://github.com/adamcstephens))
|
||||
- **Rebuilt mobile chat:** Expanding turn summaries, todo cards and tool groups keeps your reading position on iOS and Android. Sending during a scroll moves to the new prompt. ([#8717](https://github.com/getpaseo/paseo/pull/8717), [#9085](https://github.com/getpaseo/paseo/pull/9085), [#9806](https://github.com/getpaseo/paseo/pull/9806), [#9693](https://github.com/getpaseo/paseo/pull/9693))
|
||||
- **Faster diff loading:** Changes shows the file tree before file contents finish loading. Large diffs load in batches and take priority over background worktree scans. ([#8907](https://github.com/getpaseo/paseo/pull/8907), [#9241](https://github.com/getpaseo/paseo/pull/9241), [#9243](https://github.com/getpaseo/paseo/pull/9243), [#9584](https://github.com/getpaseo/paseo/pull/9584))
|
||||
- **Faster composer menus:** Command and file suggestions open sooner in large lists and stay against the composer as it changes size. ([#9657](https://github.com/getpaseo/paseo/pull/9657), [#9647](https://github.com/getpaseo/paseo/pull/9647), [#9642](https://github.com/getpaseo/paseo/pull/9642))
|
||||
- **Keyboard shortcuts on mobile:** A connected keyboard gives iPad and Android the same shortcuts as desktop, including custom bindings. Shift+Tab in the iPad composer switches mode without typing a tab. ([#8625](https://github.com/getpaseo/paseo/pull/8625), [#9561](https://github.com/getpaseo/paseo/pull/9561) by [@jeroenfrenken](https://github.com/jeroenfrenken), [@lstroud](https://github.com/lstroud))
|
||||
- **Touch-sized tablet controls:** Wide layouts on touch devices have larger buttons and rows. The composer folds controls into the model menu when space runs out. ([#8748](https://github.com/getpaseo/paseo/pull/8748), [#8885](https://github.com/getpaseo/paseo/pull/8885), [#8891](https://github.com/getpaseo/paseo/pull/8891), [#8909](https://github.com/getpaseo/paseo/pull/8909), [#9151](https://github.com/getpaseo/paseo/pull/9151), [#9238](https://github.com/getpaseo/paseo/pull/9238), [#8739](https://github.com/getpaseo/paseo/pull/8739) by [@zeyugao](https://github.com/zeyugao))
|
||||
- **Undo workspace archive:** Restore an archived workspace with Undo or Cmd/Ctrl+Z during the six-second toast. Paseo checks for unsaved files and unpushed commits before removing a worktree. ([#8904](https://github.com/getpaseo/paseo/pull/8904), [#9104](https://github.com/getpaseo/paseo/pull/9104), [#9625](https://github.com/getpaseo/paseo/pull/9625), [#9753](https://github.com/getpaseo/paseo/pull/9753) by [@ragokan](https://github.com/ragokan))
|
||||
- **Background tasks:** Paseo now shows the background tasks an agent is running, such as shells and monitors, above the composer, with a Stop button for each. Works with Claude Code, Codex and OpenCode v2. ([#6220](https://github.com/getpaseo/paseo/pull/6220), [#9162](https://github.com/getpaseo/paseo/pull/9162) by [@fxlelouarn](https://github.com/fxlelouarn))
|
||||
- **Plugin sidebar views:** A plugin can replace the sidebar's content with its own layout of workspaces, agents, projects and terminals across every connected host. Pick the view per device under Settings → Sidebar; Paseo's sidebar header and footer stay in place. ([#8906](https://github.com/getpaseo/paseo/pull/8906))
|
||||
- **Plugin composer controls:** Plugins can add their own controls to the composer, and read and set its prompt, attachments, provider, model, mode and thinking. They can also put the cursor in any agent's composer, add items to New workspace, and store their own metadata on agents and workspaces. ([#8744](https://github.com/getpaseo/paseo/pull/8744), [#9209](https://github.com/getpaseo/paseo/pull/9209), [#9207](https://github.com/getpaseo/paseo/pull/9207))
|
||||
- **Faster diff loading:** Opening Changes shows the file tree right away while file contents load. Large diffs arrive in batches, so the rest of the app keeps responding while they load, and diffs take priority over the daemon's background worktree scans. ([#8907](https://github.com/getpaseo/paseo/pull/8907), [#9241](https://github.com/getpaseo/paseo/pull/9241), [#9243](https://github.com/getpaseo/paseo/pull/9243))
|
||||
- **Polish:** The chat stays still when a turn ends, and returning to a chat that has not changed shows it as it is with no refresh. Tool rows show their final title and icon from the first frame, the context window popover opens with usage already loaded, and sidebar hover cards open one at a time. ([#8944](https://github.com/getpaseo/paseo/pull/8944), [#9175](https://github.com/getpaseo/paseo/pull/9175), [#9242](https://github.com/getpaseo/paseo/pull/9242), [#9248](https://github.com/getpaseo/paseo/pull/9248), [#9212](https://github.com/getpaseo/paseo/pull/9212), [#9071](https://github.com/getpaseo/paseo/pull/9071))
|
||||
- **Rebuilt mobile chat timeline:** The chat timeline on iOS and Android was rebuilt. Expanding or collapsing a turn summary, todo card or tool-call group keeps the line you tapped in place, and on Android so do Show more, Show less and plan cards. ([#8717](https://github.com/getpaseo/paseo/pull/8717), [#9085](https://github.com/getpaseo/paseo/pull/9085))
|
||||
- **Keyboard shortcuts on mobile:** With a keyboard connected, iPad and Android now run the same shortcuts as desktop, including your custom bindings. Shortcut hints and Settings → Shortcuts appear when a keyboard is detected. Shortcuts also work in narrow desktop and browser windows. ([#8625](https://github.com/getpaseo/paseo/pull/8625) by [@jeroenfrenken](https://github.com/jeroenfrenken), [@lstroud](https://github.com/lstroud))
|
||||
- **Touch-sized tablet controls:** On iPad and other touch-screen devices, the wide layout now has touch-sized buttons, rows and bars. The composer toolbar folds its controls into the model menu when space runs out, and swiping right on the workspace reveals a collapsed sidebar as an overlay. ([#8748](https://github.com/getpaseo/paseo/pull/8748), [#8885](https://github.com/getpaseo/paseo/pull/8885), [#8891](https://github.com/getpaseo/paseo/pull/8891), [#8909](https://github.com/getpaseo/paseo/pull/8909), [#9151](https://github.com/getpaseo/paseo/pull/9151), [#9238](https://github.com/getpaseo/paseo/pull/9238), [#8739](https://github.com/getpaseo/paseo/pull/8739) by [@zeyugao](https://github.com/zeyugao))
|
||||
- **Undo workspace archive:** Archiving a workspace in the app now shows a "Workspace archived" toast for six seconds. Undo, or Cmd/Ctrl+Z, restores the workspace with its tabs and agents. On desktop, sidebar workspace rows also get an archive button on hover. ([#8904](https://github.com/getpaseo/paseo/pull/8904), [#9104](https://github.com/getpaseo/paseo/pull/9104))
|
||||
- **Fewer reconnects on return:** Returning to the app keeps a working connection, including one in the middle of a large response, and reconnects once when it has to. On a host with several saved connections, Paseo stays on the one that works. ([#8651](https://github.com/getpaseo/paseo/pull/8651), [#9086](https://github.com/getpaseo/paseo/pull/9086), [#8855](https://github.com/getpaseo/paseo/pull/8855), [#9116](https://github.com/getpaseo/paseo/pull/9116))
|
||||
|
||||
### Added
|
||||
|
||||
- Added a Change base picker for worktree diffs, commits and Git actions ([#8642](https://github.com/getpaseo/paseo/pull/8642), [#8934](https://github.com/getpaseo/paseo/pull/8934) by [@Myasuka](https://github.com/Myasuka))
|
||||
- Added issue and pull request links that resolve SSH aliases and fork parent repositories ([#8636](https://github.com/getpaseo/paseo/pull/8636), [#9576](https://github.com/getpaseo/paseo/pull/9576))
|
||||
- Added an iPhone Duo layout with the sidebar and workspace on opposite sides of the fold ([#8741](https://github.com/getpaseo/paseo/pull/8741), [#8901](https://github.com/getpaseo/paseo/pull/8901) by [@zeyugao](https://github.com/zeyugao))
|
||||
- Added a Change base picker in Changes for worktree workspaces, so diffs, the commit list and Git actions can use another branch ([#8642](https://github.com/getpaseo/paseo/pull/8642), [#8934](https://github.com/getpaseo/paseo/pull/8934) by [@Myasuka](https://github.com/Myasuka))
|
||||
- Added links for issue and pull request references such as `#123` and `owner/repo#123` in agent replies, plans, the pull request panel and file previews, for GitHub, GitLab, Gitea, Forgejo and Codeberg ([#8636](https://github.com/getpaseo/paseo/pull/8636))
|
||||
- Added iPhone Duo layout support: workspace actions sit in the system vertical bar, and the sidebar and workspace split on either side of the fold ([#8741](https://github.com/getpaseo/paseo/pull/8741), [#8901](https://github.com/getpaseo/paseo/pull/8901) by [@zeyugao](https://github.com/zeyugao))
|
||||
- Added fx as a provider you can add from the provider catalog in Settings → Hosts → Providers ([#9160](https://github.com/getpaseo/paseo/pull/9160))
|
||||
- Added background agents that stay out of tabs, notifications and default agent lists ([#8683](https://github.com/getpaseo/paseo/pull/8683))
|
||||
- Added background agents: an agent or plugin can create a helper with `background: true` that opens no tab, sends no notification and stays out of the sidebar and default agent lists ([#8683](https://github.com/getpaseo/paseo/pull/8683))
|
||||
- Added syntax highlighting for Terraform and HCL files (`.tf`, `.tfvars`, `.hcl`) ([#9106](https://github.com/getpaseo/paseo/pull/9106))
|
||||
- Added `PASEO_WORKSPACE_ID` to each agent's environment so an agent can identify, rename or archive its own workspace ([#8939](https://github.com/getpaseo/paseo/pull/8939) by [@DTTerastar](https://github.com/DTTerastar))
|
||||
- Added plugin badges to sidebar workspace rows ([#7645](https://github.com/getpaseo/paseo/pull/7645) by [@jtomaszewski](https://github.com/jtomaszewski))
|
||||
- Added a Download button for files without a preview ([#9640](https://github.com/getpaseo/paseo/pull/9640))
|
||||
- Added Copilot premium-request usage and remaining quota to Usage ([#8489](https://github.com/getpaseo/paseo/pull/8489) by [@thisisryanswift](https://github.com/thisisryanswift))
|
||||
|
||||
### Changed
|
||||
|
||||
- Changed opening a workspace to restore the tab you left instead of jumping to the agent that needs attention ([#8935](https://github.com/getpaseo/paseo/pull/8935))
|
||||
- Changed question cards to wait for Next or Submit after you select an option ([#8525](https://github.com/getpaseo/paseo/pull/8525))
|
||||
- Changed the slash command menu to stop selecting `/exit` by default ([#8905](https://github.com/getpaseo/paseo/pull/8905))
|
||||
- Changed workspace header controls to fit narrow split panes ([#8740](https://github.com/getpaseo/paseo/pull/8740), [#9088](https://github.com/getpaseo/paseo/pull/9088) by [@zeyugao](https://github.com/zeyugao))
|
||||
- Changed question cards so picking an option no longer advances automatically; continue with Next or Submit ([#8525](https://github.com/getpaseo/paseo/pull/8525))
|
||||
- Changed the slash command menu to show loading and error states with Retry, and to stop selecting `/exit` by default ([#8905](https://github.com/getpaseo/paseo/pull/8905))
|
||||
- Changed the workspace header and tabs to switch to compact controls when Explorer or a split pane narrows the workspace ([#8740](https://github.com/getpaseo/paseo/pull/8740), [#9088](https://github.com/getpaseo/paseo/pull/9088) by [@zeyugao](https://github.com/zeyugao))
|
||||
- Changed sending a message to a Pi agent whose process has exited to fail immediately with an instruction to reload the agent ([#8718](https://github.com/getpaseo/paseo/pull/8718))
|
||||
- Changed Rename workspace in the sidebar on desktop and wide web layouts to edit the title in place instead of opening a dialog ([#9280](https://github.com/getpaseo/paseo/pull/9280))
|
||||
- Changed What's new to show highlights first, with the full list behind Show all changes ([#9281](https://github.com/getpaseo/paseo/pull/9281))
|
||||
- Changed Claude Bypass to approve execution requests from ask rules and hooks while keeping questions and plan review interactive ([#9760](https://github.com/getpaseo/paseo/pull/9760))
|
||||
- Changed Claude permission cards to show the reason supplied by the provider ([#3950](https://github.com/getpaseo/paseo/pull/3950) by [@codebutler](https://github.com/codebutler))
|
||||
- Changed the pull request pane so Activity can be resized or collapsed to give checks more space ([#9656](https://github.com/getpaseo/paseo/pull/9656))
|
||||
- Changed macOS desktop tab shortcuts to Cmd+Shift+[ and Cmd+Shift+] ([#7692](https://github.com/getpaseo/paseo/pull/7692) by [@jtomaszewski](https://github.com/jtomaszewski))
|
||||
- Changed Cmd/Ctrl+N on New workspace to open the project chooser without leaving the draft ([#9741](https://github.com/getpaseo/paseo/pull/9741))
|
||||
- Changed mobile Settings navigation to restore the sidebar where you left it ([#9641](https://github.com/getpaseo/paseo/pull/9641))
|
||||
- Changed What's new and the website changelog to show a release's highlights first, with the full list behind Show all changes ([#9281](https://github.com/getpaseo/paseo/pull/9281))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed long tool details hiding their collapse header or preventing scrolling through their output ([#9770](https://github.com/getpaseo/paseo/pull/9770))
|
||||
- Fixed image previews briefly showing an error or a stretched image while loading ([#9698](https://github.com/getpaseo/paseo/pull/9698))
|
||||
- Fixed web and desktop chats jumping to the beginning when older history became virtualized ([#9664](https://github.com/getpaseo/paseo/pull/9664) by [@luoph](https://github.com/luoph))
|
||||
- Fixed older chat history requiring another mouse-wheel movement after reaching the top ([#9570](https://github.com/getpaseo/paseo/pull/9570))
|
||||
- Fixed losing code indentation and line breaks when copying a selection across part of a code block ([#9515](https://github.com/getpaseo/paseo/pull/9515) by [@michaelmwu](https://github.com/michaelmwu))
|
||||
- Fixed overlapping axis titles and clipped labels in Mermaid XY charts ([#9483](https://github.com/getpaseo/paseo/pull/9483) by [@FluidXin](https://github.com/FluidXin))
|
||||
- Fixed the iOS command menu staying open after tapping a command ([#9755](https://github.com/getpaseo/paseo/pull/9755))
|
||||
- Fixed retrying an edited agent draft after a failed start ([#9534](https://github.com/getpaseo/paseo/pull/9534) by [@michaelmwu](https://github.com/michaelmwu))
|
||||
- Fixed model profile buttons ignoring taps on Android tablets ([#9526](https://github.com/getpaseo/paseo/pull/9526) by [@moevis](https://github.com/moevis))
|
||||
- Fixed Settings losing scroll position and edits after appearance changes ([#9605](https://github.com/getpaseo/paseo/pull/9605))
|
||||
- Fixed unreadable selected rows in light plugin themes and barely visible highlights in Pure Black ([#9579](https://github.com/getpaseo/paseo/pull/9579) by [@nathansgreen](https://github.com/nathansgreen))
|
||||
- Fixed missing keyboard focus rings on header and toolbar icon buttons on web and desktop ([#9745](https://github.com/getpaseo/paseo/pull/9745) by [@junjzhang](https://github.com/junjzhang))
|
||||
- Fixed sidebar rows flashing in the wrong position after a drag on iOS and Android ([#9681](https://github.com/getpaseo/paseo/pull/9681))
|
||||
- Fixed desktop startup reporting failure while its daemon was still starting ([#9043](https://github.com/getpaseo/paseo/pull/9043) by [@magiclaw](https://github.com/magiclaw))
|
||||
- Fixed typed characters being lost while web and desktop terminals restored their screen ([#9533](https://github.com/getpaseo/paseo/pull/9533))
|
||||
- Fixed physical arrow keys failing in Android terminals and dropping the next typed character ([#9407](https://github.com/getpaseo/paseo/pull/9407) by [@moevis](https://github.com/moevis))
|
||||
- Fixed non-Git workspaces missing Archive workspace in the command center ([#9777](https://github.com/getpaseo/paseo/pull/9777) by [@andheiberg](https://github.com/andheiberg))
|
||||
- Fixed workspace scripts disappearing when a later configuration read timed out ([#9477](https://github.com/getpaseo/paseo/pull/9477) by [@dinhphieu](https://github.com/dinhphieu))
|
||||
- Fixed sidebar Usage hiding an account after its usage refresh failed ([#9594](https://github.com/getpaseo/paseo/pull/9594))
|
||||
- Fixed closed agents staying unread when their provider session no longer existed ([#9737](https://github.com/getpaseo/paseo/pull/9737) by [@luoph](https://github.com/luoph))
|
||||
- Fixed completion notifications showing an older reply after an autonomous agent turn ([#9793](https://github.com/getpaseo/paseo/pull/9793))
|
||||
- Fixed interrupting messages failing with "already has an active run" ([#9537](https://github.com/getpaseo/paseo/pull/9537) by [@michaelmwu](https://github.com/michaelmwu))
|
||||
- Fixed message retries being refused after a failure before delivery to the provider ([#9580](https://github.com/getpaseo/paseo/pull/9580) by [@tmad4000](https://github.com/tmad4000))
|
||||
- Fixed newly reopened agents losing their provider process on the next idle-cleanup sweep ([#8857](https://github.com/getpaseo/paseo/pull/8857) by [@fdkevin0](https://github.com/fdkevin0))
|
||||
- Fixed Claude session crons and /loop wakeups being lost to idle runtime cleanup ([#9744](https://github.com/getpaseo/paseo/pull/9744) by [@KronixDev](https://github.com/KronixDev))
|
||||
- Fixed forking from a reply when a tool started before it and finished afterward ([#9627](https://github.com/getpaseo/paseo/pull/9627) by [@ragokan](https://github.com/ragokan))
|
||||
- Fixed large Codex history pages stopping history loading when their individual items still fit ([#9432](https://github.com/getpaseo/paseo/pull/9432) by [@RockStone](https://github.com/RockStone))
|
||||
- Fixed OpenCode sessions failing to reconnect after a daemon restart when OpenCode used Bun ([#9653](https://github.com/getpaseo/paseo/pull/9653) by [@quickwind](https://github.com/quickwind))
|
||||
- Fixed provider refresh retaining OpenCode v1 after an upgrade to v2 ([#9593](https://github.com/getpaseo/paseo/pull/9593) by [@tkfka1](https://github.com/tkfka1))
|
||||
- Fixed OpenCode v2 failing to discover plugin tools available only to its session ([#9426](https://github.com/getpaseo/paseo/pull/9426) by [@dptsolutions](https://github.com/dptsolutions))
|
||||
- Fixed ACP models sharing the wrong thinking levels when the provider supplied levels per model ([#9717](https://github.com/getpaseo/paseo/pull/9717) by [@AlfredRR](https://github.com/AlfredRR), [@doskoi](https://github.com/doskoi))
|
||||
- Fixed failed ACP tools without output preventing conversation history from loading ([#9467](https://github.com/getpaseo/paseo/pull/9467) by [@Myasuka](https://github.com/Myasuka))
|
||||
- Fixed Pi and OMP tool calls with null optional arguments appearing as unknown tools ([#9506](https://github.com/getpaseo/paseo/pull/9506) by [@papag00se](https://github.com/papag00se))
|
||||
- Fixed imported OMP sessions saving a file path instead of their session ID ([#8854](https://github.com/getpaseo/paseo/pull/8854) by [@LiebeLee](https://github.com/LiebeLee))
|
||||
- Fixed cross-host child agents losing their caller's mode when both used the same provider ([#9512](https://github.com/getpaseo/paseo/pull/9512) by [@ortschun](https://github.com/ortschun))
|
||||
- Fixed plugin child agents changing from failed or canceled to completed when their session closed ([#8563](https://github.com/getpaseo/paseo/pull/8563) by [@hadan8977](https://github.com/hadan8977))
|
||||
- Fixed CLI commands acting on a different agent whose title matched a missing full agent ID ([#9680](https://github.com/getpaseo/paseo/pull/9680), [#9731](https://github.com/getpaseo/paseo/pull/9731) by [@ese111](https://github.com/ese111))
|
||||
- Fixed archive, detach and reload failing for agents omitted from the CLI listing ([#9726](https://github.com/getpaseo/paseo/pull/9726) by [@xunWhale](https://github.com/xunWhale))
|
||||
- Fixed `paseo agent wait` exiting successfully when no agent matched the ID ([#9782](https://github.com/getpaseo/paseo/pull/9782) by [@Eapp1e](https://github.com/Eapp1e))
|
||||
- Fixed voice mode failing to start when speech input and output both used OpenAI ([#9779](https://github.com/getpaseo/paseo/pull/9779) by [@Huyvux12](https://github.com/Huyvux12))
|
||||
- Fixed dictation hiding a stream error behind a 30-second delivery timeout ([#9784](https://github.com/getpaseo/paseo/pull/9784) by [@tieo](https://github.com/tieo))
|
||||
- Fixed plugin providers rejecting Review attachments in All mode ([#9590](https://github.com/getpaseo/paseo/pull/9590) by [@ese111](https://github.com/ese111))
|
||||
- Fixed plugin timeline writes accepting kinds that the app could not show ([#7677](https://github.com/getpaseo/paseo/pull/7677) by [@ragokan](https://github.com/ragokan))
|
||||
- Fixed the chat moving when a turn ended ([#8944](https://github.com/getpaseo/paseo/pull/8944), [#9175](https://github.com/getpaseo/paseo/pull/9175))
|
||||
- Fixed Claude and OpenCode tool rows changing their title and icon as arguments arrived ([#9248](https://github.com/getpaseo/paseo/pull/9248))
|
||||
- Fixed the context window popover opening before usage was loaded ([#9212](https://github.com/getpaseo/paseo/pull/9212))
|
||||
- Fixed sidebar hover cards opening together ([#9071](https://github.com/getpaseo/paseo/pull/9071))
|
||||
|
||||
- Fixed the working indicator disappearing when returning to a chat whose agent finished while you were away ([#9170](https://github.com/getpaseo/paseo/pull/9170))
|
||||
- Fixed chats with short collapsed turns opening with empty space until you scrolled ([#8358](https://github.com/getpaseo/paseo/pull/8358), [#9083](https://github.com/getpaseo/paseo/pull/9083))
|
||||
- Fixed Collapse turns hiding an earlier reply inside a later turn's summary line after an idle Claude, Codex or OpenCode agent was resumed ([#9098](https://github.com/getpaseo/paseo/pull/9098))
|
||||
- Fixed the missing space between a prompt and the reply or collapsed-turn summary line below it ([#9009](https://github.com/getpaseo/paseo/pull/9009))
|
||||
- Fixed a long user message showing without its fade and Show more for one frame when a chat opened ([#9302](https://github.com/getpaseo/paseo/pull/9302))
|
||||
- Fixed Markdown tables showing as literal pipes when written directly below a paragraph with no blank line ([#8485](https://github.com/getpaseo/paseo/pull/8485) by [@ragokan](https://github.com/ragokan), [@suk-6](https://github.com/suk-6), [@thsrite](https://github.com/thsrite))
|
||||
- Fixed linked badge images that share a line with text rendering as full-width blocks on web and desktop ([#8530](https://github.com/getpaseo/paseo/pull/8530))
|
||||
- Fixed View diagram opening fullscreen instead of returning to the inline Mermaid diagram after View source ([#8932](https://github.com/getpaseo/paseo/pull/8932) by [@luoph](https://github.com/luoph))
|
||||
@@ -104,16 +47,21 @@
|
||||
- Fixed unsent composer text and attachments being deleted when an agent tab was closed ([#9079](https://github.com/getpaseo/paseo/pull/9079))
|
||||
- Fixed pasting text with hyperlinks into the composer dropping the link URLs; links now paste as Markdown ([#8972](https://github.com/getpaseo/paseo/pull/8972))
|
||||
- Fixed the composer losing focus after clicking Send with a mouse ([#9015](https://github.com/getpaseo/paseo/pull/9015))
|
||||
- Fixed the composer resting 50pt above the bottom edge on iPhone ([#8823](https://github.com/getpaseo/paseo/pull/8823) by [@zeyugao](https://github.com/zeyugao))
|
||||
- Fixed Add host sending you to Settings from the sidebar and New workspace ([#8512](https://github.com/getpaseo/paseo/pull/8512))
|
||||
- Fixed a failed agent's red dot and Failed grouping staying in the sidebar after opening the agent or choosing Mark as read ([#8831](https://github.com/getpaseo/paseo/pull/8831))
|
||||
- Fixed a workspace's unread indicator staying on after it was cleared while the agent's runtime was closed ([#9087](https://github.com/getpaseo/paseo/pull/9087))
|
||||
- Fixed unarchiving a workspace not restoring the agents that were archived with it ([#9210](https://github.com/getpaseo/paseo/pull/9210))
|
||||
- Fixed the context window popover closing by itself whenever the chat scrolled during a streaming reply ([#8742](https://github.com/getpaseo/paseo/pull/8742) by [@3ae3ae](https://github.com/3ae3ae))
|
||||
- Fixed the sidebar usage summary updating only when Usage was opened ([#7806](https://github.com/getpaseo/paseo/pull/7806) by [@ragokan](https://github.com/ragokan))
|
||||
- Fixed tooltips and menus above their trigger briefly covering it on Android when their content grew after opening ([#9247](https://github.com/getpaseo/paseo/pull/9247))
|
||||
- Fixed History showing "Could not load history" after reloading the web app on the History screen ([#9029](https://github.com/getpaseo/paseo/pull/9029))
|
||||
- Fixed section links in an HTML file preview replacing the preview with the Paseo app instead of scrolling within the file ([#8559](https://github.com/getpaseo/paseo/pull/8559) by [@3ae3ae](https://github.com/3ae3ae))
|
||||
- Fixed Files Refresh leaving a newly created file hidden when its folder was collapsed during the refresh ([#8582](https://github.com/getpaseo/paseo/pull/8582) by [@hadan8977](https://github.com/hadan8977))
|
||||
- Fixed the branch switcher showing "No branches found" while branches are still loading or after the request fails ([#8938](https://github.com/getpaseo/paseo/pull/8938))
|
||||
- Fixed commit history showing a doubled slash, no rename status and no diff for a file moved up a directory ([#8509](https://github.com/getpaseo/paseo/pull/8509) by [@hadan8977](https://github.com/hadan8977))
|
||||
- Fixed a merged pull request disappearing from its workspace when the checkout was behind the pull request's head
|
||||
- Fixed workspace Git watchers staying in fallback polling after a watcher setup timeout
|
||||
- Fixed abandoned connections staying open for up to 45 seconds after the web or desktop app reconnected ([#9067](https://github.com/getpaseo/paseo/pull/9067))
|
||||
- Fixed a connection routed through another host closing with "The receiving client cannot keep up with host output" while fetching a very large timeline ([#9109](https://github.com/getpaseo/paseo/pull/9109))
|
||||
- Fixed a connected host staying in error after it was updated to a supported version ([#8423](https://github.com/getpaseo/paseo/pull/8423) by [@DAnaeto](https://github.com/DAnaeto))
|
||||
@@ -175,21 +123,16 @@
|
||||
- Fixed a plugin the daemon terminated for an invalid message staying listed with no exit reported ([#9285](https://github.com/getpaseo/paseo/pull/9285) by [@Brandon168](https://github.com/Brandon168))
|
||||
- Fixed ACP provider plugins dropping the token usage an agent reports in its prompt response ([#9396](https://github.com/getpaseo/paseo/pull/9396) by [@Myasuka](https://github.com/Myasuka))
|
||||
- Fixed the published `@getpaseo/*` npm packages declaring no license; they now declare Apache-2.0 ([#7816](https://github.com/getpaseo/paseo/pull/7816) by [@mdlawson](https://github.com/mdlawson), [@ragokan](https://github.com/ragokan))
|
||||
- Fixed forking from an earlier reply failing with "This checkpoint changed after it was created" after a plugin updated one of its timeline cards ([#8746](https://github.com/getpaseo/paseo/pull/8746) by [@monarchmaisuriya](https://github.com/monarchmaisuriya))
|
||||
- Fixed Collapse turns leaving a turn open, or folding to an earlier reply, when a plugin renders the final reply ([#8811](https://github.com/getpaseo/paseo/pull/8811) by [@geoqiao](https://github.com/geoqiao))
|
||||
- Fixed plugin screens showing "This plugin surface is unavailable" while the plugin catalog is still loading after an app reload ([#8123](https://github.com/getpaseo/paseo/pull/8123) by [@vs-tahir](https://github.com/vs-tahir))
|
||||
- Fixed the Workspaces list being pushed out of the mobile sidebar on short screens when plugins add many navigation items ([#8727](https://github.com/getpaseo/paseo/pull/8727) by [@jaredwang](https://github.com/jaredwang))
|
||||
- Fixed timeline plugins not receiving the sender, event and original text on agent-message tool calls ([#8492](https://github.com/getpaseo/paseo/pull/8492) by [@RRD-dev](https://github.com/RRD-dev), [@luoph](https://github.com/luoph))
|
||||
- Fixed plugin RPCs failing when their input or output schema uses a transform ([#8550](https://github.com/getpaseo/paseo/pull/8550))
|
||||
|
||||
### Breaking
|
||||
|
||||
- Removed the deprecated `agent.turn.after.timeline` SDK field, which always returned an empty list ([#9573](https://github.com/getpaseo/paseo/pull/9573) by [@jtomaszewski](https://github.com/jtomaszewski))
|
||||
|
||||
### Notes
|
||||
|
||||
- Update both the host and app to use the plugin gallery, background tasks, Change base, archive undo, background agents, plugin subscriptions and fx
|
||||
- Plugin authors reading `agent.turn.after.timeline` must use `timeline.refetch({ direction: "tail", limit: 1, wholeTurns: true })` and filter entries by `event.turnId`
|
||||
- Archive undo restores the workspace, not uncommitted files removed with its worktree
|
||||
- Background tasks, the Change base picker, archive undo, background agents, plugin subscriptions and fx need both the host and the app on this version
|
||||
|
||||
## 0.15.4 - 2026-11-10
|
||||
|
||||
|
||||
+29
-86
@@ -1,102 +1,45 @@
|
||||
# Changelog
|
||||
|
||||
## 0.16.0 - 2026-11-16
|
||||
## 0.16.0-beta.2 - 2026-11-11
|
||||
|
||||
- **后台任务**:在 Composer 上方查看并停止 Claude Code、Codex 和 OpenCode v2 的后台任务。 ([#6220](https://github.com/getpaseo/paseo/pull/6220), [#9162](https://github.com/getpaseo/paseo/pull/9162), [#9635](https://github.com/getpaseo/paseo/pull/9635),贡献者:[@fxlelouarn](https://github.com/fxlelouarn))
|
||||
- **内置插件库**:无需离开 Paseo,即可浏览、搜索和安装插件,并在同一页面管理插件设置和更新。 ([#9752](https://github.com/getpaseo/paseo/pull/9752))
|
||||
- **命令中心标签页**:在工作区、文件和操作之间切换,最近使用的工作区优先显示。搜索现在包含已归档工作区,还可匹配工作区内的 Agent 标题。 ([#9689](https://github.com/getpaseo/paseo/pull/9689))
|
||||
- **插件侧边栏视图**:插件可以用自己的布局替换侧边栏,展示已连接主机上的工作区和 Agent。在“设置 → 侧边栏”中为每台设备选择视图。 ([#8906](https://github.com/getpaseo/paseo/pull/8906))
|
||||
- **插件 Composer 控件**:插件可以添加 Composer 控件、编辑草稿和附件,以及更改 Agent 设置。插件还可以添加“新建工作区”条目,并在 Agent 和工作区上保存元数据。 ([#8744](https://github.com/getpaseo/paseo/pull/8744), [#9209](https://github.com/getpaseo/paseo/pull/9209), [#9207](https://github.com/getpaseo/paseo/pull/9207), [#9734](https://github.com/getpaseo/paseo/pull/9734),贡献者:[@michaelmwu](https://github.com/michaelmwu))
|
||||
- **排列用量卡片**:拖动 Provider 卡片来调整顺序,并关闭不想在侧边栏摘要中显示的卡片。在用量设置中选择主机。 ([#9660](https://github.com/getpaseo/paseo/pull/9660), [#9740](https://github.com/getpaseo/paseo/pull/9740), [#9748](https://github.com/getpaseo/paseo/pull/9748), [#9780](https://github.com/getpaseo/paseo/pull/9780))
|
||||
- **返回应用时更少提示**:返回没有变化的聊天时,不再闪现“正在更新消息”。Paseo 会保留可用的连接,并在你返回时恢复断开的连接。重连后,已是最新状态的聊天也不再显示额外的更新提示。 ([#9242](https://github.com/getpaseo/paseo/pull/9242), [#8651](https://github.com/getpaseo/paseo/pull/8651), [#9086](https://github.com/getpaseo/paseo/pull/9086), [#8855](https://github.com/getpaseo/paseo/pull/8855), [#9116](https://github.com/getpaseo/paseo/pull/9116), [#9558](https://github.com/getpaseo/paseo/pull/9558),贡献者:[@adamcstephens](https://github.com/adamcstephens))
|
||||
- **重建移动端聊天**:在 iOS 和 Android 上展开轮次摘要、待办卡片和工具组时,阅读位置保持不变。滚动期间发送消息会移到新提示词处。 ([#8717](https://github.com/getpaseo/paseo/pull/8717), [#9085](https://github.com/getpaseo/paseo/pull/9085), [#9806](https://github.com/getpaseo/paseo/pull/9806), [#9693](https://github.com/getpaseo/paseo/pull/9693))
|
||||
- **更快的 diff 加载**:“更改”在文件内容加载完成前先显示文件树。大型 diff 分批加载,且优先于后台 worktree 扫描。 ([#8907](https://github.com/getpaseo/paseo/pull/8907), [#9241](https://github.com/getpaseo/paseo/pull/9241), [#9243](https://github.com/getpaseo/paseo/pull/9243), [#9584](https://github.com/getpaseo/paseo/pull/9584))
|
||||
- **更快的 Composer 菜单**:大型列表中的命令和文件建议更快打开,并随 Composer 尺寸变化保持贴合。 ([#9657](https://github.com/getpaseo/paseo/pull/9657), [#9647](https://github.com/getpaseo/paseo/pull/9647), [#9642](https://github.com/getpaseo/paseo/pull/9642))
|
||||
- **移动端键盘快捷键**:连接键盘后,iPad 和 Android 可使用与桌面端相同的快捷键,包括自定义绑定。在 iPad Composer 中按 Shift+Tab 会切换模式,不再输入制表符。 ([#8625](https://github.com/getpaseo/paseo/pull/8625), [#9561](https://github.com/getpaseo/paseo/pull/9561),贡献者:[@jeroenfrenken](https://github.com/jeroenfrenken), [@lstroud](https://github.com/lstroud))
|
||||
- **适合触控的平板控件**:触屏设备上的宽屏布局使用更大的按钮和行。空间不足时,Composer 会将控件收进模型菜单。 ([#8748](https://github.com/getpaseo/paseo/pull/8748), [#8885](https://github.com/getpaseo/paseo/pull/8885), [#8891](https://github.com/getpaseo/paseo/pull/8891), [#8909](https://github.com/getpaseo/paseo/pull/8909), [#9151](https://github.com/getpaseo/paseo/pull/9151), [#9238](https://github.com/getpaseo/paseo/pull/9238), [#8739](https://github.com/getpaseo/paseo/pull/8739),贡献者:[@zeyugao](https://github.com/zeyugao))
|
||||
- **撤销工作区归档**:在六秒提示期间,点击“撤销”或按 Cmd/Ctrl+Z 可恢复已归档的工作区。Paseo 在移除 worktree 前会检查未保存的文件和未推送的提交。 ([#8904](https://github.com/getpaseo/paseo/pull/8904), [#9104](https://github.com/getpaseo/paseo/pull/9104), [#9625](https://github.com/getpaseo/paseo/pull/9625), [#9753](https://github.com/getpaseo/paseo/pull/9753),贡献者:[@ragokan](https://github.com/ragokan))
|
||||
- **后台任务**:Paseo 现在会在 Composer 上方显示 Agent 正在运行的后台任务,例如 shell 和监视器,每项都带“停止”按钮。支持 Claude Code、Codex 和 OpenCode v2。 ([#6220](https://github.com/getpaseo/paseo/pull/6220), [#9162](https://github.com/getpaseo/paseo/pull/9162),贡献者:[@fxlelouarn](https://github.com/fxlelouarn))
|
||||
- **插件侧边栏视图**:插件可以用自己的布局替换侧边栏内容,展示所有已连接主机上的工作区、Agent、项目和终端。在“设置 → 侧边栏”中为每台设备选择视图;Paseo 的侧边栏页眉和页脚保持不变。 ([#8906](https://github.com/getpaseo/paseo/pull/8906))
|
||||
- **插件 Composer 控件**:插件可以向 Composer 添加自己的控件,并读取和设置其中的提示词、附件、Provider、模型、模式和思考强度。插件还可以把光标放到任意 Agent 的 Composer 中、向“新建工作区”添加条目,并在 Agent 和工作区上保存自己的元数据。 ([#8744](https://github.com/getpaseo/paseo/pull/8744), [#9209](https://github.com/getpaseo/paseo/pull/9209), [#9207](https://github.com/getpaseo/paseo/pull/9207))
|
||||
- **更快的 diff 加载**:打开“更改”时会立即显示文件树,文件内容随后加载。大型 diff 分批到达,加载期间应用的其他部分照常响应,并且 diff 优先于 daemon 的后台 worktree 扫描。 ([#8907](https://github.com/getpaseo/paseo/pull/8907), [#9241](https://github.com/getpaseo/paseo/pull/9241), [#9243](https://github.com/getpaseo/paseo/pull/9243))
|
||||
- **细节打磨**:一轮对话结束时聊天保持不动,返回没有变化的聊天时直接显示原样,无需刷新。工具行从第一帧起就显示最终标题和图标,上下文窗口浮层打开时用量已加载完成,侧边栏悬停卡片一次只打开一个。 ([#8944](https://github.com/getpaseo/paseo/pull/8944), [#9175](https://github.com/getpaseo/paseo/pull/9175), [#9242](https://github.com/getpaseo/paseo/pull/9242), [#9248](https://github.com/getpaseo/paseo/pull/9248), [#9212](https://github.com/getpaseo/paseo/pull/9212), [#9071](https://github.com/getpaseo/paseo/pull/9071))
|
||||
- **重建移动端聊天时间线**:iOS 和 Android 上的聊天时间线已重建。展开或折叠轮次摘要、待办卡片或工具调用组时,你点按的那一行保持原位;在 Android 上,“显示更多”“收起”和计划卡片也是如此。 ([#8717](https://github.com/getpaseo/paseo/pull/8717), [#9085](https://github.com/getpaseo/paseo/pull/9085))
|
||||
- **移动端键盘快捷键**:连接键盘后,iPad 和 Android 现在可使用与桌面端相同的快捷键,包括你自定义的绑定。检测到键盘时会显示快捷键提示和“设置 → 快捷键”。在较窄的桌面端和浏览器窗口中快捷键同样可用。 ([#8625](https://github.com/getpaseo/paseo/pull/8625),贡献者:[@jeroenfrenken](https://github.com/jeroenfrenken)、[@lstroud](https://github.com/lstroud))
|
||||
- **适合触控的平板控件**:在 iPad 和其他触屏设备上,宽屏布局现在使用适合触控尺寸的按钮、行和栏。Composer 工具栏在空间不足时会把控件收进模型菜单;在工作区上向右滑动,可将已折叠的侧边栏以浮层方式显示。 ([#8748](https://github.com/getpaseo/paseo/pull/8748), [#8885](https://github.com/getpaseo/paseo/pull/8885), [#8891](https://github.com/getpaseo/paseo/pull/8891), [#8909](https://github.com/getpaseo/paseo/pull/8909), [#9151](https://github.com/getpaseo/paseo/pull/9151), [#9238](https://github.com/getpaseo/paseo/pull/9238), [#8739](https://github.com/getpaseo/paseo/pull/8739),贡献者:[@zeyugao](https://github.com/zeyugao))
|
||||
- **撤销工作区归档**:在应用中归档工作区时,现在会显示“Workspace 已归档”提示,持续六秒。点击“撤销”或按 Cmd/Ctrl+Z 可恢复该工作区及其标签页和 Agent。在桌面端,侧边栏的工作区行在悬停时还会显示归档按钮。 ([#8904](https://github.com/getpaseo/paseo/pull/8904), [#9104](https://github.com/getpaseo/paseo/pull/9104))
|
||||
- **返回时更少重连**:返回应用时会保留仍可用的连接,包括正在传输大型响应的连接,只在必要时重连一次。主机保存了多个连接时,Paseo 会留在可用的那个连接上。 ([#8651](https://github.com/getpaseo/paseo/pull/8651), [#9086](https://github.com/getpaseo/paseo/pull/9086), [#8855](https://github.com/getpaseo/paseo/pull/8855), [#9116](https://github.com/getpaseo/paseo/pull/9116))
|
||||
|
||||
### 新增
|
||||
|
||||
- 为 worktree 的 diff、提交和 Git 操作新增基准分支选择器(Change base) ([#8642](https://github.com/getpaseo/paseo/pull/8642), [#8934](https://github.com/getpaseo/paseo/pull/8934),贡献者:[@Myasuka](https://github.com/Myasuka))
|
||||
- 新增可解析 SSH 别名和 fork 上游仓库的 Issue 和 PR 链接 ([#8636](https://github.com/getpaseo/paseo/pull/8636), [#9576](https://github.com/getpaseo/paseo/pull/9576))
|
||||
- 新增 iPhone Duo 布局,侧边栏和工作区分列折痕两侧 ([#8741](https://github.com/getpaseo/paseo/pull/8741), [#8901](https://github.com/getpaseo/paseo/pull/8901),贡献者:[@zeyugao](https://github.com/zeyugao))
|
||||
- 在“更改”中为 worktree 工作区新增基准分支选择器(Change base),diff、提交列表和 Git 操作可改用其他分支 ([#8642](https://github.com/getpaseo/paseo/pull/8642), [#8934](https://github.com/getpaseo/paseo/pull/8934),贡献者:[@Myasuka](https://github.com/Myasuka))
|
||||
- 新增 Issue 和 PR 引用链接:Agent 回复、计划、PR 面板和文件预览中的 `#123`、`owner/repo#123` 等引用会链接到 GitHub、GitLab、Gitea、Forgejo 或 Codeberg ([#8636](https://github.com/getpaseo/paseo/pull/8636))
|
||||
- 新增 iPhone Duo 布局支持:工作区操作位于系统竖向栏中,侧边栏和工作区分列折痕两侧 ([#8741](https://github.com/getpaseo/paseo/pull/8741), [#8901](https://github.com/getpaseo/paseo/pull/8901),贡献者:[@zeyugao](https://github.com/zeyugao))
|
||||
- 新增 fx Provider,可在“设置 → Hosts → 提供方”的 Provider 目录中添加 ([#9160](https://github.com/getpaseo/paseo/pull/9160))
|
||||
- 新增后台 Agent,不占用标签页、不发送通知,也不出现在默认 Agent 列表中 ([#8683](https://github.com/getpaseo/paseo/pull/8683))
|
||||
- 新增后台 Agent:Agent 或插件可通过 `background: true` 创建辅助 Agent,它不打开标签页、不发送通知,也不出现在侧边栏和默认 Agent 列表中 ([#8683](https://github.com/getpaseo/paseo/pull/8683))
|
||||
- 新增 Terraform 和 HCL 文件(`.tf`、`.tfvars`、`.hcl`)的语法高亮 ([#9106](https://github.com/getpaseo/paseo/pull/9106))
|
||||
- 在每个 Agent 的环境中新增 `PASEO_WORKSPACE_ID`,Agent 可据此识别、重命名或归档自己的工作区 ([#8939](https://github.com/getpaseo/paseo/pull/8939),贡献者:[@DTTerastar](https://github.com/DTTerastar))
|
||||
- 为侧边栏工作区行新增插件徽章 ([#7645](https://github.com/getpaseo/paseo/pull/7645),贡献者:[@jtomaszewski](https://github.com/jtomaszewski))
|
||||
- 为无法预览的文件新增“下载”按钮 ([#9640](https://github.com/getpaseo/paseo/pull/9640))
|
||||
- 在用量中新增 Copilot 高级请求用量和剩余额度 ([#8489](https://github.com/getpaseo/paseo/pull/8489),贡献者:[@thisisryanswift](https://github.com/thisisryanswift))
|
||||
|
||||
### 变更
|
||||
|
||||
- 打开工作区时恢复你离开时的标签页,不再跳转到需要关注的 Agent ([#8935](https://github.com/getpaseo/paseo/pull/8935))
|
||||
- 问题卡片在选择选项后等待点击“下一步”或“提交” ([#8525](https://github.com/getpaseo/paseo/pull/8525))
|
||||
- 斜杠命令菜单不再默认选中 `/exit` ([#8905](https://github.com/getpaseo/paseo/pull/8905))
|
||||
- 调整工作区页眉控件以适应较窄的分屏窗格 ([#8740](https://github.com/getpaseo/paseo/pull/8740), [#9088](https://github.com/getpaseo/paseo/pull/9088),贡献者:[@zeyugao](https://github.com/zeyugao))
|
||||
- 问题卡片中选择选项后不再自动前进;请用“下一步”或“提交”继续 ([#8525](https://github.com/getpaseo/paseo/pull/8525))
|
||||
- 斜杠命令菜单现在显示加载和错误状态并提供“重试”,且不再默认选中 `/exit` ([#8905](https://github.com/getpaseo/paseo/pull/8905))
|
||||
- 文件浏览器(Explorer)或分屏使工作区变窄时,工作区页眉和标签页改用紧凑控件 ([#8740](https://github.com/getpaseo/paseo/pull/8740), [#9088](https://github.com/getpaseo/paseo/pull/9088),贡献者:[@zeyugao](https://github.com/zeyugao))
|
||||
- 向进程已退出的 Pi Agent 发送消息时立即失败,并提示重新加载该 Agent ([#8718](https://github.com/getpaseo/paseo/pull/8718))
|
||||
- 在桌面端和宽屏网页布局中,侧边栏的“重命名 workspace”改为在原处编辑标题,不再打开对话框 ([#9280](https://github.com/getpaseo/paseo/pull/9280))
|
||||
- “更新内容”先显示亮点,完整列表收在“显示全部变更”之后 ([#9281](https://github.com/getpaseo/paseo/pull/9281))
|
||||
- Claude Bypass 现在批准来自 ask 规则和钩子的执行请求,提问和计划审核仍保留交互 ([#9760](https://github.com/getpaseo/paseo/pull/9760))
|
||||
- Claude 权限卡片现在显示 Provider 提供的原因 ([#3950](https://github.com/getpaseo/paseo/pull/3950),贡献者:[@codebutler](https://github.com/codebutler))
|
||||
- PR 窗格中的“活动”可调整大小或折叠,为检查结果留出更多空间 ([#9656](https://github.com/getpaseo/paseo/pull/9656))
|
||||
- macOS 桌面端的标签页切换快捷键改为 Cmd+Shift+[ 和 Cmd+Shift+] ([#7692](https://github.com/getpaseo/paseo/pull/7692),贡献者:[@jtomaszewski](https://github.com/jtomaszewski))
|
||||
- 在“新建工作区”按 Cmd/Ctrl+N 会打开项目选择器,同时保留草稿 ([#9741](https://github.com/getpaseo/paseo/pull/9741))
|
||||
- 移动端设置导航现在恢复侧边栏之前的位置 ([#9641](https://github.com/getpaseo/paseo/pull/9641))
|
||||
- “更新内容”和网站更新日志改为先显示每个版本的亮点,完整列表收在“显示全部变更”之后 ([#9281](https://github.com/getpaseo/paseo/pull/9281))
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复较长的工具详情隐藏折叠标题或无法滚动查看输出的问题 ([#9770](https://github.com/getpaseo/paseo/pull/9770))
|
||||
- 修复图片预览加载时短暂显示错误或拉伸图片的问题 ([#9698](https://github.com/getpaseo/paseo/pull/9698))
|
||||
- 修复网页端和桌面端聊天在较早历史记录进入虚拟化后跳到开头的问题 ([#9664](https://github.com/getpaseo/paseo/pull/9664),贡献者:[@luoph](https://github.com/luoph))
|
||||
- 修复滚动到顶部后仍需再次滚动鼠标滚轮才能加载更早聊天记录的问题 ([#9570](https://github.com/getpaseo/paseo/pull/9570))
|
||||
- 修复跨越部分代码块复制选区时丢失缩进和换行的问题 ([#9515](https://github.com/getpaseo/paseo/pull/9515),贡献者:[@michaelmwu](https://github.com/michaelmwu))
|
||||
- 修复 Mermaid XY 图表的轴标题重叠和标签被裁切的问题 ([#9483](https://github.com/getpaseo/paseo/pull/9483),贡献者:[@FluidXin](https://github.com/FluidXin))
|
||||
- 修复 iOS 上点击命令后命令菜单仍保持打开的问题 ([#9755](https://github.com/getpaseo/paseo/pull/9755))
|
||||
- 修复 Agent 启动失败后无法重试已编辑草稿的问题 ([#9534](https://github.com/getpaseo/paseo/pull/9534),贡献者:[@michaelmwu](https://github.com/michaelmwu))
|
||||
- 修复 Android 平板上模型配置按钮不响应点按的问题 ([#9526](https://github.com/getpaseo/paseo/pull/9526),贡献者:[@moevis](https://github.com/moevis))
|
||||
- 修复更改外观后设置页面丢失滚动位置和编辑内容的问题 ([#9605](https://github.com/getpaseo/paseo/pull/9605))
|
||||
- 修复浅色插件主题中选中行难以阅读、Pure Black 中高亮几乎不可见的问题 ([#9579](https://github.com/getpaseo/paseo/pull/9579),贡献者:[@nathansgreen](https://github.com/nathansgreen))
|
||||
- 修复网页端和桌面端页眉及工具栏图标按钮缺少键盘焦点框的问题 ([#9745](https://github.com/getpaseo/paseo/pull/9745),贡献者:[@junjzhang](https://github.com/junjzhang))
|
||||
- 修复 iOS 和 Android 上拖动后侧边栏行短暂出现在错误位置的问题 ([#9681](https://github.com/getpaseo/paseo/pull/9681))
|
||||
- 修复桌面端在 daemon 仍启动时报告启动失败的问题 ([#9043](https://github.com/getpaseo/paseo/pull/9043),贡献者:[@magiclaw](https://github.com/magiclaw))
|
||||
- 修复网页端和桌面端终端恢复画面时丢失输入字符的问题 ([#9533](https://github.com/getpaseo/paseo/pull/9533))
|
||||
- 修复 Android 终端中实体方向键失效并丢失下一个输入字符的问题 ([#9407](https://github.com/getpaseo/paseo/pull/9407),贡献者:[@moevis](https://github.com/moevis))
|
||||
- 修复非 Git 工作区在命令中心缺少“归档工作区”的问题 ([#9777](https://github.com/getpaseo/paseo/pull/9777),贡献者:[@andheiberg](https://github.com/andheiberg))
|
||||
- 修复后续配置读取超时后工作区脚本消失的问题 ([#9477](https://github.com/getpaseo/paseo/pull/9477),贡献者:[@dinhphieu](https://github.com/dinhphieu))
|
||||
- 修复账号用量刷新失败后侧边栏用量隐藏该账号的问题 ([#9594](https://github.com/getpaseo/paseo/pull/9594))
|
||||
- 修复 Provider 会话已不存在时,已关闭 Agent 仍保持未读的问题 ([#9737](https://github.com/getpaseo/paseo/pull/9737),贡献者:[@luoph](https://github.com/luoph))
|
||||
- 修复 Agent 自主运行一轮后完成通知显示旧回复的问题 ([#9793](https://github.com/getpaseo/paseo/pull/9793))
|
||||
- 修复中断消息因“already has an active run”而失败的问题 ([#9537](https://github.com/getpaseo/paseo/pull/9537),贡献者:[@michaelmwu](https://github.com/michaelmwu))
|
||||
- 修复消息在交给 Provider 前失败后无法重试的问题 ([#9580](https://github.com/getpaseo/paseo/pull/9580),贡献者:[@tmad4000](https://github.com/tmad4000))
|
||||
- 修复刚重新打开的 Agent 在下一次空闲清理时失去 Provider 进程的问题 ([#8857](https://github.com/getpaseo/paseo/pull/8857),贡献者:[@fdkevin0](https://github.com/fdkevin0))
|
||||
- 修复空闲运行时清理导致 Claude 会话 cron 和 /loop 唤醒丢失的问题 ([#9744](https://github.com/getpaseo/paseo/pull/9744),贡献者:[@KronixDev](https://github.com/KronixDev))
|
||||
- 修复工具在回复之前开始、之后结束时无法从该回复分叉的问题 ([#9627](https://github.com/getpaseo/paseo/pull/9627),贡献者:[@ragokan](https://github.com/ragokan))
|
||||
- 修复大型 Codex 历史页面在单个条目仍符合大小限制时阻断历史加载的问题 ([#9432](https://github.com/getpaseo/paseo/pull/9432),贡献者:[@RockStone](https://github.com/RockStone))
|
||||
- 修复 OpenCode 使用 Bun 时,daemon 重启后会话无法重新连接的问题 ([#9653](https://github.com/getpaseo/paseo/pull/9653),贡献者:[@quickwind](https://github.com/quickwind))
|
||||
- 修复 OpenCode 升级到 v2 后刷新 Provider 仍保留 v1 的问题 ([#9593](https://github.com/getpaseo/paseo/pull/9593),贡献者:[@tkfka1](https://github.com/tkfka1))
|
||||
- 修复 OpenCode v2 无法发现仅对其会话可用的插件工具的问题 ([#9426](https://github.com/getpaseo/paseo/pull/9426),贡献者:[@dptsolutions](https://github.com/dptsolutions))
|
||||
- 修复 ACP Provider 按模型提供思考等级时,模型共用错误等级的问题 ([#9717](https://github.com/getpaseo/paseo/pull/9717),贡献者:[@AlfredRR](https://github.com/AlfredRR), [@doskoi](https://github.com/doskoi))
|
||||
- 修复没有输出的失败 ACP 工具阻止对话历史加载的问题 ([#9467](https://github.com/getpaseo/paseo/pull/9467),贡献者:[@Myasuka](https://github.com/Myasuka))
|
||||
- 修复带有 null 可选参数的 Pi 和 OMP 工具调用显示为未知工具的问题 ([#9506](https://github.com/getpaseo/paseo/pull/9506),贡献者:[@papag00se](https://github.com/papag00se))
|
||||
- 修复导入 OMP 会话时保存文件路径而非会话 ID 的问题 ([#8854](https://github.com/getpaseo/paseo/pull/8854),贡献者:[@LiebeLee](https://github.com/LiebeLee))
|
||||
- 修复跨主机子 Agent 与调用者使用相同 Provider 时丢失调用者模式的问题 ([#9512](https://github.com/getpaseo/paseo/pull/9512),贡献者:[@ortschun](https://github.com/ortschun))
|
||||
- 修复插件子 Agent 在会话关闭时从失败或已取消变为已完成的问题 ([#8563](https://github.com/getpaseo/paseo/pull/8563),贡献者:[@hadan8977](https://github.com/hadan8977))
|
||||
- 修复完整 Agent ID 不存在时,CLI 命令误操作标题与该 ID 相同的其他 Agent 的问题 ([#9680](https://github.com/getpaseo/paseo/pull/9680), [#9731](https://github.com/getpaseo/paseo/pull/9731),贡献者:[@ese111](https://github.com/ese111))
|
||||
- 修复无法归档、分离或重新加载未出现在 CLI 列表中的 Agent 的问题 ([#9726](https://github.com/getpaseo/paseo/pull/9726),贡献者:[@xunWhale](https://github.com/xunWhale))
|
||||
- 修复 `paseo agent wait` 在没有 Agent 匹配 ID 时仍成功退出的问题 ([#9782](https://github.com/getpaseo/paseo/pull/9782),贡献者:[@Eapp1e](https://github.com/Eapp1e))
|
||||
- 修复语音输入和输出都使用 OpenAI 时无法启动语音模式的问题 ([#9779](https://github.com/getpaseo/paseo/pull/9779),贡献者:[@Huyvux12](https://github.com/Huyvux12))
|
||||
- 修复听写流错误被 30 秒交付超时掩盖的问题 ([#9784](https://github.com/getpaseo/paseo/pull/9784),贡献者:[@tieo](https://github.com/tieo))
|
||||
- 修复插件 Provider 在 All 模式下拒绝 Review 附件的问题 ([#9590](https://github.com/getpaseo/paseo/pull/9590),贡献者:[@ese111](https://github.com/ese111))
|
||||
- 修复插件时间线写入接受应用无法显示的类型的问题 ([#7677](https://github.com/getpaseo/paseo/pull/7677),贡献者:[@ragokan](https://github.com/ragokan))
|
||||
- 修复一轮结束时聊天位置移动的问题 ([#8944](https://github.com/getpaseo/paseo/pull/8944), [#9175](https://github.com/getpaseo/paseo/pull/9175))
|
||||
- 修复 Claude 和 OpenCode 工具行随参数到达而更改标题和图标的问题 ([#9248](https://github.com/getpaseo/paseo/pull/9248))
|
||||
- 修复用量加载前上下文窗口浮层提前打开的问题 ([#9212](https://github.com/getpaseo/paseo/pull/9212))
|
||||
- 修复多个侧边栏悬停卡片同时打开的问题 ([#9071](https://github.com/getpaseo/paseo/pull/9071))
|
||||
|
||||
- 修复 Agent 在你离开期间完成后,返回聊天时工作指示器消失的问题 ([#9170](https://github.com/getpaseo/paseo/pull/9170))
|
||||
- 修复包含较短折叠轮次的聊天打开时留有空白、需滚动后才填满的问题 ([#8358](https://github.com/getpaseo/paseo/pull/8358), [#9083](https://github.com/getpaseo/paseo/pull/9083))
|
||||
- 修复空闲的 Claude、Codex 或 OpenCode Agent 恢复后,“折叠轮次”把较早的回复藏进后一轮摘要行的问题 ([#9098](https://github.com/getpaseo/paseo/pull/9098))
|
||||
- 修复提示词与其下方的回复或折叠轮次摘要行之间缺少间距的问题 ([#9009](https://github.com/getpaseo/paseo/pull/9009))
|
||||
- 修复聊天打开时,较长的用户消息有一帧不显示渐隐效果和“展开”的问题 ([#9302](https://github.com/getpaseo/paseo/pull/9302))
|
||||
- 修复紧跟在段落之后、中间没有空行的 Markdown 表格显示为原始竖线的问题 ([#8485](https://github.com/getpaseo/paseo/pull/8485),贡献者:[@ragokan](https://github.com/ragokan)、[@suk-6](https://github.com/suk-6)、[@thsrite](https://github.com/thsrite))
|
||||
- 修复网页版和桌面端中与文字同行的带链接徽章图片被渲染成整行宽度的问题 ([#8530](https://github.com/getpaseo/paseo/pull/8530))
|
||||
- 修复“查看源码”后点击“查看图表”会打开全屏、而不是回到内联 Mermaid 图表的问题 ([#8932](https://github.com/getpaseo/paseo/pull/8932),贡献者:[@luoph](https://github.com/luoph))
|
||||
@@ -104,16 +47,21 @@
|
||||
- 修复关闭 Agent 标签页时未发送的 Composer 文本和附件被删除的问题 ([#9079](https://github.com/getpaseo/paseo/pull/9079))
|
||||
- 修复向 Composer 粘贴带超链接的文本时丢失链接地址的问题;链接现在以 Markdown 形式粘贴 ([#8972](https://github.com/getpaseo/paseo/pull/8972))
|
||||
- 修复用鼠标点击“发送”后 Composer 失去焦点的问题 ([#9015](https://github.com/getpaseo/paseo/pull/9015))
|
||||
- 修复 iPhone 上 Composer 停在距底部边缘 50pt 处的问题 ([#8823](https://github.com/getpaseo/paseo/pull/8823),贡献者:[@zeyugao](https://github.com/zeyugao))
|
||||
- 修复从侧边栏和“新建工作区”点击“添加主机”会跳转到“设置”的问题 ([#8512](https://github.com/getpaseo/paseo/pull/8512))
|
||||
- 修复打开失败的 Agent 或选择 Mark as read 后,其红点和“失败”分组仍留在侧边栏的问题 ([#8831](https://github.com/getpaseo/paseo/pull/8831))
|
||||
- 修复在 Agent 运行时已关闭的情况下清除未读后,工作区的未读指示仍然亮着的问题 ([#9087](https://github.com/getpaseo/paseo/pull/9087))
|
||||
- 修复取消归档工作区时未恢复随之归档的 Agent 的问题 ([#9210](https://github.com/getpaseo/paseo/pull/9210))
|
||||
- 修复流式回复期间聊天一滚动上下文窗口浮层就自行关闭的问题 ([#8742](https://github.com/getpaseo/paseo/pull/8742),贡献者:[@3ae3ae](https://github.com/3ae3ae))
|
||||
- 修复侧边栏用量摘要只在打开“使用情况”时才更新的问题 ([#7806](https://github.com/getpaseo/paseo/pull/7806),贡献者:[@ragokan](https://github.com/ragokan))
|
||||
- 修复 Android 上位于触发元素上方的提示和菜单在打开后内容变多时短暂盖住触发元素的问题 ([#9247](https://github.com/getpaseo/paseo/pull/9247))
|
||||
- 修复在“历史”页面刷新网页版后显示“无法加载历史”的问题 ([#9029](https://github.com/getpaseo/paseo/pull/9029))
|
||||
- 修复 HTML 文件预览中的章节链接把预览替换成 Paseo 应用、而不是在文件内滚动的问题 ([#8559](https://github.com/getpaseo/paseo/pull/8559),贡献者:[@3ae3ae](https://github.com/3ae3ae))
|
||||
- 修复“文件”刷新期间文件夹处于折叠状态时,新建的文件一直不显示的问题 ([#8582](https://github.com/getpaseo/paseo/pull/8582),贡献者:[@hadan8977](https://github.com/hadan8977))
|
||||
- 修复分支仍在加载或请求失败时,分支切换器显示“没有找到分支。”的问题 ([#8938](https://github.com/getpaseo/paseo/pull/8938))
|
||||
- 修复文件被移到上一级目录时,提交历史显示双斜杠、没有重命名状态也没有 diff 的问题 ([#8509](https://github.com/getpaseo/paseo/pull/8509),贡献者:[@hadan8977](https://github.com/hadan8977))
|
||||
- 修复检出落后于 PR 头部时,已合并的 PR 从其工作区中消失的问题
|
||||
- 修复工作区 Git 监视器在设置超时后一直停留在回退轮询的问题
|
||||
- 修复网页版或桌面端重连后,被放弃的连接最多保持打开 45 秒的问题 ([#9067](https://github.com/getpaseo/paseo/pull/9067))
|
||||
- 修复通过另一台主机路由的连接在获取超大时间线时以“The receiving client cannot keep up with host output”关闭的问题 ([#9109](https://github.com/getpaseo/paseo/pull/9109))
|
||||
- 修复已连接的主机在更新到受支持的版本后仍停留在错误状态的问题 ([#8423](https://github.com/getpaseo/paseo/pull/8423),贡献者:[@DAnaeto](https://github.com/DAnaeto))
|
||||
@@ -175,21 +123,16 @@
|
||||
- 修复 daemon 因无效消息终止插件后,该插件仍留在列表中且未报告退出的问题 ([#9285](https://github.com/getpaseo/paseo/pull/9285),贡献者:[@Brandon168](https://github.com/Brandon168))
|
||||
- 修复 ACP Provider 插件丢弃 Agent 在提示词响应中报告的 token 用量的问题 ([#9396](https://github.com/getpaseo/paseo/pull/9396),贡献者:[@Myasuka](https://github.com/Myasuka))
|
||||
- 修复已发布的 `@getpaseo/*` npm 包未声明许可证的问题;现在声明为 Apache-2.0 ([#7816](https://github.com/getpaseo/paseo/pull/7816),贡献者:[@mdlawson](https://github.com/mdlawson)、[@ragokan](https://github.com/ragokan))
|
||||
- 修复插件更新了自己的某张时间线卡片后,从较早的回复分叉因“This checkpoint changed after it was created”失败的问题 ([#8746](https://github.com/getpaseo/paseo/pull/8746),贡献者:[@monarchmaisuriya](https://github.com/monarchmaisuriya))
|
||||
- 修复由插件渲染最终回复时,“折叠轮次”让轮次保持展开或折叠到较早回复的问题 ([#8811](https://github.com/getpaseo/paseo/pull/8811),贡献者:[@geoqiao](https://github.com/geoqiao))
|
||||
- 修复应用刷新后插件目录仍在加载时,插件页面显示“This plugin surface is unavailable”的问题 ([#8123](https://github.com/getpaseo/paseo/pull/8123),贡献者:[@vs-tahir](https://github.com/vs-tahir))
|
||||
- 修复插件添加了许多导航项时,矮屏上的工作区列表被挤出移动端侧边栏的问题 ([#8727](https://github.com/getpaseo/paseo/pull/8727),贡献者:[@jaredwang](https://github.com/jaredwang))
|
||||
- 修复时间线插件在 Agent 消息工具调用上收不到发送方、事件和原始文本的问题 ([#8492](https://github.com/getpaseo/paseo/pull/8492),贡献者:[@RRD-dev](https://github.com/RRD-dev)、[@luoph](https://github.com/luoph))
|
||||
- 修复输入或输出 schema 使用 transform 时插件 RPC 失败的问题 ([#8550](https://github.com/getpaseo/paseo/pull/8550))
|
||||
|
||||
### 破坏性变更
|
||||
|
||||
- 移除已弃用且始终返回空列表的 `agent.turn.after.timeline` SDK 字段 ([#9573](https://github.com/getpaseo/paseo/pull/9573),贡献者:[@jtomaszewski](https://github.com/jtomaszewski))
|
||||
|
||||
### 说明
|
||||
|
||||
- 使用插件库、后台任务、Change base、归档撤销、后台 Agent、插件订阅和 fx 时,请同时更新主机和应用
|
||||
- 读取 `agent.turn.after.timeline` 的插件作者必须改用 `timeline.refetch({ direction: "tail", limit: 1, wholeTurns: true })`,并按 `event.turnId` 筛选条目
|
||||
- 归档撤销会恢复工作区,但不会恢复随 worktree 一起移除的未提交文件
|
||||
- 后台任务、基准分支选择器、归档撤销、后台 Agent、插件订阅和 fx 需要主机和应用都更新到此版本
|
||||
|
||||
## 0.15.4 - 2026-11-10
|
||||
|
||||
|
||||
@@ -156,10 +156,8 @@ keeps following.
|
||||
|
||||
Following resumes only for a gesture that ends within 1 px of the end, either when the finger lifts
|
||||
or when momentum stops. A release past the end counts: iOS bounces back to the end, and lines that
|
||||
land during the bounce must keep scrolling in. A release short of the end stays detached with the scroll-to-bottom pill unless you submitted
|
||||
another prompt during that gesture. That submit requests the end after the gesture finishes;
|
||||
a new drag after submitting takes ownership again. Rewind and tail-fetch completions do not
|
||||
override a scroll away because they can arrive after the action that requested them.
|
||||
land during the bounce must keep scrolling in. A release anywhere short of the end stays detached
|
||||
with the scroll-to-bottom pill, so the rows the user let go of never move.
|
||||
|
||||
### Draw distance
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@ Every block is separated by one gap, `density.blockGap`: 12 on compact layouts,
|
||||
|
||||
Workspace file links use the shared file-link resolver. The workspace supplies its client, root and open-file action once; chat can supply the agent's more specific context. URLs use the same link press path. Recognized inline-code paths stay tappable. The library callback carries the tapped occurrence’s syntax context. Preserve it when opening files: explicit Markdown links decode URL escapes, while recognized inline-code paths preserve literal percent characters and use suffix lookup. Identical URL strings in different occurrences must stay distinct. Explicit absolute workspace links receive a relative hover title; existing authored titles remain intact. Inside a workspace, forge references such as `#12` and `owner/repo#12` are recognized in prose (not code) and open the workspace forge; the reference pattern comes before path recognition so `group/project#12` is not read as a path. See [forge providers](forge-providers.md#gotchas).
|
||||
|
||||
Pass `external` for author-controlled Markdown from outside the host, such as a plugin README. It follows the registry's overview contract in `packages/protocol/src/plugin-overview.ts`, which the website also uses: only absolute https links and images work, and any other destination renders as its label or alt text. The parser still autolinks bare `http://`, `www.` and email text, so a link press checks the URL again and opens only https. None of the workspace recognition above applies, so `Node.js` is prose, not a file. The lines of a paragraph join, as they do on the README's forge.
|
||||
|
||||
Resolve workspace image paths over the existing session RPC, then give the library a cached native file URL or web blob URL. HTTP(S) images pass through unchanged. This preserves relay, SSH and local socket connections, which do not expose a daemon HTTP endpoint. Each mounted renderer owns its image acquisition identity, so a later reply reads a rewritten path again while the earlier mounted reply retains its snapshot. Image taps open the attachment lightbox. File previews resolve relative images against the Markdown file's directory. An image alone on its line becomes its own paragraph before the library sees it, so it renders as a block on every platform; the library only treats sole-child paragraph images as blocks, and with hard soft breaks every newline is a break node, which left own-line images inline on iOS and web. Images that share a line with text stay inline at line height and keep their aspect ratio. A linked image counts as an image, so review-bot badges such as `[](url) Confidence` stay inline on web; the library's web renderer only checked direct paragraph children, so it rendered them as full-width block images (local patch in `patches/react-native-enriched-markdown+*.patch`).
|
||||
|
||||
## Engine constraints
|
||||
|
||||
+3
-4
@@ -873,10 +873,9 @@ await paseo.agents.ref(agentId).timeline.append({
|
||||
The daemon stamps the runtime `pluginId`; plugin code never supplies it. Reusing the same `id`
|
||||
replaces the previous row from that plugin on live clients and fresh timeline fetches. Rows live in
|
||||
the daemon's in-memory timeline and survive scroll, refetch, and reconnect, but not a daemon
|
||||
restart. A row without an installed renderer shows an unavailable placeholder. `kind` must match
|
||||
`/^[a-z][a-z0-9-]*$/`, the rule `addTimelineRenderer` enforces; the daemon rejects any other kind.
|
||||
Serialized `data` must be at most 64 KiB; the daemon rejects a larger append instead of storing a
|
||||
payload that cannot be rendered intact. The daemon advertises this RPC through
|
||||
restart. A row without an installed renderer shows an unavailable placeholder. Serialized `data`
|
||||
must be at most 64 KiB; the daemon rejects a larger append instead of storing a payload that cannot
|
||||
be rendered intact. The daemon advertises this RPC through
|
||||
`server_info.features.pluginTimelineItems`.
|
||||
|
||||
## Contribute client slash commands
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
- Background tasks: See and stop background tasks above the composer for Claude Code, Codex and OpenCode v2.
|
||||
- Built-in plugin gallery: Browse, search and install plugins without leaving Paseo. Manage their settings and updates from the same page.
|
||||
- Command center tabs: Switch between Workspaces, Files and Actions, with recent workspaces shown first. Search now includes archived workspaces and matches agent titles within their workspace.
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -1,5 +0,0 @@
|
||||
- Background tasks: See and stop background tasks above the composer for Claude Code, Codex and OpenCode v2.
|
||||
- Built-in plugin gallery: Browse, search and install plugins without leaving Paseo. Manage their settings and updates from the same page.
|
||||
- Command center tabs: Switch between Workspaces, Files and Actions, with recent workspaces shown first. Search now includes archived workspaces and matches agent titles within their workspace.
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -1,5 +0,0 @@
|
||||
- Background tasks: See and stop background tasks above the composer for Claude Code, Codex and OpenCode v2.
|
||||
- Built-in plugin gallery: Browse, search and install plugins without leaving Paseo. Manage their settings and updates from the same page.
|
||||
- Command center tabs: Switch between Workspaces, Files and Actions, with recent workspaces shown first. Search now includes archived workspaces and matches agent titles within their workspace.
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -1,5 +0,0 @@
|
||||
- Background tasks: See and stop background tasks above the composer for Claude Code, Codex and OpenCode v2.
|
||||
- Built-in plugin gallery: Browse, search and install plugins without leaving Paseo. Manage their settings and updates from the same page.
|
||||
- Command center tabs: Switch between Workspaces, Files and Actions, with recent workspaces shown first. Search now includes archived workspaces and matches agent titles within their workspace.
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
+1
-1
@@ -1 +1 @@
|
||||
sha256-alhf4ULeJ7n8sfgnxsX8Ugw40GB7jz0u9R/3/MOveIw=
|
||||
sha256-e6BNeOJvy1uyDe/XW9hdr7NBgJ+t9tlNum5oLNefREI=
|
||||
|
||||
Generated
+28
-28
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "paseo",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.0-beta.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "paseo",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.0-beta.2",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"workspaces": [
|
||||
@@ -37468,7 +37468,7 @@
|
||||
},
|
||||
"packages/app": {
|
||||
"name": "@getpaseo/app",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.0-beta.2",
|
||||
"dependencies": {
|
||||
"@codemirror/commands": "6.10.4",
|
||||
"@codemirror/language": "6.12.4",
|
||||
@@ -39637,13 +39637,13 @@
|
||||
},
|
||||
"packages/cli": {
|
||||
"name": "@getpaseo/cli",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.0-beta.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^1.0.0",
|
||||
"@getpaseo/client": "0.16.0",
|
||||
"@getpaseo/protocol": "0.16.0",
|
||||
"@getpaseo/server": "0.16.0",
|
||||
"@getpaseo/client": "0.16.0-beta.2",
|
||||
"@getpaseo/protocol": "0.16.0-beta.2",
|
||||
"@getpaseo/server": "0.16.0-beta.2",
|
||||
"chalk": "^5.3.0",
|
||||
"commander": "^12.0.0",
|
||||
"mime-types": "^2.1.35",
|
||||
@@ -39890,11 +39890,11 @@
|
||||
},
|
||||
"packages/client": {
|
||||
"name": "@getpaseo/client",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.0-beta.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@getpaseo/protocol": "0.16.0",
|
||||
"@getpaseo/relay": "0.16.0",
|
||||
"@getpaseo/protocol": "0.16.0-beta.2",
|
||||
"@getpaseo/relay": "0.16.0-beta.2",
|
||||
"ws": "^8.20.0",
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
@@ -39906,7 +39906,7 @@
|
||||
},
|
||||
"packages/desktop": {
|
||||
"name": "@getpaseo/desktop",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.0-beta.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@getpaseo/cli": "*",
|
||||
@@ -40149,7 +40149,7 @@
|
||||
},
|
||||
"packages/expo-two-way-audio": {
|
||||
"name": "@getpaseo/expo-two-way-audio",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.0-beta.2",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.14",
|
||||
@@ -40195,7 +40195,7 @@
|
||||
},
|
||||
"packages/highlight": {
|
||||
"name": "@getpaseo/highlight",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.0-beta.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@codemirror/language": "6.12.4",
|
||||
@@ -40225,7 +40225,7 @@
|
||||
},
|
||||
"packages/plugin": {
|
||||
"name": "@getpaseo/plugin",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.0-beta.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "^1.4.0",
|
||||
@@ -40233,8 +40233,8 @@
|
||||
"use-sync-external-store": "^1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@getpaseo/client": "0.16.0",
|
||||
"@getpaseo/protocol": "0.16.0",
|
||||
"@getpaseo/client": "0.16.0-beta.2",
|
||||
"@getpaseo/protocol": "0.16.0-beta.2",
|
||||
"@types/node": "^20.9.0",
|
||||
"@types/react": "~19.2.0",
|
||||
"react": "19.2.3",
|
||||
@@ -40244,8 +40244,8 @@
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@getpaseo/client": "0.16.0",
|
||||
"@getpaseo/protocol": "0.16.0",
|
||||
"@getpaseo/client": "0.16.0-beta.2",
|
||||
"@getpaseo/protocol": "0.16.0-beta.2",
|
||||
"react": ">=19.1.0 <20",
|
||||
"react-native": ">=0.81.5",
|
||||
"zod": "^4.4.3"
|
||||
@@ -40267,7 +40267,7 @@
|
||||
},
|
||||
"packages/protocol": {
|
||||
"name": "@getpaseo/protocol",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.0-beta.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"semver": "^7.8.5",
|
||||
@@ -40295,7 +40295,7 @@
|
||||
},
|
||||
"packages/relay": {
|
||||
"name": "@getpaseo/relay",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.0-beta.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@noble/ciphers": "^2.4.0",
|
||||
@@ -40517,17 +40517,17 @@
|
||||
},
|
||||
"packages/server": {
|
||||
"name": "@getpaseo/server",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.0-beta.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "^0.17.1",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.3.246",
|
||||
"@anthropic-ai/sdk": "^0.104.2",
|
||||
"@getpaseo/client": "0.16.0",
|
||||
"@getpaseo/highlight": "0.16.0",
|
||||
"@getpaseo/plugin": "0.16.0",
|
||||
"@getpaseo/protocol": "0.16.0",
|
||||
"@getpaseo/relay": "0.16.0",
|
||||
"@getpaseo/client": "0.16.0-beta.2",
|
||||
"@getpaseo/highlight": "0.16.0-beta.2",
|
||||
"@getpaseo/plugin": "0.16.0-beta.2",
|
||||
"@getpaseo/protocol": "0.16.0-beta.2",
|
||||
"@getpaseo/relay": "0.16.0-beta.2",
|
||||
"@isaacs/ttlcache": "^2.1.4",
|
||||
"@modelcontextprotocol/sdk": "1.29.0",
|
||||
"@opencode-ai/sdk": "1.14.46",
|
||||
@@ -41474,7 +41474,7 @@
|
||||
},
|
||||
"packages/website": {
|
||||
"name": "@getpaseo/website",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.0-beta.2",
|
||||
"dependencies": {
|
||||
"@cloudflare/vite-plugin": "^1.29.1",
|
||||
"@cloudflare/workers-types": "^4.20260317.1",
|
||||
@@ -43084,7 +43084,7 @@
|
||||
},
|
||||
"plugins": {
|
||||
"name": "@getpaseo/builtin-plugins",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.0-beta.2",
|
||||
"dependencies": {
|
||||
"@getpaseo/plugin": "*",
|
||||
"zod": "^4.4.3"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "paseo",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.0-beta.2",
|
||||
"private": true,
|
||||
"description": "Paseo: voice-controlled development environment for local AI coding agents",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
import { existsSync } from "node:fs";
|
||||
import { expect, test } from "../support/fixtures";
|
||||
import { gotoAppShell } from "../support/helpers/app";
|
||||
import { openCommandCenter } from "../support/helpers/command-center";
|
||||
import { openWorkspaceFromCommandCenter } from "../support/helpers/command-center-workspace-actions";
|
||||
import { seedWorkspace, type SeededWorkspace } from "../support/helpers/seed-client";
|
||||
import { projectEquivalenceViewKey } from "../support/helpers/project-view-key";
|
||||
import { getServerId } from "../support/helpers/server-id";
|
||||
import { expectWorkspaceAbsentFromSidebar } from "../support/helpers/sidebar";
|
||||
|
||||
async function isWorkspaceListed(seeded: SeededWorkspace): Promise<boolean> {
|
||||
const result = await seeded.client.fetchWorkspaces();
|
||||
return result.entries.some((entry) => entry.id === seeded.workspaceId);
|
||||
}
|
||||
|
||||
async function expectWorkspaceArchivedOnDaemon(seeded: SeededWorkspace): Promise<void> {
|
||||
await expect.poll(() => isWorkspaceListed(seeded), { timeout: 30_000 }).toBe(false);
|
||||
}
|
||||
|
||||
test.describe("Command center archive for a non-Git workspace", () => {
|
||||
test("archives a plain directory workspace from the command center", async ({ page }) => {
|
||||
const title = "Command Center Directory Archive";
|
||||
const seeded = await seedWorkspace({ repoPrefix: "cc-archive-dir-", title, git: false });
|
||||
|
||||
try {
|
||||
await gotoAppShell(page);
|
||||
await openWorkspaceFromCommandCenter(page, seeded, title);
|
||||
|
||||
const panel = await openCommandCenter(page);
|
||||
await panel.getByTestId("command-center-input").fill("archive");
|
||||
const archive = panel.getByRole("button", { name: /^Archive(?: workspace)?(?:\s|$)/ });
|
||||
await expect(archive).toBeVisible({ timeout: 30_000 });
|
||||
await archive.click();
|
||||
|
||||
await expectWorkspaceAbsentFromSidebar(page, seeded.workspaceId);
|
||||
expect(existsSync(seeded.repoPath)).toBe(true);
|
||||
} finally {
|
||||
await seeded.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("archives a plain directory workspace from the command center with the sidebar closed", async ({
|
||||
page,
|
||||
}) => {
|
||||
const title = "Command Center Directory Archive Closed Sidebar";
|
||||
const seeded = await seedWorkspace({ repoPrefix: "cc-archive-dir-closed-", title, git: false });
|
||||
|
||||
try {
|
||||
await gotoAppShell(page);
|
||||
await openWorkspaceFromCommandCenter(page, seeded, title);
|
||||
|
||||
await page.getByTestId("menu-button").click();
|
||||
await expect(page.getByTestId("sidebar-search")).toBeHidden({ timeout: 10_000 });
|
||||
|
||||
const modifier = process.platform === "darwin" ? "Meta" : "Control";
|
||||
await page.keyboard.press(`${modifier}+k`);
|
||||
const panel = page.getByTestId("command-center-panel");
|
||||
await expect(panel).toBeVisible({ timeout: 30_000 });
|
||||
await panel.getByTestId("command-center-input").fill("archive");
|
||||
const archive = panel.getByRole("button", { name: /^Archive(?: workspace)?(?:\s|$)/ });
|
||||
await expect(archive).toBeVisible({ timeout: 30_000 });
|
||||
await archive.click();
|
||||
|
||||
await expectWorkspaceArchivedOnDaemon(seeded);
|
||||
} finally {
|
||||
await seeded.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("archives a plain directory workspace from the command center with its project collapsed", async ({
|
||||
page,
|
||||
}) => {
|
||||
const title = "Command Center Directory Archive Collapsed Project";
|
||||
const seeded = await seedWorkspace({
|
||||
repoPrefix: "cc-archive-dir-collapsed-",
|
||||
title,
|
||||
git: false,
|
||||
});
|
||||
|
||||
try {
|
||||
await gotoAppShell(page);
|
||||
await openWorkspaceFromCommandCenter(page, seeded, title);
|
||||
|
||||
const workspaceRow = page.getByTestId(
|
||||
`sidebar-workspace-row-${getServerId()}:${seeded.workspaceId}`,
|
||||
);
|
||||
await expect(workspaceRow).toBeVisible({ timeout: 30_000 });
|
||||
await page
|
||||
.getByTestId(`sidebar-project-row-${projectEquivalenceViewKey(seeded.projectKey)}`)
|
||||
.first()
|
||||
.click();
|
||||
await expect(workspaceRow).toHaveCount(0, { timeout: 10_000 });
|
||||
|
||||
const panel = await openCommandCenter(page);
|
||||
await panel.getByTestId("command-center-input").fill("archive");
|
||||
const archive = panel.getByRole("button", { name: /^Archive(?: workspace)?(?:\s|$)/ });
|
||||
await expect(archive).toBeVisible({ timeout: 30_000 });
|
||||
await archive.click();
|
||||
|
||||
await expectWorkspaceArchivedOnDaemon(seeded);
|
||||
} finally {
|
||||
await seeded.cleanup();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -788,20 +788,11 @@ test.describe("Composer autocomplete", () => {
|
||||
await input.press("ArrowDown");
|
||||
await input.press("h");
|
||||
// On web the search reads the cursor after paint, so the input's value runs ahead of
|
||||
// the list. Wait on the list itself. The list mounts only the rows near its scroll
|
||||
// position, so one missing row proves nothing: right after the arrows wrap to the top,
|
||||
// /tdd at the bottom is unmounted while the search is still "". With the search at "",
|
||||
// the list always mounts the bottom row (/tdd) or the chosen one (/exit); only the
|
||||
// search "h" leaves both out. Check them in one query so no frame falls between them.
|
||||
await expect(
|
||||
popover.filter({
|
||||
has: page.getByText("/help", { exact: true }),
|
||||
hasNot: page.getByText(/^\/(tdd|exit)$/),
|
||||
}),
|
||||
).toBeVisible();
|
||||
// the list. Wait on the list itself: /tdd is hidden only while the search is "h", and
|
||||
// back only once the search is "" again.
|
||||
await expect(popover.getByText("/tdd", { exact: true })).toHaveCount(0);
|
||||
await input.press("Backspace");
|
||||
await expect(input).toHaveValue("/");
|
||||
// /tdd is back only once the search is "" again.
|
||||
await expect(popover.getByText("/tdd", { exact: true }).first()).toBeVisible();
|
||||
await input.press("Enter");
|
||||
|
||||
|
||||
@@ -20,21 +20,6 @@ function explorerSidebar(page: Parameters<typeof ensureExplorerSidebar>[0]) {
|
||||
return page.getByTestId("workspace-explorer-sidebar").filter({ visible: true });
|
||||
}
|
||||
|
||||
const LAYOUT_VIEWPORTS = {
|
||||
compact: { width: 390, height: 844 },
|
||||
wide: { width: 1280, height: 900 },
|
||||
};
|
||||
|
||||
// The previous layout stays on screen for a few renders after the resize. Wait for the shell to
|
||||
// switch so the next step reads the layout it resized to.
|
||||
async function resizeToLayout(
|
||||
page: Parameters<typeof ensureExplorerSidebar>[0],
|
||||
layout: keyof typeof LAYOUT_VIEWPORTS,
|
||||
) {
|
||||
await page.setViewportSize(LAYOUT_VIEWPORTS[layout]);
|
||||
await expect(page.getByTestId(`${layout}-shell`)).toBeVisible();
|
||||
}
|
||||
|
||||
async function expectExplorerActiveTabForeground(
|
||||
page: Parameters<typeof ensureExplorerSidebar>[0],
|
||||
) {
|
||||
@@ -259,7 +244,7 @@ test("tablet prototype keeps Explorer tabs when resizing down to a phone", async
|
||||
await page.screenshot({ path: testInfo.outputPath("tablet-951.png") });
|
||||
await openExplorerAgentDraft(page);
|
||||
await page.screenshot({ path: testInfo.outputPath("tablet-agent-draft.png") });
|
||||
await resizeToLayout(page, "compact");
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await revealPhoneExplorer(page);
|
||||
await expect(
|
||||
explorerSidebar(page).getByRole("button", { name: "New tab", exact: true }),
|
||||
@@ -304,10 +289,10 @@ test("retains the Explorer host through appearance changes and folding", async (
|
||||
.poll(() => explorer.evaluate((element) => getComputedStyle(element).backgroundColor))
|
||||
.not.toBe(previousColor);
|
||||
expect(await host.evaluate((element) => element.isConnected)).toBe(true);
|
||||
await resizeToLayout(page, "compact");
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await ensureExplorerSidebar(page);
|
||||
expect(await host.evaluate((element) => element.isConnected)).toBe(true);
|
||||
await resizeToLayout(page, "wide");
|
||||
await page.setViewportSize({ width: 1280, height: 900 });
|
||||
await expect(explorer).toBeVisible();
|
||||
expect(await host.evaluate((element) => element.isConnected)).toBe(true);
|
||||
} finally {
|
||||
@@ -342,7 +327,7 @@ test("reorders compact Explorer tabs with a pointer without changing selection",
|
||||
const workspace = await seedWorkspace({ repoPrefix: "explorer-compact-drag-" });
|
||||
try {
|
||||
await gotoWorkspace(page, workspace.workspaceId);
|
||||
await resizeToLayout(page, "compact");
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await openFilesPanel(page);
|
||||
await reorderCompactExplorerTabs(page);
|
||||
await expect(
|
||||
@@ -409,9 +394,9 @@ test("updates populated code and diff appearance without losing the editor insta
|
||||
.getByTestId("file-source-editor")
|
||||
.elementHandle();
|
||||
await text.fill(`${source}\n// retained Explorer edit`);
|
||||
await resizeToLayout(page, "compact");
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await ensureExplorerSidebar(page);
|
||||
await resizeToLayout(page, "wide");
|
||||
await page.setViewportSize({ width: 1280, height: 900 });
|
||||
expect(await explorerEditor!.evaluate((node) => node.isConnected)).toBe(true);
|
||||
await expect(text).toContainText("retained Explorer edit");
|
||||
} finally {
|
||||
@@ -476,9 +461,9 @@ test("retains populated Explorer chat and terminal attachments through appearanc
|
||||
const terminalNode = await terminal.elementHandle();
|
||||
await page.getByTestId("workspace-explorer-toggle").first().click();
|
||||
await ensureExplorerSidebar(page);
|
||||
await resizeToLayout(page, "compact");
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await ensureExplorerSidebar(page);
|
||||
await resizeToLayout(page, "wide");
|
||||
await page.setViewportSize({ width: 1280, height: 900 });
|
||||
await cycleWorkspaceTheme(page);
|
||||
expect(await terminalNode!.evaluate((node) => node.isConnected)).toBe(true);
|
||||
expect(attaches).toHaveLength(1);
|
||||
@@ -498,7 +483,7 @@ test("compact file sheets cover Explorer and return to its retained file list",
|
||||
try {
|
||||
await writeFile(`${workspace.repoPath}/sheet-marker.txt`, "Explorer sheet marker\n");
|
||||
await gotoWorkspace(page, workspace.workspaceId);
|
||||
await resizeToLayout(page, "compact");
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
const explorer = await ensureExplorerSidebar(page);
|
||||
await openFilesPanel(page);
|
||||
const host = await explorer.elementHandle();
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
import { expect, type Locator, type Page } from "@playwright/test";
|
||||
import { test } from "../support/fixtures";
|
||||
import { gotoWorkspace } from "../support/helpers/launcher";
|
||||
import { seedWorkspace } from "../support/helpers/seed-client";
|
||||
import { waitForWorkspaceTabsVisible } from "../support/helpers/workspace-tabs";
|
||||
|
||||
const HEADER_ICON_BUTTONS = ["workspace-header-menu-trigger", "workspace-explorer-toggle"];
|
||||
|
||||
function visible(page: Page, testId: string): Locator {
|
||||
return page.getByTestId(testId).filter({ visible: true }).first();
|
||||
}
|
||||
|
||||
function matchesFocusVisible(target: Locator): Promise<boolean> {
|
||||
return target.evaluate((el) => el.matches(":focus-visible"));
|
||||
}
|
||||
|
||||
async function expectKeyboardFocusRing(page: Page, testId: string): Promise<void> {
|
||||
const button = visible(page, testId);
|
||||
// Chromium matches :focus-visible on a programmatic focus that follows keyboard input.
|
||||
await page.keyboard.press("Shift");
|
||||
await button.focus();
|
||||
await expect(button).toBeFocused();
|
||||
expect(await matchesFocusVisible(button)).toBe(true);
|
||||
await expect(button).toHaveCSS("outline-style", "solid");
|
||||
await expect(button).toHaveCSS("outline-width", "2px");
|
||||
// Header rows clip overflow; an outset ring would lose its top and bottom edges.
|
||||
await expect(button).toHaveCSS("outline-offset", "-2px");
|
||||
}
|
||||
|
||||
async function expectNoPointerFocusRing(page: Page, testId: string): Promise<void> {
|
||||
const button = visible(page, testId);
|
||||
await button.blur();
|
||||
// Toggle twice so the layout ends where it started.
|
||||
await button.click();
|
||||
await button.click();
|
||||
await expect(button).toBeFocused();
|
||||
expect(await matchesFocusVisible(button)).toBe(false);
|
||||
await expect(button).toHaveCSS("outline-style", "none");
|
||||
}
|
||||
|
||||
test.describe("Icon button focus ring", () => {
|
||||
test("header icon buttons show the focus ring for keyboard focus only", async ({ page }) => {
|
||||
await page.setViewportSize({ width: 1440, height: 900 });
|
||||
const workspace = await seedWorkspace({ repoPrefix: "icon-button-focus-" });
|
||||
try {
|
||||
await gotoWorkspace(page, workspace.workspaceId);
|
||||
await waitForWorkspaceTabsVisible(page);
|
||||
for (const testId of HEADER_ICON_BUTTONS) {
|
||||
await expectKeyboardFocusRing(page, testId);
|
||||
}
|
||||
await expectNoPointerFocusRing(page, "workspace-explorer-toggle");
|
||||
} finally {
|
||||
await workspace.cleanup();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,24 +0,0 @@
|
||||
import {
|
||||
test,
|
||||
expectStillBrowsing,
|
||||
installFromPage,
|
||||
installListingFromRow,
|
||||
openDirectory,
|
||||
openFromInstalledTab,
|
||||
openListingPage,
|
||||
uninstallFromPage,
|
||||
} from "../support/helpers/plugin-directory";
|
||||
|
||||
test("installs a listed plugin from Browse and uninstalls it from either of its pages", async ({
|
||||
page,
|
||||
directoryHost,
|
||||
}) => {
|
||||
await openDirectory(page, directoryHost);
|
||||
await installListingFromRow(page);
|
||||
await expectStillBrowsing(page);
|
||||
await openListingPage(page);
|
||||
await uninstallFromPage(page);
|
||||
await installFromPage(page);
|
||||
await openFromInstalledTab(page);
|
||||
await uninstallFromPage(page);
|
||||
});
|
||||
@@ -14,44 +14,6 @@ import { daemonWsRoutePattern } from "../support/helpers/daemon-port";
|
||||
import { getServerId } from "../support/helpers/server-id";
|
||||
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
|
||||
import { waitForSettledPosition } from "../support/helpers/sheet-layout";
|
||||
import {
|
||||
backToPlugins,
|
||||
clearSearch,
|
||||
closePluginLogs,
|
||||
expectGalleryMenuWithoutSourceInstall,
|
||||
expectPluginActionPending,
|
||||
expectPluginFailed,
|
||||
expectPluginHealthy,
|
||||
expectPluginOff,
|
||||
expectPluginOn,
|
||||
expectPluginRemoved,
|
||||
expectPluginsOff,
|
||||
expectPluginsOn,
|
||||
expectPluginsRoute,
|
||||
expectSourceInstallFailed,
|
||||
expectSourceInstallTurnsPluginsOn,
|
||||
expectSourceInstalled,
|
||||
expectToast,
|
||||
expectUpdateAvailable,
|
||||
installFromSource,
|
||||
openPluginLogs,
|
||||
openPluginPage,
|
||||
openPluginPageActions,
|
||||
openSourceInstall,
|
||||
pluginRow,
|
||||
reloadPluginFromPage,
|
||||
removePluginFromPage,
|
||||
searchInstalled,
|
||||
selectInstalledTab,
|
||||
selectPluginPageAction,
|
||||
submitSourceInstall,
|
||||
turnOffPluginsFromMenu,
|
||||
turnOnPluginsFromAlert,
|
||||
turnOnPluginsFromMenu,
|
||||
turnPluginOff,
|
||||
turnPluginOn,
|
||||
updatePlugin,
|
||||
} from "../support/helpers/plugin-gallery";
|
||||
import {
|
||||
expectSettingsHeader,
|
||||
openCompactSettings,
|
||||
@@ -208,12 +170,22 @@ async function openCompactPluginSettings(page: Page): Promise<void> {
|
||||
const serverId = getServerId();
|
||||
await openCompactSettings(page, buildOpenProjectRoute());
|
||||
await openHostSection(page, serverId, "plugins");
|
||||
await expect(page.getByRole("button", { name: /^Installed/ })).toBeVisible();
|
||||
await expect(page.getByRole("textbox", { name: "Plugin source", exact: true })).toBeVisible();
|
||||
}
|
||||
|
||||
async function openPluginPageFromSettings(page: Page, name: string): Promise<void> {
|
||||
await openPluginSettings(page);
|
||||
await openPluginPage(page, name);
|
||||
async function reloadPlugin(page: Page): Promise<void> {
|
||||
await selectPluginAction(page, "e2e-plugin", "Reload");
|
||||
await expect(page.getByText("Reloaded e2e-plugin", { exact: true })).toBeVisible();
|
||||
}
|
||||
|
||||
async function openPluginActions(page: Page, pluginId: string): Promise<void> {
|
||||
await page.getByRole("button", { name: `Actions for ${pluginId}`, exact: true }).click();
|
||||
await expect(page.getByRole("menuitem").first()).toBeVisible();
|
||||
}
|
||||
|
||||
async function selectPluginAction(page: Page, pluginId: string, action: string): Promise<void> {
|
||||
await openPluginActions(page, pluginId);
|
||||
await page.getByRole("menuitem", { name: action, exact: true }).click();
|
||||
}
|
||||
|
||||
async function expectContributionBody(page: Page, expectedBody: string): Promise<void> {
|
||||
@@ -266,6 +238,11 @@ async function capturePluginInstallForm(
|
||||
});
|
||||
}
|
||||
|
||||
async function installPlugin(page: Page, source: string): Promise<void> {
|
||||
await page.getByLabel("Plugin source").fill(source);
|
||||
await page.getByRole("button", { name: "Install plugin" }).click();
|
||||
}
|
||||
|
||||
async function expectPluginSourceDocsOpen(page: Page): Promise<void> {
|
||||
const requestedPage = page
|
||||
.context()
|
||||
@@ -289,17 +266,6 @@ async function expectPluginSourceDocsOpen(page: Page): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
function commitAll(repository: string, message: string): void {
|
||||
execFileSync("git", ["add", "-A"], { cwd: repository, stdio: "ignore" });
|
||||
execFileSync("git", ["commit", "-m", message], { cwd: repository, stdio: "ignore" });
|
||||
}
|
||||
|
||||
/** A new commit on the remote is an update for a plugin installed from that Git repository. */
|
||||
async function publishGitPluginChange(repository: string, title: string): Promise<void> {
|
||||
await writeFile(path.join(repository, "index.client.tsx"), pluginSource(title));
|
||||
commitAll(repository, title);
|
||||
}
|
||||
|
||||
async function createGitPluginRepository(root: string): Promise<string> {
|
||||
const repository = path.join(root, "repository");
|
||||
await mkdir(repository);
|
||||
@@ -393,12 +359,14 @@ async function createGatedBuildRepository(
|
||||
}
|
||||
|
||||
async function installFailedPlugin(
|
||||
page: Page,
|
||||
client: Awaited<ReturnType<typeof connectNewWorkspaceDaemonClient>>,
|
||||
directory: string,
|
||||
): Promise<void> {
|
||||
await client.installPluginSource({ source: directory });
|
||||
await writeFile(path.join(directory, "index.client.tsx"), "export default broken !!!");
|
||||
await client.reloadPlugin("failed-preview-plugin");
|
||||
await expect(page.getByLabel("failed-preview-plugin failed")).toBeVisible();
|
||||
}
|
||||
|
||||
test("installs, reloads, recovers, disables, and removes a trusted local plugin", async ({
|
||||
@@ -410,15 +378,12 @@ test("installs, reloads, recovers, disables, and removes a trusted local plugin"
|
||||
await toggleRemoveAndReinstallLocalPlugin(page, directory);
|
||||
});
|
||||
|
||||
test("installs a Git source after a failed source remains editable, then updates it", async ({
|
||||
test("installs a Git source after a failed source remains editable", async ({
|
||||
page,
|
||||
pluginEnvironment,
|
||||
}, testInfo) => {
|
||||
const source = await prepareCompactGitInstall(page, pluginEnvironment);
|
||||
await retryGitInstallAndInspectRows(page, source, testInfo);
|
||||
await updateGitPlugin(page, source.repository);
|
||||
await expectCompactPluginMenuFits(page, testInfo);
|
||||
await failUpdateFromPluginPage(page, source.repository);
|
||||
});
|
||||
|
||||
for (const sourceSupport of [undefined, false]) {
|
||||
@@ -435,7 +400,7 @@ for (const viewport of [
|
||||
{ width: 1280, height: 900 },
|
||||
{ width: 390, height: 844 },
|
||||
]) {
|
||||
test(`installs an npm source and manages it at ${viewport.width}px`, async ({
|
||||
test(`installs an npm source and manages its row at ${viewport.width}px`, async ({
|
||||
page,
|
||||
pluginEnvironment,
|
||||
}, testInfo) => {
|
||||
@@ -450,19 +415,18 @@ async function openNpmPluginSettings(page: Page, width: number) {
|
||||
else await openPluginSettings(page);
|
||||
}
|
||||
|
||||
/** The row's description reads before where the plugin was installed from. */
|
||||
async function expectSourceHierarchy(
|
||||
page: Page,
|
||||
pluginId: string,
|
||||
description: string,
|
||||
source: string,
|
||||
) {
|
||||
const row = pluginRow(page, pluginId);
|
||||
await expect(row.getByText(description, { exact: true })).toHaveCSS(
|
||||
"color",
|
||||
"rgb(113, 113, 122)",
|
||||
async function expectSourceHierarchy(page: Page, description: string, source: string) {
|
||||
const descriptionText = page.getByText(description, { exact: false });
|
||||
const sourceText = page.getByText(source, { exact: false });
|
||||
const descriptionSize = await descriptionText.evaluate((element) =>
|
||||
Number.parseFloat(getComputedStyle(element).fontSize),
|
||||
);
|
||||
await expect(row.getByText(source, { exact: true })).toHaveCSS("color", "rgb(161, 161, 170)");
|
||||
const sourceSize = await sourceText.evaluate((element) =>
|
||||
Number.parseFloat(getComputedStyle(element).fontSize),
|
||||
);
|
||||
expect(sourceSize).toBeLessThan(descriptionSize);
|
||||
await expect(sourceText).toHaveCSS("color", "rgb(161, 161, 170)");
|
||||
await expect(descriptionText).toHaveCSS("color", "rgb(113, 113, 122)");
|
||||
}
|
||||
|
||||
async function installLocalPluginWithStatusExamples(
|
||||
@@ -493,51 +457,36 @@ async function installLocalPluginWithStatusExamples(
|
||||
}),
|
||||
);
|
||||
await writeFile(path.join(directory, "index.client.tsx"), pluginSource("Plugin v1"));
|
||||
await client.patchDaemonConfig({ pluginsEnabled: true });
|
||||
await client.installPluginSource({ source: disabledDirectory });
|
||||
await client.disablePlugin("disabled-preview-plugin-with-a-long-name");
|
||||
await installFailedPlugin(client, failedDirectory);
|
||||
|
||||
const catalog = observePluginCatalog(page);
|
||||
await gotoAppShell(page);
|
||||
await openPluginSettings(page);
|
||||
await catalog.waitForInitialFetch();
|
||||
await expectPluginFailed(page, "failed-preview-plugin");
|
||||
|
||||
// Plugins off on the host: the Installed tab says so and turns them back on.
|
||||
await client.patchDaemonConfig({ pluginsEnabled: false });
|
||||
await expectPluginsOff(page);
|
||||
await turnOnPluginsFromAlert(page);
|
||||
await turnOffPluginsFromMenu(page);
|
||||
await turnOnPluginsFromMenu(page);
|
||||
|
||||
await openSourceInstall(page);
|
||||
await expect(page.getByRole("textbox", { name: "Plugin installation ID" })).toHaveCount(0);
|
||||
await expectPluginSourceDocsOpen(page);
|
||||
await submitSourceInstall(page, directory);
|
||||
await expectSourceInstalled(page, "e2e-plugin");
|
||||
await expectPluginOn(page, "e2e-plugin");
|
||||
await expectPluginHealthy(page, "e2e-plugin");
|
||||
await client.patchDaemonConfig({ pluginsEnabled: false });
|
||||
await page.getByRole("switch", { name: "Enable plugins" }).click();
|
||||
await expect(page.getByText("Plugins enabled", { exact: true })).toBeVisible();
|
||||
await client.installPluginSource({ source: disabledDirectory });
|
||||
await client.disablePlugin("disabled-preview-plugin-with-a-long-name");
|
||||
await installFailedPlugin(page, client, failedDirectory);
|
||||
await page.getByLabel("Plugin source").fill(directory);
|
||||
await page.getByRole("button", { name: "Install plugin" }).click();
|
||||
await expect(page.getByText("Installed e2e-plugin", { exact: true })).toBeVisible();
|
||||
await expect(page.getByLabel("e2e-plugin running")).toBeVisible();
|
||||
await expect(page.getByText("Exercises the complete local plugin lifecycle")).toBeVisible();
|
||||
await expect(
|
||||
page.getByText("Keeps optional previews off until this plugin is enabled"),
|
||||
).toBeVisible();
|
||||
await expect(page.getByText("Demonstrates a plugin that needs attention")).toBeVisible();
|
||||
await expectPluginOff(page, "disabled-preview-plugin-with-a-long-name");
|
||||
await expectPluginFailed(page, "failed-preview-plugin");
|
||||
|
||||
await searchInstalled(page, "needs attention");
|
||||
await expect(pluginRow(page, "failed-preview-plugin")).toBeVisible();
|
||||
await expect(pluginRow(page, "e2e-plugin")).toHaveCount(0);
|
||||
await clearSearch(page);
|
||||
await expect(pluginRow(page, "e2e-plugin")).toBeVisible();
|
||||
await expect(page.getByLabel("disabled-preview-plugin-with-a-long-name disabled")).toBeVisible();
|
||||
await expect(page.getByLabel("failed-preview-plugin failed")).toBeVisible();
|
||||
await capturePluginInstallForm(page, testInfo, "wide");
|
||||
|
||||
await openPluginPage(page, "e2e-plugin");
|
||||
await openPluginPageActions(page, "e2e-plugin");
|
||||
await openPluginActions(page, "e2e-plugin");
|
||||
await capturePluginInstallForm(page, testInfo, "wide-menu");
|
||||
await page.keyboard.press("Escape");
|
||||
await openPluginLogs(page, "e2e-plugin");
|
||||
await closePluginLogs(page);
|
||||
await page.getByRole("menuitem", { name: "Logs", exact: true }).click();
|
||||
await expect(page.getByRole("dialog")).toContainText("Logs: e2e-plugin");
|
||||
await page.getByRole("button", { name: "Close", exact: true }).click();
|
||||
await openContributionFromSettings(page, "Plugin v1", "Plugin v1 cleanup 0");
|
||||
|
||||
return directory;
|
||||
@@ -548,13 +497,13 @@ async function reloadAndRecoverLocalPlugin(
|
||||
client: PluginEnvironment["client"],
|
||||
directory: string,
|
||||
) {
|
||||
await openPluginPageFromSettings(page, "e2e-plugin");
|
||||
await reloadPluginFromPage(page, "e2e-plugin");
|
||||
await openPluginSettings(page);
|
||||
await reloadPlugin(page);
|
||||
await openContributionFromSettings(page, "Plugin v1", "Plugin v1 cleanup 1");
|
||||
|
||||
await writeFile(path.join(directory, "index.client.tsx"), pluginSource("Plugin v2"));
|
||||
await openPluginPageFromSettings(page, "e2e-plugin");
|
||||
await reloadPluginFromPage(page, "e2e-plugin");
|
||||
await openPluginSettings(page);
|
||||
await reloadPlugin(page);
|
||||
await openContributionFromSettings(page, "Plugin v2", "Plugin v2 cleanup 2");
|
||||
await expect(page.getByRole("button", { name: "Plugin v1", exact: true })).not.toBeVisible();
|
||||
|
||||
@@ -562,8 +511,8 @@ async function reloadAndRecoverLocalPlugin(
|
||||
path.join(directory, "index.client.tsx"),
|
||||
pluginSource("Broken surface", "render exploded"),
|
||||
);
|
||||
await openPluginPageFromSettings(page, "e2e-plugin");
|
||||
await reloadPluginFromPage(page, "e2e-plugin");
|
||||
await openPluginSettings(page);
|
||||
await reloadPlugin(page);
|
||||
await openContributionFromSettings(page, "Broken surface", "Plugin failed: render exploded");
|
||||
await openContribution(page, "Healthy surface", "Healthy contribution");
|
||||
await openContribution(page, "Broken surface", "Plugin failed: render exploded");
|
||||
@@ -573,39 +522,39 @@ async function reloadAndRecoverLocalPlugin(
|
||||
await expect(page.getByRole("button", { name: "Broken surface", exact: true })).not.toBeVisible();
|
||||
|
||||
await writeFile(path.join(directory, "index.client.tsx"), "export default broken syntax !!!");
|
||||
await openPluginPageFromSettings(page, "e2e-plugin");
|
||||
await selectPluginPageAction(page, "e2e-plugin", "Reload");
|
||||
await expectToast(page, "Request failed");
|
||||
await backToPlugins(page, "e2e-plugin");
|
||||
await expectPluginFailed(page, "e2e-plugin");
|
||||
await openPluginSettings(page);
|
||||
await selectPluginAction(page, "e2e-plugin", "Reload");
|
||||
await expect(page.getByTestId("plugin-management-feedback")).toContainText("Request failed");
|
||||
await expect(page.getByLabel("e2e-plugin failed")).toBeVisible();
|
||||
await leavePluginSettings(page);
|
||||
await expectContributionRemoved(page, "Recovered surface");
|
||||
|
||||
await writeFile(path.join(directory, "index.client.tsx"), pluginSource("Plugin v3"));
|
||||
await openPluginPageFromSettings(page, "e2e-plugin");
|
||||
await reloadPluginFromPage(page, "e2e-plugin");
|
||||
await backToPlugins(page, "e2e-plugin");
|
||||
await expectPluginHealthy(page, "e2e-plugin");
|
||||
await openPluginSettings(page);
|
||||
await selectPluginAction(page, "e2e-plugin", "Reload");
|
||||
await expect(page.getByLabel("e2e-plugin running")).toBeVisible();
|
||||
await openContributionFromSettings(page, "Plugin v3", "Plugin v3 cleanup 5");
|
||||
}
|
||||
|
||||
async function toggleRemoveAndReinstallLocalPlugin(page: Page, directory: string) {
|
||||
await openPluginSettings(page);
|
||||
await turnPluginOff(page, "e2e-plugin");
|
||||
await page.getByRole("switch", { name: "e2e-plugin: Disable", exact: true }).click();
|
||||
await expect(page.getByLabel("e2e-plugin disabled")).toBeVisible();
|
||||
await leavePluginSettings(page);
|
||||
await expectContributionRemoved(page, "Plugin v3");
|
||||
|
||||
await openPluginSettings(page);
|
||||
await turnPluginOn(page, "e2e-plugin");
|
||||
await page.getByRole("switch", { name: "e2e-plugin: Enable", exact: true }).click();
|
||||
await expect(page.getByLabel("e2e-plugin running")).toBeVisible();
|
||||
await openContributionFromSettings(page, "Plugin v3", "Plugin v3 cleanup 6");
|
||||
|
||||
await openPluginPageFromSettings(page, "e2e-plugin");
|
||||
await removePluginFromPage(page, "e2e-plugin");
|
||||
await expectPluginsRoute(page);
|
||||
await expectPluginRemoved(page, "e2e-plugin");
|
||||
await openPluginSettings(page);
|
||||
page.once("dialog", (dialog) => dialog.accept());
|
||||
await selectPluginAction(page, "e2e-plugin", "Remove");
|
||||
await expect(page.getByTestId("plugin-row-e2e-plugin")).toHaveCount(0);
|
||||
|
||||
await installFromSource(page, directory, "e2e-plugin");
|
||||
await expectPluginOn(page, "e2e-plugin");
|
||||
await installPlugin(page, directory);
|
||||
await expect(page.getByLabel("e2e-plugin running")).toBeVisible();
|
||||
await gotoAppShell(page);
|
||||
await openContribution(page, "Plugin v3", "Plugin v3 cleanup 7");
|
||||
}
|
||||
@@ -634,8 +583,10 @@ async function prepareCompactGitInstall(page: Page, pluginEnvironment: PluginEnv
|
||||
await client.disablePlugin("compact-disabled-plugin");
|
||||
await gotoAppShell(page);
|
||||
await openCompactPluginSettings(page);
|
||||
await expect(page.getByRole("textbox", { name: "Plugin installation ID" })).toHaveCount(0);
|
||||
await client.patchDaemonConfig({ pluginsEnabled: false });
|
||||
await expectPluginsOff(page);
|
||||
await page.getByRole("switch", { name: "Enable plugins" }).click();
|
||||
await expect(page.getByText("Plugins enabled", { exact: true })).toBeVisible();
|
||||
|
||||
return { repository, missingSource };
|
||||
}
|
||||
@@ -647,58 +598,24 @@ async function retryGitInstallAndInspectRows(
|
||||
) {
|
||||
const { repository, missingSource } = source;
|
||||
|
||||
await openSourceInstall(page);
|
||||
// Plugins are off, so the confirmation says installing turns them on.
|
||||
await expectSourceInstallTurnsPluginsOn(page);
|
||||
await submitSourceInstall(page, missingSource);
|
||||
await expectSourceInstallFailed(
|
||||
page,
|
||||
missingSource,
|
||||
await installPlugin(page, missingSource);
|
||||
await expect(page.getByTestId("plugin-management-feedback")).toContainText(
|
||||
`Plugin directory does not exist: ${missingSource}`,
|
||||
);
|
||||
await expect(page.getByLabel("Plugin source")).toHaveValue(missingSource);
|
||||
await capturePluginInstallForm(page, testInfo, "compact-error");
|
||||
|
||||
await submitSourceInstall(page, pathToFileURL(repository).href);
|
||||
await expectSourceInstalled(page, "git-e2e-plugin");
|
||||
await expectPluginsOn(page);
|
||||
await expectPluginOn(page, "git-e2e-plugin");
|
||||
await installPlugin(page, pathToFileURL(repository).href);
|
||||
await expect(page.getByText("Installed git-e2e-plugin", { exact: true })).toBeVisible();
|
||||
await expect(page.getByLabel("git-e2e-plugin running")).toBeVisible();
|
||||
await expect(
|
||||
page.getByText("Shows how a realistically long plugin description wraps on a compact screen"),
|
||||
).toBeVisible();
|
||||
await expectPluginOff(page, "compact-disabled-plugin");
|
||||
await expect(page.getByLabel("compact-disabled-plugin disabled")).toBeVisible();
|
||||
await expect(page.getByLabel("Plugin source")).toHaveValue("");
|
||||
await capturePluginInstallForm(page, testInfo, "compact-success");
|
||||
}
|
||||
|
||||
async function updateGitPlugin(page: Page, repository: string) {
|
||||
await publishGitPluginChange(repository, "Git plugin v2");
|
||||
// Updates are checked when Plugins opens.
|
||||
await page.reload();
|
||||
await expectUpdateAvailable(page, "git-e2e-plugin");
|
||||
await updatePlugin(page, "git-e2e-plugin");
|
||||
await expectPluginOn(page, "git-e2e-plugin");
|
||||
}
|
||||
|
||||
/** An update that fails on the plugin's page says why there, and offers Retry. */
|
||||
async function failUpdateFromPluginPage(page: Page, repository: string) {
|
||||
await publishGitPluginChange(repository, "Git plugin v3");
|
||||
await page.reload();
|
||||
const update = page.getByTestId("plugin-update").filter({ visible: true });
|
||||
await expect(update).toHaveText("Update");
|
||||
// Rewriting the commit the page checked leaves its update pointing at a commit the remote no
|
||||
// longer serves. The next check offers the rewritten commit.
|
||||
execFileSync("git", ["commit", "--amend", "-m", "Git plugin v3, amended"], {
|
||||
cwd: repository,
|
||||
stdio: "ignore",
|
||||
});
|
||||
await update.click();
|
||||
await expect(update).toHaveText("Retry");
|
||||
await expect(page.getByText(/Git command failed/)).toBeVisible();
|
||||
}
|
||||
|
||||
async function expectCompactPluginMenuFits(page: Page, testInfo: TestInfo) {
|
||||
await openPluginPage(page, "git-e2e-plugin");
|
||||
await openPluginPageActions(page, "git-e2e-plugin");
|
||||
const removeAction = page.getByRole("menuitem", { name: "Uninstall", exact: true });
|
||||
await openPluginActions(page, "git-e2e-plugin");
|
||||
const removeAction = page.getByRole("menuitem", { name: "Remove", exact: true });
|
||||
await expect(removeAction).toBeInViewport({ ratio: 1 });
|
||||
await waitForSettledPosition(removeAction);
|
||||
await capturePluginInstallForm(page, testInfo, "compact-menu");
|
||||
@@ -731,11 +648,12 @@ async function prepareLegacyPluginHost(
|
||||
|
||||
async function verifyLegacyPluginManagement(page: Page, directory: string) {
|
||||
await expect(
|
||||
pluginRow(page, "legacy-source-plugin").getByText(directory, { exact: true }),
|
||||
page.getByText("Update this host to install plugins", { exact: true }),
|
||||
).toBeVisible();
|
||||
await expectGalleryMenuWithoutSourceInstall(page);
|
||||
await openPluginPage(page, "legacy-source-plugin");
|
||||
await reloadPluginFromPage(page, "legacy-source-plugin");
|
||||
await expect(page.getByRole("textbox", { name: "Plugin source", exact: true })).toHaveCount(0);
|
||||
await expect(page.getByText(directory, { exact: true })).toBeVisible();
|
||||
await selectPluginAction(page, "legacy-source-plugin", "Reload");
|
||||
await expect(page.getByText("Reloaded legacy-source-plugin", { exact: true })).toBeVisible();
|
||||
}
|
||||
|
||||
async function prepareNpmPluginHost(
|
||||
@@ -749,22 +667,23 @@ async function prepareNpmPluginHost(
|
||||
await client.patchDaemonConfig({ pluginsEnabled: true });
|
||||
await gotoAppShell(page);
|
||||
await openNpmPluginSettings(page, viewport.width);
|
||||
await selectInstalledTab(page);
|
||||
}
|
||||
|
||||
async function retryNpmInstallAndInspectRow(page: Page, width: number, testInfo: TestInfo) {
|
||||
await openSourceInstall(page);
|
||||
await submitSourceInstall(page, "npm:missing-plugin");
|
||||
await expectSourceInstallFailed(page, "npm:missing-plugin", "404");
|
||||
await submitSourceInstall(page, "npm:@paseo-fixture/review@^2.0.0");
|
||||
await expectSourceInstalled(page, "npm-review");
|
||||
await expectPluginOn(page, "npm-review");
|
||||
await installPlugin(page, "npm:missing-plugin");
|
||||
await expect(page.getByTestId("plugin-management-feedback")).toContainText("404");
|
||||
await expect(page.getByLabel("Plugin source")).toHaveValue("npm:missing-plugin");
|
||||
await installPlugin(page, "npm:@paseo-fixture/review@^2.0.0");
|
||||
await expect(page.getByText("Installed npm-review", { exact: true })).toBeVisible();
|
||||
await expect(page.getByLabel("npm-review running")).toBeVisible();
|
||||
await expectSourceHierarchy(
|
||||
page,
|
||||
"npm-review",
|
||||
"Installed from the npm fixture registry",
|
||||
"npm:@paseo-fixture/review · 2.0.0",
|
||||
);
|
||||
await expect(
|
||||
page.getByText("Installed from the npm fixture registry", { exact: true }),
|
||||
).toBeVisible();
|
||||
await page.screenshot({
|
||||
path: testInfo.outputPath(`npm-plugin-${width}.png`),
|
||||
animations: "disabled",
|
||||
@@ -772,11 +691,12 @@ async function retryNpmInstallAndInspectRow(page: Page, width: number, testInfo:
|
||||
}
|
||||
|
||||
async function reloadAndRemoveNpmPlugin(page: Page) {
|
||||
await openPluginPage(page, "npm-review");
|
||||
await reloadPluginFromPage(page, "npm-review");
|
||||
await removePluginFromPage(page, "npm-review");
|
||||
await expectPluginsRoute(page);
|
||||
await expectPluginRemoved(page, "npm-review");
|
||||
await selectPluginAction(page, "npm-review", "Reload");
|
||||
await expect(page.getByText("Reloaded npm-review", { exact: true })).toBeVisible();
|
||||
page.once("dialog", (dialog) => dialog.accept());
|
||||
await selectPluginAction(page, "npm-review", "Remove");
|
||||
await expect(page.getByText("Removed npm-review", { exact: true })).toBeVisible();
|
||||
await expect(page.getByLabel("npm-review running")).toHaveCount(0);
|
||||
}
|
||||
|
||||
test("renders installed-plugin descriptions as plain text", async ({ page, pluginEnvironment }) => {
|
||||
@@ -873,6 +793,19 @@ async function holdPluginLifecycleQueue(
|
||||
};
|
||||
}
|
||||
|
||||
function pluginRowActions(page: Page, pluginId: string) {
|
||||
return page.getByRole("button", { name: `Actions for ${pluginId}`, exact: true });
|
||||
}
|
||||
|
||||
async function expectPluginRowPending(page: Page, pluginId: string): Promise<void> {
|
||||
await expect(pluginRowActions(page, pluginId)).toBeDisabled();
|
||||
}
|
||||
|
||||
async function expectPluginRowSettled(page: Page, pluginId: string): Promise<void> {
|
||||
await expect(pluginRowActions(page, pluginId)).toBeEnabled();
|
||||
await expect(page.getByLabel(`${pluginId} running`)).toBeVisible();
|
||||
}
|
||||
|
||||
async function capturePluginSurface(page: Page, testInfo: TestInfo, name: string): Promise<void> {
|
||||
await page.screenshot({
|
||||
path: testInfo.outputPath(name),
|
||||
@@ -903,36 +836,39 @@ test("keeps Reload pending past a minute while the plugin queue is busy", async
|
||||
// Observe before the app loads: its daemon socket comes up with the page.
|
||||
const reload = observePluginReload(page);
|
||||
await gotoAppShell(page);
|
||||
// Plugins on is a precondition here, not the subject: set it through the daemon.
|
||||
await openPluginSettings(page);
|
||||
// Plugins on is a precondition here, not the subject: set it through the daemon instead of the
|
||||
// switch, whose transient "Plugins enabled" confirmation this scenario must not depend on.
|
||||
await client.patchDaemonConfig({ pluginsEnabled: true });
|
||||
await client.installPluginSource({ source: pluginDirectory });
|
||||
// Installed before Plugins opens, so it opens on the Installed tab.
|
||||
await openPluginSettings(page);
|
||||
await expectPluginOn(page, "e2e-plugin");
|
||||
await openPluginPage(page, "e2e-plugin");
|
||||
await expectPluginRowSettled(page, "e2e-plugin");
|
||||
|
||||
const queue = await holdPluginLifecycleQueue(client, directory);
|
||||
try {
|
||||
await selectPluginPageAction(page, "e2e-plugin", "Reload");
|
||||
await selectPluginAction(page, "e2e-plugin", "Reload");
|
||||
await reload.waitForRequest();
|
||||
// Pending: the plugin's controls stay disabled, so a second action cannot be submitted.
|
||||
await expectPluginActionPending(page, "e2e-plugin");
|
||||
// Pending: the row's actions stay disabled, so a second reload cannot be submitted.
|
||||
await expectPluginRowPending(page, "e2e-plugin");
|
||||
await capturePluginSurface(page, testInfo, "plugin-reload-pending.png");
|
||||
|
||||
await waitPastFormerReloadDeadline(page, reload.requestedAt());
|
||||
|
||||
// Past the former deadline the reload is still pending; a request timeout would have settled
|
||||
// it and released the switch.
|
||||
await expectPluginActionPending(page, "e2e-plugin");
|
||||
await expect(page.getByTestId("app-toast-message")).toHaveCount(0);
|
||||
// Past the former deadline the reload is still pending, the row shows its previous state, and
|
||||
// no timeout error reached the surface.
|
||||
await expectPluginRowPending(page, "e2e-plugin");
|
||||
await expect(page.getByLabel("e2e-plugin running")).toBeVisible();
|
||||
await expect(page.getByTestId("plugin-management-feedback")).toHaveCount(0);
|
||||
await capturePluginSurface(page, testInfo, "plugin-reload-past-deadline.png");
|
||||
|
||||
await queue.release();
|
||||
// The daemon's answer only arrives once the plugin really started again.
|
||||
// The daemon's answer only arrives once the plugin really started again; a request timeout
|
||||
// would have shown up as feedback during the wait above.
|
||||
await reload.waitForResponse();
|
||||
expect(reload.requestCount()).toBe(1);
|
||||
await expectToast(page, "Reloaded e2e-plugin");
|
||||
await expectPluginOn(page, "e2e-plugin");
|
||||
await expect(page.getByTestId("plugin-management-feedback")).toContainText(
|
||||
"Reloaded e2e-plugin",
|
||||
);
|
||||
await expectPluginRowSettled(page, "e2e-plugin");
|
||||
await capturePluginSurface(page, testInfo, "plugin-reload-completed.png");
|
||||
} finally {
|
||||
await queue.settle();
|
||||
|
||||
@@ -18,12 +18,11 @@ import {
|
||||
expectSettingsUnavailable,
|
||||
openPluginsPage,
|
||||
expectActionsMenuWithoutSettings,
|
||||
expectSettingsFollowPluginSwitch,
|
||||
expectSettingsHidden,
|
||||
expectSettingsTab,
|
||||
expectNoSettingsCogWithoutScreens,
|
||||
openTabbedSettings,
|
||||
selectSettingsTab,
|
||||
openTabbedSettingsLink,
|
||||
expectSettingsTooltip,
|
||||
expectNamedPluginRow,
|
||||
} from "../support/helpers/plugin-settings";
|
||||
|
||||
@@ -53,41 +52,35 @@ test("another client's save preserves a conflicting draft", async ({ page }) =>
|
||||
await discardTitle(page);
|
||||
});
|
||||
|
||||
test("Back to plugins returns from a plugin page", async ({ page }) => {
|
||||
test("Back to plugins returns from a plugin settings screen", async ({ page }) => {
|
||||
await openDisplaySettings(page);
|
||||
await returnToPluginsPage(page);
|
||||
});
|
||||
|
||||
test("plugin pages open from their row and show a tab per settings screen", async ({ page }) => {
|
||||
test("plugin settings open from the cog and show a tab per screen", async ({ page }) => {
|
||||
await openPluginsPage(page);
|
||||
await test.step("plugin rows show the display name", async () => {
|
||||
await expectNamedPluginRow(page);
|
||||
});
|
||||
await test.step("the row opens the plugin's page", async () => {
|
||||
await openTabbedSettings(page);
|
||||
await test.step("the cog explains itself", async () => {
|
||||
await expectSettingsTooltip(page);
|
||||
});
|
||||
await test.step("the page's menu keeps only plugin actions", async () => {
|
||||
await test.step("the actions menu keeps only plugin actions", async () => {
|
||||
await expectActionsMenuWithoutSettings(page);
|
||||
});
|
||||
await test.step("tabs switch between the plugin's settings screens", async () => {
|
||||
await openTabbedSettings(page);
|
||||
await selectSettingsTab(page, "Advanced");
|
||||
await selectSettingsTab(page, "General");
|
||||
await returnToPluginsPage(page);
|
||||
});
|
||||
await test.step("turning a plugin off removes its settings from its page", async () => {
|
||||
await expectSettingsFollowPluginSwitch(page);
|
||||
await test.step("a plugin without settings screens shows no cog", async () => {
|
||||
await expectNoSettingsCogWithoutScreens(page);
|
||||
});
|
||||
});
|
||||
|
||||
test("a settings screen link opens its tab, unavailable while the plugin is off", async ({
|
||||
page,
|
||||
settingsPlugin,
|
||||
}) => {
|
||||
test("a settings screen link opens its tab", async ({ page }) => {
|
||||
await openTabbedSettingsLink(page, "Advanced");
|
||||
await settingsPlugin.disablePlugin("settings-tabs");
|
||||
await expectSettingsUnavailable(page);
|
||||
await settingsPlugin.enablePlugin("settings-tabs");
|
||||
await expectSettingsTab(page, "Advanced");
|
||||
});
|
||||
|
||||
test.describe("compact plugin settings", () => {
|
||||
@@ -102,7 +95,7 @@ test.describe("compact plugin settings", () => {
|
||||
await hideMetadata(page);
|
||||
await returnAndReopenSettings(page);
|
||||
await settingsPlugin.disablePlugin("settings-example");
|
||||
await expectSettingsHidden(page);
|
||||
await expectSettingsUnavailable(page);
|
||||
await settingsPlugin.enablePlugin("settings-example");
|
||||
await reloadSavedDisplaySettings(page);
|
||||
});
|
||||
|
||||
@@ -153,29 +153,21 @@ async function holdStreamAfterFirstCompletedToolCall(page: Page, agentId: string
|
||||
type OverviewChatDisplay = "collapseToolCalls" | "collapseTurns";
|
||||
|
||||
// Expand thinking keeps reasoning out of tool call runs, so the first tool call starts alone.
|
||||
async function configureOverviewToolCalls(
|
||||
page: Page,
|
||||
chatDisplay: OverviewChatDisplay,
|
||||
autoExpandReasoning: boolean,
|
||||
) {
|
||||
await page.addInitScript(
|
||||
({ display, expandReasoning }) => {
|
||||
localStorage.setItem(
|
||||
"@paseo:app-settings",
|
||||
JSON.stringify({ chatDisplay: display, autoExpandReasoning: expandReasoning }),
|
||||
);
|
||||
},
|
||||
{ display: chatDisplay, expandReasoning: autoExpandReasoning },
|
||||
);
|
||||
async function configureOverviewToolCalls(page: Page, chatDisplay: OverviewChatDisplay) {
|
||||
await page.addInitScript((display) => {
|
||||
localStorage.setItem(
|
||||
"@paseo:app-settings",
|
||||
JSON.stringify({ chatDisplay: display, autoExpandReasoning: true }),
|
||||
);
|
||||
}, chatDisplay);
|
||||
}
|
||||
|
||||
async function createOverviewAgent(
|
||||
page: Page,
|
||||
title: string,
|
||||
chatDisplay: OverviewChatDisplay = "collapseToolCalls",
|
||||
autoExpandReasoning = true,
|
||||
) {
|
||||
await configureOverviewToolCalls(page, chatDisplay, autoExpandReasoning);
|
||||
await configureOverviewToolCalls(page, chatDisplay);
|
||||
return seedMockAgentWorkspace({
|
||||
repoPrefix: "tool-call-overview-sheet-",
|
||||
title,
|
||||
@@ -409,211 +401,3 @@ test("forms a closed group when the lone tool call was left closed", async ({ pa
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
const longGroupedDetail = {
|
||||
type: "unknown",
|
||||
input: Array.from({ length: 80 }, (_, i) => `Long input ${i}`),
|
||||
output: Array.from({ length: 80 }, (_, i) => `Long output ${i}`),
|
||||
};
|
||||
|
||||
function provideLongReadDetail(item: Record<string, unknown> | undefined) {
|
||||
if (item?.type === "tool_call" && item.name === "read") item.detail = longGroupedDetail;
|
||||
}
|
||||
|
||||
function provideLongReasoningDetail(item: Record<string, unknown> | undefined) {
|
||||
if (item?.type === "reasoning") {
|
||||
item.text = Array.from({ length: 80 }, (_, i) => `Long reasoning ${i}`).join("\n");
|
||||
}
|
||||
}
|
||||
|
||||
async function provideLongToolDetails(page: Page, transformItem = provideLongReadDetail) {
|
||||
await page.routeWebSocket(daemonWsRoutePattern(), (ws) => {
|
||||
const server = ws.connectToServer();
|
||||
ws.onMessage((message) => server.send(message));
|
||||
server.onMessage((message) => {
|
||||
const raw = typeof message === "string" ? message : message.toString("utf8");
|
||||
const envelope = JSON.parse(raw);
|
||||
const item = envelope.message?.payload?.event?.item;
|
||||
transformItem(item);
|
||||
if (envelope.message?.type === "fetch_agent_timeline_response") {
|
||||
for (const entry of envelope.message.payload.entries) transformItem(entry.item);
|
||||
}
|
||||
ws.send(JSON.stringify(envelope));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function toggleAndMeasureTool(badge: Locator) {
|
||||
await badge.scrollIntoViewIfNeeded();
|
||||
await badge.evaluate((node) => {
|
||||
// Inline groups own a bounded viewport; opened turns use the chat viewport.
|
||||
const container =
|
||||
node.closest('[data-testid="tool-call-group"]') ??
|
||||
node.closest('[data-testid="agent-chat-scroll"]');
|
||||
if (!container) throw new Error("Expected a tool inside a group or chat viewport");
|
||||
const frames: { top: number; height: number; containerHeight: number }[] = [];
|
||||
(node as HTMLElement & { disclosureFrames: typeof frames }).disclosureFrames = frames;
|
||||
node.querySelector("button")!.addEventListener(
|
||||
"click",
|
||||
() => {
|
||||
const measure = () => {
|
||||
const bounds = node.getBoundingClientRect();
|
||||
frames.push({
|
||||
top: bounds.top,
|
||||
height: bounds.height,
|
||||
containerHeight: container.getBoundingClientRect().height,
|
||||
});
|
||||
if (frames.length < 20) requestAnimationFrame(measure);
|
||||
};
|
||||
requestAnimationFrame(measure);
|
||||
},
|
||||
{ once: true },
|
||||
);
|
||||
});
|
||||
await openToolDetails(badge);
|
||||
await expect
|
||||
.poll(() =>
|
||||
badge.evaluate(
|
||||
(node) => (node as HTMLElement & { disclosureFrames: unknown[] }).disclosureFrames.length,
|
||||
),
|
||||
)
|
||||
.toBe(20);
|
||||
return badge.evaluate(
|
||||
(node) =>
|
||||
(
|
||||
node as HTMLElement & {
|
||||
disclosureFrames: { top: number; height: number; containerHeight: number }[];
|
||||
}
|
||||
).disclosureFrames,
|
||||
);
|
||||
}
|
||||
|
||||
for (const display of ["collapseToolCalls", "collapseTurns"] as const) {
|
||||
test(`keeps multi-section tool details within the group (${display})`, async ({ page }) => {
|
||||
test.setTimeout(120_000);
|
||||
const agent = await createOverviewAgent(page, "Bounded grouped tool details", display);
|
||||
try {
|
||||
await provideLongToolDetails(page);
|
||||
await openOverviewAgent(page, agent);
|
||||
await agent.client.sendAgentMessage(agent.agentId, "Exercise bounded grouped details.");
|
||||
await agent.client.waitForAgentUpsert(
|
||||
agent.agentId,
|
||||
(snapshot) => snapshot.status === "idle",
|
||||
30_000,
|
||||
);
|
||||
// A fresh mount of a finished conversation starts with its disclosures closed.
|
||||
await page.reload();
|
||||
await expectComposerVisible(page);
|
||||
if (display === "collapseToolCalls") {
|
||||
await scrollChatAwayFromBottom(page, { deltaY: -10_000, minDistanceFromBottom: 1 });
|
||||
}
|
||||
const group = page.getByTestId("tool-call-group").first();
|
||||
if (display === "collapseTurns") {
|
||||
await expect(page.getByTestId("tool-call-badge")).toHaveCount(0);
|
||||
await openToolDetails(page.getByTestId("turn-summary").first());
|
||||
} else {
|
||||
await expect(group).toBeVisible();
|
||||
await expect(group.getByTestId("tool-call-badge")).toHaveCount(0);
|
||||
await openToolDetails(group);
|
||||
}
|
||||
const scope = display === "collapseTurns" ? page : group;
|
||||
const badge = scope.getByTestId("tool-call-badge").filter({ hasText: "Read" }).first();
|
||||
await expect(badge).toBeVisible();
|
||||
const expandedFrames = await toggleAndMeasureTool(badge);
|
||||
for (const frame of expandedFrames)
|
||||
expect(frame.height).toBeLessThanOrEqual(frame.containerHeight);
|
||||
expect(
|
||||
Math.max(...expandedFrames.map((frame) => frame.top)) -
|
||||
Math.min(...expandedFrames.map((frame) => frame.top)),
|
||||
).toBeLessThanOrEqual(1);
|
||||
await expect(badge).toContainText("Long output");
|
||||
const collapsedFrames = await toggleAndMeasureTool(badge);
|
||||
expect(
|
||||
Math.max(...collapsedFrames.map((frame) => frame.top)) -
|
||||
Math.min(...collapsedFrames.map((frame) => frame.top)),
|
||||
).toBeLessThanOrEqual(1);
|
||||
await expect(badge).not.toContainText("Long output");
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
test("keeps tool headers reachable in an overflowing group", async ({ page }) => {
|
||||
test.setTimeout(120_000);
|
||||
const agent = await createOverviewAgent(page, "Overflowing overview tool group");
|
||||
try {
|
||||
const gate = await holdStreamAfterFirstCompletedToolCall(page, agent.agentId);
|
||||
await openOverviewAgent(page, agent);
|
||||
await agent.client.sendAgentMessage(agent.agentId, "Inspect a large tool group.");
|
||||
await gate.waitForFirstCompleted();
|
||||
gate.appendCompletedCalls(15);
|
||||
const group = page.getByTestId("tool-call-group").first();
|
||||
await openToolDetails(group);
|
||||
const badges = group.getByTestId("tool-call-badge");
|
||||
await expect(badges).toHaveCount(16);
|
||||
await expect.poll(() => group.evaluate(hasScrolledToLatest)).toBe(true);
|
||||
const first = badges.first();
|
||||
for (const action of ["expand", "collapse"]) {
|
||||
await test.step(`${action} the first tool without moving its header`, async () => {
|
||||
await first.scrollIntoViewIfNeeded();
|
||||
const headerTop = await topOf(first);
|
||||
const frames = await toggleAndMeasureTool(first);
|
||||
for (const frame of frames) expect(Math.abs(frame.top - headerTop)).toBeLessThanOrEqual(1);
|
||||
});
|
||||
}
|
||||
await test.step("follow the next appended tool", async () => {
|
||||
gate.appendCompletedCalls(1);
|
||||
await expect(badges).toHaveCount(17);
|
||||
await expect.poll(() => group.evaluate(hasScrolledToLatest)).toBe(true);
|
||||
});
|
||||
await test.step("reopen the group at its latest tool", async () => {
|
||||
await openToolDetails(group);
|
||||
await expect(badges).toHaveCount(0);
|
||||
await openToolDetails(group);
|
||||
await expect(badges).toHaveCount(17);
|
||||
await expect.poll(() => group.evaluate(hasScrolledToLatest)).toBe(true);
|
||||
});
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("keeps expanded reasoning within the group viewport", async ({ page }) => {
|
||||
test.setTimeout(120_000);
|
||||
const agent = await createOverviewAgent(
|
||||
page,
|
||||
"Bounded grouped reasoning",
|
||||
"collapseToolCalls",
|
||||
false,
|
||||
);
|
||||
try {
|
||||
// Seed before opening so the fixture transforms complete snapshots, not token deltas.
|
||||
await agent.client.sendAgentMessage(agent.agentId, "Inspect grouped reasoning.");
|
||||
await agent.client.waitForAgentUpsert(
|
||||
agent.agentId,
|
||||
(snapshot) => snapshot.status === "idle",
|
||||
30_000,
|
||||
);
|
||||
await provideLongToolDetails(page, provideLongReasoningDetail);
|
||||
await openOverviewAgent(page, agent);
|
||||
await scrollChatAwayFromBottom(page, { deltaY: -10_000, minDistanceFromBottom: 1 });
|
||||
const group = page.getByTestId("tool-call-group").first();
|
||||
await openToolDetails(group);
|
||||
const thought = group.getByTestId("tool-call-badge").filter({ hasText: "Thinking" }).first();
|
||||
const frames = await toggleAndMeasureTool(thought);
|
||||
const viewportHeight = await group.evaluate((node) => {
|
||||
const scroll = Array.from(node.querySelectorAll<HTMLElement>("*")).find((child) =>
|
||||
["auto", "scroll"].includes(getComputedStyle(child).overflowY),
|
||||
);
|
||||
if (!scroll) throw new Error("Expected the group's scroll viewport");
|
||||
return scroll.getBoundingClientRect().height;
|
||||
});
|
||||
for (const frame of frames) expect(frame.height).toBeLessThanOrEqual(viewportHeight);
|
||||
await expect(thought).toContainText("Long reasoning 79");
|
||||
await openToolDetails(thought);
|
||||
await expect(thought).not.toContainText("Long reasoning 79");
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -37,7 +37,6 @@ import {
|
||||
pickUsageHost,
|
||||
usageModalHost,
|
||||
dragUsageCardAbove,
|
||||
recordUsageCardPositionsAfterRelease,
|
||||
expectUsageCardOrder,
|
||||
expectUsageOptionsFitContent,
|
||||
setUsageCardOn,
|
||||
@@ -255,15 +254,9 @@ test.describe("usage modal", () => {
|
||||
await expect(work.getByText("work", { exact: true })).toBeVisible();
|
||||
await expectPinnedUsage(page, ["31% Weekly", "20% Weekly"]);
|
||||
|
||||
const stopRecording = await recordUsageCardPositionsAfterRelease(page);
|
||||
await dragUsageCardAbove(page, "beta:home", "alpha:a");
|
||||
await expectUsageCardOrder(page, ["beta:home", "alpha:a", "beta:work"]);
|
||||
await expectPinnedUsage(page, ["20% Weekly", "31% Weekly"]);
|
||||
// The cards are in their new slots from the first frame after the drop.
|
||||
const framesAfterDrop = await stopRecording();
|
||||
const settled = framesAfterDrop.at(-1);
|
||||
expect(settled).toBeDefined();
|
||||
expect(framesAfterDrop.filter((frame) => frame !== settled)).toEqual([]);
|
||||
|
||||
await page.reload();
|
||||
await expectPinnedUsage(page, ["20% Weekly", "31% Weekly"]);
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
context platform=ios timeout=60000 retries=0
|
||||
# Start in an empty, connected composer with the Claude provider selected.
|
||||
# COMMAND_ROW must name an inserting command, not an immediate client action.
|
||||
env COMMAND_ROW="/advisor, Let Claude consult a stronger model at key moments"
|
||||
env COMMAND_TEXT="/advisor "
|
||||
open sh.paseo.debug
|
||||
wait "editable=true" 60000
|
||||
fill "editable=true" "/"
|
||||
wait "label=\"${COMMAND_ROW}\"" 15000
|
||||
press "label=\"${COMMAND_ROW}\""
|
||||
# Do not type or move the caret: replacement itself must close autocomplete.
|
||||
wait absent "label=\"${COMMAND_ROW}\"" 3000
|
||||
wait "editable=true value=\"${COMMAND_TEXT}\"" 3000
|
||||
@@ -1,28 +0,0 @@
|
||||
# Inline tool detail scrolling on iPad
|
||||
|
||||
Use a task-owned iPad Pro 11-inch (M5) simulator in portrait (834×1210 points),
|
||||
with the development bundle already loaded and a connected isolated mock host.
|
||||
Set Chat display to Collapse turns. Prepare a finished turn containing a tool
|
||||
named `scroll_probe`, with unknown detail: `input` is 80 newline-separated
|
||||
`input-line-N` lines (N=0…79), and `output` is `SCROLL_REACHED_OUTPUT`.
|
||||
|
||||
Expand the turn, scroll chat to its start, and expand Scroll probe. The tool's
|
||||
header must be at y=613…644 and its 400-point body below it. The fixed pan path
|
||||
starts inside that body and stays inside it. Output starts below the cap.
|
||||
These are replay preconditions, not asserted pixel sizes. Close other expanded
|
||||
tools so the Scroll probe selector identifies this disclosure.
|
||||
|
||||
Replay `native-inline-tool-scroll.ios.yaml --maestro` on that explicit simulator
|
||||
through the existing mobile runner or agent-device. In Expo's development menu,
|
||||
turn off Tools button, then dismiss the known notification entitlement toast
|
||||
with its bottom-right close button. Their transparent accessibility windows
|
||||
otherwise mark app text covered. Another overlay must fail the visibility
|
||||
assertions. Pass `--platform ios` and the prepared session's `--state-dir` when
|
||||
replaying in that session.
|
||||
|
||||
The flow first asserts Input is visible and the output marker is not. After
|
||||
panning it requires Output and its marker to be visible, then requires closing
|
||||
the tool to hide its contents and reopening it to show Input again. Presence in
|
||||
the accessibility tree is insufficient. A negative control with the passive
|
||||
wrapper retained and only the detail's scrolling disabled must fail at Output
|
||||
visibility. The browser disclosure suite checks tab navigation.
|
||||
@@ -1,28 +0,0 @@
|
||||
appId: sh.paseo.debug
|
||||
---
|
||||
- assertVisible:
|
||||
id: workspace-tabs-scroll
|
||||
- assertVisible: Scroll probe
|
||||
- assertVisible: Input
|
||||
- assertNotVisible: SCROLL_REACHED_OUTPUT
|
||||
- repeat:
|
||||
times: 7
|
||||
commands:
|
||||
- swipe:
|
||||
start: "600,850"
|
||||
end: "600,670"
|
||||
duration: 600
|
||||
- swipe:
|
||||
start: "600,850"
|
||||
end: "600,700"
|
||||
duration: 600
|
||||
- assertVisible: Output
|
||||
- assertVisible: SCROLL_REACHED_OUTPUT
|
||||
- tapOn:
|
||||
point: "600,628"
|
||||
- assertNotVisible: Output
|
||||
- assertNotVisible: Input
|
||||
- tapOn:
|
||||
point: "600,628"
|
||||
- assertVisible: Input
|
||||
- stopApp
|
||||
@@ -111,13 +111,11 @@ try {
|
||||
"android",
|
||||
"--no-test-ime",
|
||||
);
|
||||
// The source field lives in the Install from source sheet, behind the page's menu.
|
||||
ad("wait", 'label="More plugin actions"', "5000");
|
||||
ad("press", 'label="More plugin actions"');
|
||||
ad("wait", 'text="Install from source"', "5000");
|
||||
ad("press", 'text="Install from source"');
|
||||
ad("wait", 'id="plugin-source-input"', "5000");
|
||||
ad("press", 'id="plugin-source-input"');
|
||||
ad("wait", "text", "Plugin source", "5000");
|
||||
const plugins = JSON.parse(ad("snapshot", "-i", "--json"));
|
||||
const source = plugins.data.nodes.find((node) => node.type === "android.widget.EditText");
|
||||
assert(source, "The connected host must support installing plugins from source");
|
||||
ad("press", `@${source.ref}`);
|
||||
ad("type", "qa-source");
|
||||
const pluginMeasurement = await waitForFocusedInput();
|
||||
// A FormTextInput draws its border and padding on the native input's parent.
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
# Android Usage drop regressions
|
||||
|
||||
Use a device you own and fixed reports from an isolated daemon. Keep recordings in `.artifacts/`. Do not upload recordings containing account details.
|
||||
|
||||
## Same-slot drop
|
||||
|
||||
Open Usage with two cards that fit without scrolling. Run:
|
||||
|
||||
```sh
|
||||
ANDROID_SERIAL=emulator-5580 node packages/app/e2e/mobile/usage-drag/android.mjs
|
||||
```
|
||||
|
||||
Set `PASEO_DEVICE_SESSION` to reuse your Agent Device session. The test holds the first handle, moves within its slot, drops it, then swipes the sheet body. It asserts sheet movement while the finger is still down: after release, the sheet can snap back to its starting position.
|
||||
|
||||
## Old-order frame
|
||||
|
||||
Record a drop with Android `screenrecord`. Include the original order, the held arrangement, the release, and at least five seconds after release. Take a reference screenshot before recording. Use fixed labels that stay visible throughout the drop.
|
||||
|
||||
Create a JSON map of label names to screenshot rectangles `[x, y, width, height]`, in physical pixels. Crop each label tightly, without changing text or the pointer. Install `opencv-python-headless` in a local virtual environment under `.artifacts/`, then run:
|
||||
|
||||
```sh
|
||||
.artifacts/frames-venv/bin/python packages/app/e2e/mobile/usage-drag/frames.py \
|
||||
--reference .artifacts/before.png --labels .artifacts/labels.json \
|
||||
.artifacts/drop-up.mp4 .artifacts/drop-down.mp4
|
||||
```
|
||||
|
||||
The check requires recognized labels in the first and last frames and a changed final order. After every label first reaches its final slot, it fails on any frame showing all original slots again. It prints the offending frame numbers for each recording. This exercises the Android compositor; a JavaScript render test cannot establish which intermediate commit reached the screen.
|
||||
@@ -1,71 +0,0 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { mkdirSync, writeFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import { setTimeout } from "node:timers/promises";
|
||||
|
||||
// Open Usage with a fixture whose cards fit without scrolling before running.
|
||||
// A same-slot drop must release the list's recognizer so a body swipe moves the sheet.
|
||||
const serial = process.env.ANDROID_SERIAL;
|
||||
assert.ok(serial, "Set ANDROID_SERIAL to the device owned by this test");
|
||||
const session = process.env.PASEO_DEVICE_SESSION ?? "usage-drag-regression";
|
||||
const artifacts = resolve(".artifacts/usage-drag-regression");
|
||||
mkdirSync(artifacts, { recursive: true });
|
||||
function ad(...args) {
|
||||
return execFileSync(
|
||||
"agent-device",
|
||||
[...args, "--platform", "android", "--serial", serial, "--session", session],
|
||||
{ encoding: "utf8", timeout: 30_000 },
|
||||
);
|
||||
}
|
||||
function adb(...args) {
|
||||
return execFileSync("adb", ["-s", serial, ...args], { timeout: 30_000 });
|
||||
}
|
||||
function snapshot() {
|
||||
return JSON.parse(ad("snapshot", "--json")).data.nodes;
|
||||
}
|
||||
function touch(kind, x, y) {
|
||||
adb("shell", "input", "motionevent", kind, String(Math.round(x)), String(Math.round(y)));
|
||||
}
|
||||
try {
|
||||
ad("open", process.env.PASEO_MOBILE_APP_ID ?? "sh.paseo.debug");
|
||||
const nodes = snapshot();
|
||||
writeFileSync(resolve(artifacts, "before.json"), JSON.stringify(nodes));
|
||||
const handle = nodes.find((node) => node.identifier === "usage-card-drag-handle");
|
||||
const list = nodes.find((node) => node.identifier === "usage-list");
|
||||
assert.ok(handle?.rect && list?.rect, "Open Usage with a visible card handle");
|
||||
const x = handle.rect.x + handle.rect.width / 2;
|
||||
const y = handle.rect.y + handle.rect.height / 2;
|
||||
touch("DOWN", x, y);
|
||||
await setTimeout(600);
|
||||
touch("MOVE", x, y + 60);
|
||||
await setTimeout(200);
|
||||
touch("MOVE", x, y + 90);
|
||||
touch("MOVE", x, y + 60);
|
||||
ad("screenshot", resolve(artifacts, "dragging.png"));
|
||||
touch("UP", x, y + 60);
|
||||
await setTimeout(2000);
|
||||
ad("screenshot", resolve(artifacts, "dropped.png"));
|
||||
const swipeX = list.rect.x + list.rect.width / 2;
|
||||
touch("DOWN", swipeX, y + 80);
|
||||
for (let offset = 90; offset <= 500; offset += 10) {
|
||||
touch("MOVE", swipeX, y + offset);
|
||||
}
|
||||
const during = snapshot();
|
||||
writeFileSync(resolve(artifacts, "during.json"), JSON.stringify(during));
|
||||
ad("screenshot", resolve(artifacts, "during.png"));
|
||||
touch("UP", swipeX, y + 500);
|
||||
await setTimeout(1500);
|
||||
const after = snapshot();
|
||||
writeFileSync(resolve(artifacts, "after.json"), JSON.stringify(after));
|
||||
ad("screenshot", resolve(artifacts, "after.png"));
|
||||
const beforeSheet = nodes.find((node) => node.label === "Bottom sheet handle");
|
||||
const afterSheet = during.find((node) => node.label === "Bottom sheet handle");
|
||||
assert.ok(beforeSheet?.rect, "Usage must start as a sheet");
|
||||
assert.ok(
|
||||
!afterSheet || afterSheet.rect.y > beforeSheet.rect.y + 50,
|
||||
"A body swipe after a same-slot drop must move the sheet",
|
||||
);
|
||||
} finally {
|
||||
ad("close");
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
"""Check native drop recordings against visible row labels (requires opencv-python-headless).
|
||||
|
||||
Supply a before screenshot and a JSON map of label names to [x, y, width, height].
|
||||
A recording must start in the original order and end in a different order. Once
|
||||
all labels reach their final slots, any frame returning to the original slots fails.
|
||||
Keep the pointer clear of the labels and use fixed fixture data.
|
||||
"""
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import cv2
|
||||
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--reference", required=True)
|
||||
parser.add_argument("--labels", required=True)
|
||||
parser.add_argument("--top", type=int, default=0)
|
||||
parser.add_argument("--bottom", type=int)
|
||||
parser.add_argument("videos", nargs="+")
|
||||
args = parser.parse_args()
|
||||
reference = cv2.imread(args.reference, cv2.IMREAD_GRAYSCALE)
|
||||
assert reference is not None, "Cannot read reference image"
|
||||
labels = json.loads(Path(args.labels).read_text())
|
||||
results = []
|
||||
for video in args.videos:
|
||||
capture = cv2.VideoCapture(video)
|
||||
frames = []
|
||||
while True:
|
||||
ok, image = capture.read()
|
||||
if not ok:
|
||||
break
|
||||
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
||||
positions = {}
|
||||
for label, (x, y, width, height) in labels.items():
|
||||
template = reference[y:y + height, x:x + width]
|
||||
matches = cv2.matchTemplate(gray[args.top:args.bottom, x:x + width], template, cv2.TM_CCOEFF_NORMED)
|
||||
_, confidence, _, point = cv2.minMaxLoc(matches)
|
||||
positions[label] = (point[1] + args.top, confidence)
|
||||
frames.append(positions)
|
||||
capture.release()
|
||||
assert frames, f"No frames in {video}"
|
||||
initial, final = frames[0], frames[-1]
|
||||
assert all(confidence >= 0.95 for _, confidence in initial.values()), f"Unrecognized initial labels: {video}"
|
||||
assert all(confidence >= 0.95 for _, confidence in final.values()), f"Unrecognized final labels: {video}"
|
||||
assert sorted(initial, key=lambda key: initial[key][0]) != sorted(final, key=lambda key: final[key][0]), f"Drop did not reorder: {video}"
|
||||
|
||||
def matches_slots(frame, target):
|
||||
return all(confidence >= 0.95 and abs(y - target[label][0]) <= 2
|
||||
for label, (y, confidence) in frame.items())
|
||||
|
||||
reached_final = False
|
||||
wrong = []
|
||||
for number, frame in enumerate(frames, start=1):
|
||||
reached_final = reached_final or matches_slots(frame, final)
|
||||
if reached_final and matches_slots(frame, initial):
|
||||
wrong.append(number)
|
||||
results.append({"recording": video, "oldOrderFrames": wrong, "count": len(wrong)})
|
||||
print(json.dumps(results, indent=2))
|
||||
raise SystemExit(1 if any(result["count"] for result in results) else 0)
|
||||
@@ -96,7 +96,7 @@ export async function listTerminalIds(daemon: IsolatedHostDaemon): Promise<strin
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
|
||||
async function psField(pid: number, field: "stat" | "lstart" | "comm"): Promise<string> {
|
||||
async function psField(pid: number, field: "stat" | "lstart"): Promise<string> {
|
||||
const { stdout } = await execFileAsync("ps", ["-o", `${field}=`, "-p", String(pid)], {
|
||||
env: { ...process.env, LC_ALL: "C" },
|
||||
});
|
||||
@@ -117,22 +117,17 @@ export interface UnclosableTerminalProgram {
|
||||
export async function plantUnclosableTerminalProgram(
|
||||
daemon: IsolatedHostDaemon,
|
||||
): Promise<UnclosableTerminalProgram> {
|
||||
// The shell reaps any child that has exited whenever it finishes a builtin, so the program
|
||||
// reads fd 3 until we close it, which happens only once the shell has become `sleep`.
|
||||
const parent = spawn("/bin/sh", ["-c", "cat <&3 >/dev/null & echo $!; exec sleep 600 3<&-"], {
|
||||
stdio: ["ignore", "pipe", "ignore", "pipe"],
|
||||
const parent = spawn("/bin/sh", ["-c", "sleep 0 & echo $!; exec sleep 600"], {
|
||||
stdio: ["ignore", "pipe", "ignore"],
|
||||
});
|
||||
parent.unref();
|
||||
const release = () => {
|
||||
parent.stdio[3]?.destroy();
|
||||
if (parent.exitCode === null && parent.signalCode === null) parent.kill("SIGKILL");
|
||||
};
|
||||
try {
|
||||
const pid = await new Promise<number>((resolve) => {
|
||||
parent.stdout!.once("data", (chunk: Buffer) => resolve(Number(chunk.toString().trim())));
|
||||
});
|
||||
await expect.poll(() => psField(parent.pid!, "comm")).toMatch(/(^|\/)sleep$/);
|
||||
parent.stdio[3]!.destroy();
|
||||
await expect.poll(async () => (await psField(pid, "stat")).startsWith("Z")).toBe(true);
|
||||
const gone = spawn(process.execPath, ["-e", ""], { stdio: "ignore" });
|
||||
await new Promise((resolve) => gone.once("exit", resolve));
|
||||
|
||||
@@ -1,205 +0,0 @@
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
||||
import { createServer } from "node:http";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { expect, test as base, type Page } from "../fixtures";
|
||||
import appPackage from "../../../package.json";
|
||||
import { gotoAppShell, openSettings } from "./app";
|
||||
import { addConnectedHostAndReload } from "./hosts";
|
||||
import { pluginRequirements } from "./plugin-fixture";
|
||||
import {
|
||||
expectToast,
|
||||
openPluginPage,
|
||||
pluginPageName,
|
||||
selectInstalledTab,
|
||||
selectPluginPageAction,
|
||||
} from "./plugin-gallery";
|
||||
import { openHostSection, selectSettingsHost } from "./settings";
|
||||
import { startHostDaemon } from "./versioned-host-daemon";
|
||||
|
||||
/**
|
||||
* Settings → Plugins → Browse against a host whose registry is a local server. The one listing
|
||||
* installs from a local Git repository, so installing needs no network.
|
||||
*/
|
||||
|
||||
export const LISTING = {
|
||||
id: "acme/directory-example",
|
||||
name: "Directory example",
|
||||
description: "Adds a review checklist to every workspace",
|
||||
overview: "Directory example keeps a checklist beside your agents.",
|
||||
};
|
||||
|
||||
export const test = base.extend<{ directoryHost: { serverId: string; port: number } }>({
|
||||
directoryHost: async ({ e2eWorker }, provide) => {
|
||||
void e2eWorker;
|
||||
const root = await mkdtemp(path.join(tmpdir(), "paseo-plugin-directory-"));
|
||||
const registry = await startRegistry(await createListedPlugin(root));
|
||||
try {
|
||||
const host = await startHostDaemon({
|
||||
version: appPackage.version,
|
||||
pluginRegistryUrl: registry.url,
|
||||
});
|
||||
try {
|
||||
await provide({ serverId: host.serverId, port: host.port });
|
||||
} finally {
|
||||
await host.dispose();
|
||||
}
|
||||
} finally {
|
||||
await registry.close();
|
||||
await rm(root, { recursive: true, force: true });
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
async function createListedPlugin(root: string) {
|
||||
const repository = path.join(root, "repository");
|
||||
execFileSync("git", ["init", "-b", "main", repository], { stdio: "ignore" });
|
||||
await writeFile(
|
||||
path.join(repository, "paseo-plugin.json"),
|
||||
JSON.stringify({
|
||||
id: "directory-example",
|
||||
name: LISTING.name,
|
||||
requirements: pluginRequirements,
|
||||
}),
|
||||
);
|
||||
await writeFile(
|
||||
path.join(repository, "index.client.ts"),
|
||||
"export default function () { return () => {}; }",
|
||||
);
|
||||
const git = (...args: string[]) =>
|
||||
execFileSync(
|
||||
"git",
|
||||
["-c", "user.name=Paseo Tests", "-c", "user.email=e2e@paseo.test", ...args],
|
||||
{
|
||||
cwd: repository,
|
||||
encoding: "utf8",
|
||||
},
|
||||
).trim();
|
||||
git("add", "-A");
|
||||
git("commit", "-m", "initial");
|
||||
const date = "2026-10-03T00:00:00.000Z";
|
||||
return {
|
||||
id: LISTING.id,
|
||||
name: LISTING.name,
|
||||
description: LISTING.description,
|
||||
categories: ["tools"],
|
||||
author: { github: "acme", name: "Acme" },
|
||||
repository: { url: "https://github.com/acme/directory-example" },
|
||||
artifact: {
|
||||
kind: "git",
|
||||
remote: pathToFileURL(repository).href,
|
||||
commit: git("rev-parse", "HEAD"),
|
||||
},
|
||||
media: [],
|
||||
submittedAt: date,
|
||||
reviewedAt: date,
|
||||
updatedAt: date,
|
||||
publishedAt: date,
|
||||
installs: 1200,
|
||||
};
|
||||
}
|
||||
|
||||
async function startRegistry(listing: Record<string, unknown>) {
|
||||
const documents: Record<string, unknown> = {
|
||||
"/index.json": {
|
||||
schemaVersion: 1,
|
||||
registry: { name: "Local", url: "http://127.0.0.1" },
|
||||
categories: [{ slug: "tools", label: "Tools" }],
|
||||
plugins: [listing],
|
||||
featured: [],
|
||||
generatedAt: "2026-10-03T00:00:00.000Z",
|
||||
},
|
||||
[`/plugins/${LISTING.id}.json`]: {
|
||||
...listing,
|
||||
readme: `# ${LISTING.name}\n\n${LISTING.overview}`,
|
||||
},
|
||||
};
|
||||
const server = createServer((request, response) => {
|
||||
const document = request.url ? documents[request.url] : undefined;
|
||||
if (!document) {
|
||||
response.writeHead(404).end();
|
||||
return;
|
||||
}
|
||||
response.setHeader("Content-Type", "application/json");
|
||||
response.end(JSON.stringify(document));
|
||||
});
|
||||
await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));
|
||||
const address = server.address();
|
||||
if (!address || typeof address === "string") throw new Error("Missing registry address");
|
||||
return {
|
||||
url: `http://127.0.0.1:${address.port}`,
|
||||
close: () => new Promise<void>((resolve) => server.close(() => resolve())),
|
||||
};
|
||||
}
|
||||
|
||||
function listingRow(page: Page) {
|
||||
return page.getByTestId(`plugin-listing-${LISTING.id}`).filter({ visible: true });
|
||||
}
|
||||
|
||||
function browseTab(page: Page) {
|
||||
return page.getByRole("button", { name: "Browse", exact: true });
|
||||
}
|
||||
|
||||
/** A host with no plugins opens Plugins on Browse. */
|
||||
export async function openDirectory(page: Page, host: { serverId: string; port: number }) {
|
||||
await gotoAppShell(page);
|
||||
await addConnectedHostAndReload(page, { ...host, label: "Plugin directory" });
|
||||
await openSettings(page);
|
||||
await selectSettingsHost(page, host.serverId);
|
||||
await openHostSection(page, host.serverId, "plugins");
|
||||
await expect(browseTab(page)).toHaveAttribute("aria-selected", "true");
|
||||
await expect(listingRow(page)).toContainText(LISTING.description);
|
||||
}
|
||||
|
||||
/** Install asks first, naming the author and version, then the row offers Uninstall. */
|
||||
export async function installListingFromRow(page: Page) {
|
||||
await listingRow(page).getByTestId(`plugin-install-${LISTING.id}`).click();
|
||||
const sheet = page.getByTestId("plugin-install-sheet");
|
||||
await expect(sheet).toContainText("Acme");
|
||||
await sheet.getByTestId("plugin-install-confirm").click();
|
||||
await expect(listingRow(page).getByTestId(`plugin-uninstall-${LISTING.id}`)).toBeVisible({
|
||||
timeout: 60_000,
|
||||
});
|
||||
}
|
||||
|
||||
/** Installing the first plugin keeps the user on Browse. */
|
||||
export async function expectStillBrowsing(page: Page) {
|
||||
await expect(browseTab(page)).toHaveAttribute("aria-selected", "true");
|
||||
await expect(page.getByRole("button", { name: /^Installed · 1/ })).toBeVisible();
|
||||
}
|
||||
|
||||
export async function openListingPage(page: Page) {
|
||||
await listingRow(page).getByText(LISTING.name, { exact: true }).click();
|
||||
await expect(pluginPageName(page)).toHaveText(LISTING.name);
|
||||
await expect(page.getByText(LISTING.overview, { exact: true })).toBeVisible();
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstalling keeps the plugin's page open on its listing, back on Install, whether the page was
|
||||
* opened from Browse or from the Installed tab.
|
||||
*/
|
||||
export async function uninstallFromPage(page: Page) {
|
||||
page.once("dialog", (dialog) => dialog.accept());
|
||||
await selectPluginPageAction(page, LISTING.name, "Uninstall");
|
||||
await expectToast(page, `Uninstalled ${LISTING.name}`);
|
||||
await expect(pluginPageName(page)).toHaveText(LISTING.name);
|
||||
await expect(
|
||||
page.getByTestId(`plugin-install-${LISTING.id}`).filter({ visible: true }),
|
||||
).toBeVisible();
|
||||
}
|
||||
|
||||
export async function installFromPage(page: Page) {
|
||||
await page.getByTestId(`plugin-install-${LISTING.id}`).filter({ visible: true }).click();
|
||||
await page.getByTestId("plugin-install-confirm").click();
|
||||
await expect(
|
||||
page.getByRole("button", { name: `Actions for ${LISTING.name}`, exact: true }),
|
||||
).toBeVisible({ timeout: 60_000 });
|
||||
}
|
||||
|
||||
export async function openFromInstalledTab(page: Page) {
|
||||
await page.getByRole("button", { name: "Back to plugins", exact: true }).click();
|
||||
await selectInstalledTab(page);
|
||||
await openPluginPage(page, LISTING.name, "directory-example");
|
||||
}
|
||||
@@ -1,269 +0,0 @@
|
||||
import { buildSettingsHostSectionRoute } from "@/utils/host-routes";
|
||||
import { expect, type Page } from "../fixtures";
|
||||
import { getServerId } from "./server-id";
|
||||
import { expectAppRoute } from "./route-assertions";
|
||||
|
||||
/**
|
||||
* Settings → Host → Plugins: the Installed and Browse tabs, the page menu, the install sheet and a
|
||||
* plugin's own page. Helpers that take a plugin name expect the manifest name, which is the plugin
|
||||
* ID when the manifest has none.
|
||||
*/
|
||||
|
||||
export function pluginsRoute(serverId = getServerId()): string {
|
||||
return buildSettingsHostSectionRoute(serverId, "plugins");
|
||||
}
|
||||
|
||||
export function pluginPageRoute(pluginId: string, serverId = getServerId()): string {
|
||||
return `${pluginsRoute(serverId)}/${encodeURIComponent(pluginId)}`;
|
||||
}
|
||||
|
||||
/** Settings keeps the Plugins page mounted beneath a plugin's page, so read visible rows only. */
|
||||
export function pluginRow(page: Page, pluginId: string) {
|
||||
return page.getByTestId(`plugin-row-${pluginId}`).filter({ visible: true });
|
||||
}
|
||||
|
||||
function pluginSwitch(page: Page, name: string, action: "Disable" | "Enable") {
|
||||
return page.getByRole("switch", { name: `${name}: ${action}`, exact: true }).filter({
|
||||
visible: true,
|
||||
});
|
||||
}
|
||||
|
||||
export async function expectToast(page: Page, message: string): Promise<void> {
|
||||
await expect(page.getByTestId("app-toast-message")).toContainText(message);
|
||||
}
|
||||
|
||||
// Tabs and search
|
||||
|
||||
export async function selectInstalledTab(page: Page): Promise<void> {
|
||||
const tab = page.getByRole("button", { name: /^Installed/ });
|
||||
await tab.click();
|
||||
await expect(tab).toHaveAttribute("aria-selected", "true");
|
||||
}
|
||||
|
||||
export async function searchInstalled(page: Page, query: string): Promise<void> {
|
||||
await page.getByRole("textbox", { name: "Search installed", exact: true }).fill(query);
|
||||
}
|
||||
|
||||
export async function clearSearch(page: Page): Promise<void> {
|
||||
await page.getByRole("button", { name: "Clear search", exact: true }).click();
|
||||
await expect(page.getByRole("textbox", { name: "Search installed", exact: true })).toHaveValue(
|
||||
"",
|
||||
);
|
||||
}
|
||||
|
||||
// Installed rows
|
||||
|
||||
export async function expectPluginOn(page: Page, name: string): Promise<void> {
|
||||
await expect(pluginSwitch(page, name, "Disable")).toBeVisible();
|
||||
await expect(pluginSwitch(page, name, "Disable")).toBeEnabled();
|
||||
}
|
||||
|
||||
export async function expectPluginOff(page: Page, name: string): Promise<void> {
|
||||
await expect(pluginSwitch(page, name, "Enable")).toBeVisible();
|
||||
}
|
||||
|
||||
export async function turnPluginOff(page: Page, name: string): Promise<void> {
|
||||
await pluginSwitch(page, name, "Disable").click();
|
||||
await expectPluginOff(page, name);
|
||||
}
|
||||
|
||||
export async function turnPluginOn(page: Page, name: string): Promise<void> {
|
||||
await pluginSwitch(page, name, "Enable").click();
|
||||
await expectPluginOn(page, name);
|
||||
}
|
||||
|
||||
/** The switch stays disabled while an action on the plugin runs, so a second one cannot start. */
|
||||
export async function expectPluginActionPending(page: Page, name: string): Promise<void> {
|
||||
await expect(pluginSwitch(page, name, "Disable")).toBeDisabled();
|
||||
}
|
||||
|
||||
export async function expectPluginFailed(page: Page, pluginId: string): Promise<void> {
|
||||
await expect(pluginRow(page, pluginId).getByText("failed", { exact: true })).toBeVisible();
|
||||
}
|
||||
|
||||
export async function expectPluginHealthy(page: Page, pluginId: string): Promise<void> {
|
||||
await expect(pluginRow(page, pluginId)).toBeVisible();
|
||||
await expect(pluginRow(page, pluginId).getByText("failed", { exact: true })).toHaveCount(0);
|
||||
}
|
||||
|
||||
export async function expectPluginRemoved(page: Page, pluginId: string): Promise<void> {
|
||||
await expect(page.getByTestId(`plugin-row-${pluginId}`)).toHaveCount(0);
|
||||
}
|
||||
|
||||
// Plugins on the host
|
||||
|
||||
function pluginsOffAlert(page: Page) {
|
||||
return page.getByRole("alert").filter({ hasText: "Plugins are off on" });
|
||||
}
|
||||
|
||||
export async function expectPluginsOff(page: Page): Promise<void> {
|
||||
await expect(pluginsOffAlert(page)).toBeVisible();
|
||||
}
|
||||
|
||||
export async function expectPluginsOn(page: Page): Promise<void> {
|
||||
await expect(pluginsOffAlert(page)).toHaveCount(0);
|
||||
}
|
||||
|
||||
export async function turnOnPluginsFromAlert(page: Page): Promise<void> {
|
||||
await pluginsOffAlert(page).getByRole("button", { name: "Turn on", exact: true }).click();
|
||||
await expectPluginsOn(page);
|
||||
}
|
||||
|
||||
// The page menu
|
||||
|
||||
function galleryMenu(page: Page) {
|
||||
return page.getByRole("button", { name: "More plugin actions", exact: true }).filter({
|
||||
visible: true,
|
||||
});
|
||||
}
|
||||
|
||||
async function openGalleryMenu(page: Page): Promise<void> {
|
||||
await galleryMenu(page).click();
|
||||
await expect(page.getByRole("menuitem").first()).toBeVisible();
|
||||
}
|
||||
|
||||
export async function expectGalleryMenuWithoutSourceInstall(page: Page): Promise<void> {
|
||||
await openGalleryMenu(page);
|
||||
await expect(page.getByRole("menuitem", { name: "Turn off plugins", exact: true })).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole("menuitem", { name: "Install from source", exact: true }),
|
||||
).toHaveCount(0);
|
||||
await page.keyboard.press("Escape");
|
||||
}
|
||||
|
||||
export async function turnOffPluginsFromMenu(page: Page): Promise<void> {
|
||||
await openGalleryMenu(page);
|
||||
await page.getByRole("menuitem", { name: "Turn off plugins", exact: true }).click();
|
||||
await expectToast(page, "Plugins disabled");
|
||||
await expectPluginsOff(page);
|
||||
}
|
||||
|
||||
export async function turnOnPluginsFromMenu(page: Page): Promise<void> {
|
||||
await openGalleryMenu(page);
|
||||
await page.getByRole("menuitem", { name: "Turn on plugins", exact: true }).click();
|
||||
await expectToast(page, "Plugins enabled");
|
||||
await expectPluginsOn(page);
|
||||
}
|
||||
|
||||
// Install from source
|
||||
|
||||
function sourceField(page: Page) {
|
||||
return page.getByRole("textbox", { name: "Plugin source", exact: true });
|
||||
}
|
||||
|
||||
export async function openSourceInstall(page: Page): Promise<void> {
|
||||
await openGalleryMenu(page);
|
||||
await page.getByRole("menuitem", { name: "Install from source", exact: true }).click();
|
||||
await expect(sourceField(page)).toBeVisible();
|
||||
}
|
||||
|
||||
export async function expectSourceInstallTurnsPluginsOn(page: Page): Promise<void> {
|
||||
await expect(
|
||||
page.getByText("Plugins are not sandboxed. Installing also turns plugins on.", {
|
||||
exact: true,
|
||||
}),
|
||||
).toBeVisible();
|
||||
}
|
||||
|
||||
export async function submitSourceInstall(page: Page, source: string): Promise<void> {
|
||||
await sourceField(page).fill(source);
|
||||
await page.getByRole("button", { name: "Install", exact: true }).click();
|
||||
}
|
||||
|
||||
/** A failed install keeps the sheet open with the source, so the user can correct it. */
|
||||
export async function expectSourceInstallFailed(
|
||||
page: Page,
|
||||
source: string,
|
||||
message: string,
|
||||
): Promise<void> {
|
||||
await expect(page.getByRole("alert").filter({ hasText: message })).toBeVisible();
|
||||
await expect(sourceField(page)).toHaveValue(source);
|
||||
}
|
||||
|
||||
export async function expectSourceInstalled(page: Page, name: string): Promise<void> {
|
||||
await expectToast(page, `Installed ${name}`);
|
||||
await expect(sourceField(page)).toHaveCount(0);
|
||||
}
|
||||
|
||||
export async function installFromSource(page: Page, source: string, name: string): Promise<void> {
|
||||
await openSourceInstall(page);
|
||||
await submitSourceInstall(page, source);
|
||||
await expectSourceInstalled(page, name);
|
||||
}
|
||||
|
||||
// Updates
|
||||
|
||||
function updateRow(page: Page, pluginId: string) {
|
||||
return page.getByTestId(`plugin-update-${pluginId}`).filter({ visible: true });
|
||||
}
|
||||
|
||||
export async function updatePlugin(page: Page, pluginId: string): Promise<void> {
|
||||
await updateRow(page, pluginId).getByRole("button", { name: "Update", exact: true }).click();
|
||||
await expectToast(page, `${pluginId} updated`);
|
||||
await expect(page.getByTestId(`plugin-update-${pluginId}`)).toHaveCount(0);
|
||||
}
|
||||
|
||||
export async function expectUpdateAvailable(page: Page, pluginId: string): Promise<void> {
|
||||
await expect(updateRow(page, pluginId)).toBeVisible();
|
||||
}
|
||||
|
||||
// A plugin's page
|
||||
|
||||
export function pluginPageName(page: Page) {
|
||||
return page.getByTestId("plugin-page-name").filter({ visible: true });
|
||||
}
|
||||
|
||||
/** Opens the plugin's page from its row on the Installed tab. */
|
||||
export async function openPluginPage(page: Page, name: string, pluginId = name): Promise<void> {
|
||||
await pluginRow(page, pluginId).getByText(name, { exact: true }).click();
|
||||
await expect(pluginPageName(page)).toHaveText(name);
|
||||
}
|
||||
|
||||
export async function backToPlugins(page: Page, pluginId: string): Promise<void> {
|
||||
await page.getByRole("button", { name: "Back to plugins", exact: true }).click();
|
||||
await expect(pluginRow(page, pluginId)).toBeVisible();
|
||||
}
|
||||
|
||||
export async function openPluginPageActions(page: Page, name: string): Promise<void> {
|
||||
await page
|
||||
.getByRole("button", { name: `Actions for ${name}`, exact: true })
|
||||
.filter({ visible: true })
|
||||
.click();
|
||||
await expect(page.getByRole("menuitem").first()).toBeVisible();
|
||||
}
|
||||
|
||||
export async function selectPluginPageAction(
|
||||
page: Page,
|
||||
name: string,
|
||||
action: "Reload" | "Logs" | "Uninstall",
|
||||
): Promise<void> {
|
||||
await openPluginPageActions(page, name);
|
||||
await page.getByRole("menuitem", { name: action, exact: true }).click();
|
||||
}
|
||||
|
||||
export async function reloadPluginFromPage(page: Page, name: string): Promise<void> {
|
||||
await selectPluginPageAction(page, name, "Reload");
|
||||
await expectToast(page, `Reloaded ${name}`);
|
||||
}
|
||||
|
||||
export async function openPluginLogs(page: Page, name: string): Promise<void> {
|
||||
await selectPluginPageAction(page, name, "Logs");
|
||||
await expect(page.getByRole("dialog")).toContainText(`Logs: ${name}`);
|
||||
}
|
||||
|
||||
export async function closePluginLogs(page: Page): Promise<void> {
|
||||
await page.getByRole("button", { name: "Close", exact: true }).click();
|
||||
await expect(page.getByRole("dialog")).toHaveCount(0);
|
||||
}
|
||||
|
||||
/** Uninstall confirms first; uninstalling a plugin that is not in the directory returns to Plugins. */
|
||||
export async function removePluginFromPage(page: Page, name: string): Promise<void> {
|
||||
page.once("dialog", (dialog) => dialog.accept());
|
||||
await selectPluginPageAction(page, name, "Uninstall");
|
||||
await expectToast(page, `Uninstalled ${name}`);
|
||||
await expect(pluginPageName(page)).toHaveCount(0);
|
||||
}
|
||||
|
||||
export async function expectPluginsRoute(page: Page): Promise<void> {
|
||||
await expectAppRoute(page, pluginsRoute());
|
||||
}
|
||||
@@ -9,15 +9,6 @@ import { addConnectedHostAndReload } from "./hosts";
|
||||
import { gotoAppShell, openSettings } from "./app";
|
||||
import { openHostSection, selectSettingsHost } from "./settings";
|
||||
import { pluginRequirements } from "./plugin-fixture";
|
||||
import {
|
||||
backToPlugins,
|
||||
expectPluginFailed,
|
||||
expectPluginHealthy,
|
||||
openPluginPage,
|
||||
selectPluginPageAction,
|
||||
} from "./plugin-gallery";
|
||||
|
||||
const PLUGIN_ID = "requirements-example";
|
||||
|
||||
export const test = base.extend<{
|
||||
requirementHost: { serverId: string; port: number; directory: string; client: DaemonClient };
|
||||
@@ -89,7 +80,7 @@ export const test = base.extend<{
|
||||
async function writeRequirements(directory: string, paseo: string) {
|
||||
await writeFile(
|
||||
path.join(directory, "paseo-plugin.json"),
|
||||
JSON.stringify({ id: PLUGIN_ID, requirements: { paseo } }),
|
||||
JSON.stringify({ id: "requirements-example", requirements: { paseo } }),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -102,7 +93,7 @@ export async function openRequirementHost(page: Page, host: { serverId: string;
|
||||
}
|
||||
|
||||
export async function expectAppMismatch(page: Page) {
|
||||
await expectPluginFailed(page, PLUGIN_ID);
|
||||
await expect(page.getByLabel("requirements-example failed", { exact: true })).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(/Plugin "requirements-example" requires Paseo \^99.0.0. Your app is/),
|
||||
).toBeVisible();
|
||||
@@ -111,21 +102,18 @@ export async function expectAppMismatch(page: Page) {
|
||||
export async function correctRequirementAndReload(page: Page, directory: string) {
|
||||
await writeRequirements(directory, pluginRequirements.paseo);
|
||||
await reloadRequirementsPlugin(page);
|
||||
await backToPlugins(page, PLUGIN_ID);
|
||||
await expectPluginHealthy(page, PLUGIN_ID);
|
||||
await expect(page.getByLabel("requirements-example running", { exact: true })).toBeVisible();
|
||||
await expect(page.getByText(/Your app is/)).toHaveCount(0);
|
||||
}
|
||||
|
||||
export async function rejectDaemonMismatch(page: Page, directory: string) {
|
||||
await writeRequirements(directory, ">=100.0.0");
|
||||
await reloadRequirementsPlugin(page);
|
||||
await backToPlugins(page, PLUGIN_ID);
|
||||
await expectPluginFailed(page, PLUGIN_ID);
|
||||
await expect(page.getByLabel("requirements-example failed", { exact: true })).toBeVisible();
|
||||
await expect(page.getByText(/Your daemon is 99.0.0/).first()).toBeVisible();
|
||||
}
|
||||
|
||||
/** Reload lives on the plugin's page. */
|
||||
async function reloadRequirementsPlugin(page: Page) {
|
||||
await openPluginPage(page, PLUGIN_ID);
|
||||
await selectPluginPageAction(page, PLUGIN_ID, "Reload");
|
||||
await page.getByRole("button", { name: "Actions for requirements-example", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "Reload", exact: true }).click();
|
||||
}
|
||||
|
||||
@@ -7,18 +7,8 @@ import { gotoAppShell, openSettings } from "./app";
|
||||
import { goBackInSettings, openCompactSettings, openHostSection } from "./settings";
|
||||
import { getServerId } from "./server-id";
|
||||
import { expectAppRoute } from "./route-assertions";
|
||||
import { buildSettingsHostSectionRoute } from "@/utils/host-routes";
|
||||
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
|
||||
import {
|
||||
backToPlugins,
|
||||
openPluginPage,
|
||||
openPluginPageActions,
|
||||
pluginPageName,
|
||||
pluginPageRoute,
|
||||
pluginRow,
|
||||
pluginsRoute,
|
||||
turnPluginOff,
|
||||
turnPluginOn,
|
||||
} from "./plugin-gallery";
|
||||
|
||||
type SettingsClient = Awaited<ReturnType<typeof connectNewWorkspaceDaemonClient>>;
|
||||
|
||||
@@ -100,64 +90,68 @@ export const test = base.extend<{ settingsPlugin: SettingsClient }>({
|
||||
export async function openDisplaySettings(page: Page) {
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await openSettingsExamplePage(page);
|
||||
await openPluginScreen(page);
|
||||
}
|
||||
export async function openCompactDisplaySettings(page: Page) {
|
||||
await gotoAppShell(page);
|
||||
await openCompactSettings(page, new URL(page.url()).pathname);
|
||||
await openSettingsExamplePage(page);
|
||||
await openPluginScreen(page);
|
||||
}
|
||||
async function openSettingsExamplePage(page: Page) {
|
||||
async function openPluginScreen(page: Page) {
|
||||
await openHostSection(page, getServerId(), "plugins");
|
||||
await openPluginPage(page, "settings-example");
|
||||
await expectSettingsExampleScreen(page);
|
||||
await openSettingsFromCog(page);
|
||||
}
|
||||
/** A plugin's page shows its settings inline. With one screen there are no tabs. */
|
||||
async function expectSettingsExampleScreen(page: Page) {
|
||||
/** The cog on a plugin's row. Its label is "Settings"; the row tells plugins apart. */
|
||||
function settingsButton(page: Page, pluginId: string) {
|
||||
return page
|
||||
.getByTestId(`plugin-row-${pluginId}`)
|
||||
.filter({ visible: true })
|
||||
.getByRole("button", { name: "Settings", exact: true });
|
||||
}
|
||||
async function openSettingsFromCog(page: Page) {
|
||||
await settingsButton(page, "settings-example").click();
|
||||
await expect(page.getByRole("switch", { name: "Show metadata" })).toBeVisible();
|
||||
// A plugin with one settings screen shows no tabs, and the header names only the plugin.
|
||||
await expect(page.getByTestId("plugin-settings-tabs")).toHaveCount(0);
|
||||
await expectAppRoute(page, pluginPageRoute("settings-example"));
|
||||
await expectSettingsHeader(page, "settings-example");
|
||||
}
|
||||
export async function openPluginsPage(page: Page) {
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await openHostSection(page, getServerId(), "plugins");
|
||||
}
|
||||
/** The page's menu holds plugin actions only; its settings screens are on the page itself. */
|
||||
export async function expectActionsMenuWithoutSettings(page: Page) {
|
||||
await openPluginPageActions(page, TABBED_PLUGIN_NAME);
|
||||
await page.getByRole("button", { name: "Actions for settings-example", exact: true }).click();
|
||||
await expect(page.getByRole("menuitem", { name: "Reload", exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("menuitem", { name: "General", exact: true })).toHaveCount(0);
|
||||
await expect(page.getByRole("menuitem", { name: "Advanced", exact: true })).toHaveCount(0);
|
||||
await expect(page.getByRole("menuitem", { name: "Display", exact: true })).toHaveCount(0);
|
||||
await page.keyboard.press("Escape");
|
||||
}
|
||||
/** Turning a plugin off unloads its settings screens, so its page no longer shows them. */
|
||||
export async function expectSettingsFollowPluginSwitch(page: Page) {
|
||||
await openPluginPage(page, "settings-example");
|
||||
await turnPluginOff(page, "settings-example");
|
||||
await expectSettingsHidden(page);
|
||||
await turnPluginOn(page, "settings-example");
|
||||
await expect(page.getByRole("switch", { name: "Show metadata" })).toBeVisible();
|
||||
export async function expectNoSettingsCogWithoutScreens(page: Page) {
|
||||
await page.getByRole("switch", { name: "settings-example: Disable" }).click();
|
||||
await expect(page.getByRole("switch", { name: "settings-example: Enable" })).toBeVisible();
|
||||
await expect(settingsButton(page, "settings-example")).toHaveCount(0);
|
||||
await page.getByRole("switch", { name: "settings-example: Enable" }).click();
|
||||
await expect(settingsButton(page, "settings-example")).toBeVisible();
|
||||
}
|
||||
export async function expectSettingsHidden(page: Page) {
|
||||
await expect(page.getByRole("switch", { name: "Show metadata" })).toHaveCount(0);
|
||||
export async function expectSettingsTooltip(page: Page) {
|
||||
await settingsButton(page, "settings-example").hover();
|
||||
await expect(page.getByRole("tooltip")).toHaveText("Settings");
|
||||
await page.mouse.move(0, 0);
|
||||
}
|
||||
/** A manifest `name` titles the row and its switch, and opens the plugin's page. */
|
||||
/** A manifest `name` titles the row and its controls; the id stays visible beneath it. */
|
||||
export async function expectNamedPluginRow(page: Page) {
|
||||
const row = pluginRow(page, TABBED_PLUGIN_ID);
|
||||
const row = page.getByTestId(`plugin-row-${TABBED_PLUGIN_ID}`).filter({ visible: true });
|
||||
await expect(row.getByText(TABBED_PLUGIN_NAME, { exact: true })).toBeVisible();
|
||||
await expect(row.getByText(TABBED_PLUGIN_ID, { exact: true })).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole("switch", { name: `${TABBED_PLUGIN_NAME}: Disable`, exact: true }),
|
||||
).toBeVisible();
|
||||
await expect(row).toHaveAccessibleName(TABBED_PLUGIN_NAME);
|
||||
}
|
||||
/** The page names the plugin by its manifest name, with the ID beneath it. */
|
||||
export async function openTabbedSettings(page: Page) {
|
||||
await openPluginPage(page, TABBED_PLUGIN_NAME, TABBED_PLUGIN_ID);
|
||||
await expect(
|
||||
page.getByText(TABBED_PLUGIN_ID, { exact: true }).filter({ visible: true }),
|
||||
page.getByRole("button", { name: `Actions for ${TABBED_PLUGIN_NAME}`, exact: true }),
|
||||
).toBeVisible();
|
||||
await expectAppRoute(page, pluginPageRoute(TABBED_PLUGIN_ID));
|
||||
}
|
||||
export async function openTabbedSettings(page: Page) {
|
||||
await settingsButton(page, TABBED_PLUGIN_ID).click();
|
||||
await expectSettingsTab(page, "General");
|
||||
// The Advanced icon reads the plugin's translations; the General icon throws and is dropped.
|
||||
await expect(page.getByTestId("advanced-tab-icon")).toBeVisible();
|
||||
@@ -165,25 +159,27 @@ export async function openTabbedSettings(page: Page) {
|
||||
function settingsTab(page: Page, title: string) {
|
||||
return page.getByTestId("plugin-settings-tabs").getByRole("button", { name: title, exact: true });
|
||||
}
|
||||
/** Tabs swap the screen in place on the plugin's page, so Back still returns to Plugins. */
|
||||
export async function selectSettingsTab(page: Page, title: "General" | "Advanced") {
|
||||
await settingsTab(page, title).click();
|
||||
await expectSettingsTab(page, title);
|
||||
await expectAppRoute(
|
||||
page,
|
||||
`${pluginPageRoute(TABBED_PLUGIN_ID)}?screenId=${title.toLowerCase()}`,
|
||||
);
|
||||
}
|
||||
export async function expectSettingsTab(page: Page, title: "General" | "Advanced") {
|
||||
const other = title === "General" ? "Advanced" : "General";
|
||||
await expect(settingsTab(page, title)).toHaveAttribute("aria-selected", "true");
|
||||
await expect(page.getByText(`${title} settings body`, { exact: true })).toBeVisible();
|
||||
await expect(page.getByText(`${other} settings body`, { exact: true })).toHaveCount(0);
|
||||
await expect(pluginPageName(page)).toHaveText(TABBED_PLUGIN_NAME);
|
||||
// The header names the plugin by its manifest name; the tab names the screen.
|
||||
await expectSettingsHeader(page, TABBED_PLUGIN_NAME);
|
||||
await expectAppRoute(
|
||||
page,
|
||||
`${buildSettingsHostSectionRoute(getServerId(), "plugins")}/${TABBED_PLUGIN_ID}/${title.toLowerCase()}`,
|
||||
);
|
||||
}
|
||||
export async function openTabbedSettingsLink(page: Page, title: "General" | "Advanced") {
|
||||
await gotoAppShell(page);
|
||||
await page.goto(`${pluginPageRoute(TABBED_PLUGIN_ID)}/${title.toLowerCase()}`);
|
||||
await page.goto(
|
||||
`${buildSettingsHostSectionRoute(getServerId(), "plugins")}/${TABBED_PLUGIN_ID}/${title.toLowerCase()}`,
|
||||
);
|
||||
await expectSettingsTab(page, title);
|
||||
}
|
||||
export async function groupByWorkspace(page: Page) {
|
||||
@@ -239,13 +235,18 @@ export async function discardTitle(page: Page) {
|
||||
}
|
||||
export async function returnAndReopenSettings(page: Page) {
|
||||
await goBackInSettings(page);
|
||||
await expectAppRoute(page, pluginsRoute());
|
||||
await openPluginPage(page, "settings-example");
|
||||
await expectSettingsExampleScreen(page);
|
||||
await openSettingsFromCog(page);
|
||||
}
|
||||
export async function returnToPluginsPage(page: Page) {
|
||||
await backToPlugins(page, "settings-example");
|
||||
await expectAppRoute(page, pluginsRoute());
|
||||
await page.getByRole("button", { name: "Back to plugins", exact: true }).click();
|
||||
await expectAppRoute(page, buildSettingsHostSectionRoute(getServerId(), "plugins"));
|
||||
await expect(
|
||||
page.getByRole("button", { name: "Actions for settings-example", exact: true }),
|
||||
).toBeVisible();
|
||||
}
|
||||
async function expectSettingsHeader(page: Page, title: string) {
|
||||
// Settings keeps the Plugins page mounted beneath, so read the visible title only.
|
||||
await expect(page.getByText(title, { exact: true }).filter({ visible: true })).toHaveCount(1);
|
||||
}
|
||||
export async function expectSettingsUnavailable(page: Page) {
|
||||
await expect(
|
||||
|
||||
@@ -187,44 +187,6 @@ export async function dragUsageCardAbove(
|
||||
await page.mouse.up();
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts recording where the cards are painted on every frame after the next mouse release.
|
||||
* Call the returned function to stop and read the frames, each as "id@top" for every card.
|
||||
*/
|
||||
export async function recordUsageCardPositionsAfterRelease(
|
||||
page: Page,
|
||||
): Promise<() => Promise<string[]>> {
|
||||
const recording = await usageModal(page).evaluateHandle((modal) => {
|
||||
const state = { released: false, stopped: false, frames: [] as string[] };
|
||||
const markReleased = () => {
|
||||
state.released = true;
|
||||
};
|
||||
window.addEventListener("mouseup", markReleased, { capture: true, once: true });
|
||||
const recordFrame = () => {
|
||||
if (state.stopped) return;
|
||||
if (state.released) {
|
||||
const cards = Array.from(modal.querySelectorAll('[data-testid^="usage-report-"]'));
|
||||
state.frames.push(
|
||||
cards
|
||||
.map((card) => {
|
||||
const id = card.getAttribute("data-testid")?.slice("usage-report-".length);
|
||||
return `${id}@${Math.round(card.getBoundingClientRect().top)}`;
|
||||
})
|
||||
.join(" "),
|
||||
);
|
||||
}
|
||||
requestAnimationFrame(recordFrame);
|
||||
};
|
||||
requestAnimationFrame(recordFrame);
|
||||
return state;
|
||||
});
|
||||
return () =>
|
||||
recording.evaluate((state) => {
|
||||
state.stopped = true;
|
||||
return state.frames;
|
||||
});
|
||||
}
|
||||
|
||||
/** Each pinned window as it reads: its percent and short label, "31% 5h". */
|
||||
export async function expectPinnedUsage(page: Page, windows: string[]): Promise<void> {
|
||||
const pinned = usageItem(page).getByTestId("sidebar-usage-pinned-window");
|
||||
|
||||
@@ -62,38 +62,6 @@ export async function startRestartableHostDaemon(version: string): Promise<Resta
|
||||
};
|
||||
}
|
||||
|
||||
export interface HostDaemon {
|
||||
serverId: string;
|
||||
port: number;
|
||||
dispose(): Promise<void>;
|
||||
}
|
||||
|
||||
/** A host daemon of its own, for tests that need host configuration the worker daemon lacks. */
|
||||
export async function startHostDaemon(options: {
|
||||
version: string;
|
||||
pluginRegistryUrl?: string;
|
||||
}): Promise<HostDaemon> {
|
||||
const paseoHomeRoot = await mkdtemp(path.join(tmpdir(), "paseo-e2e-host-"));
|
||||
try {
|
||||
const daemon = await startVersionedHostDaemon({
|
||||
...options,
|
||||
port: await getAvailableHostDaemonPort(),
|
||||
paseoHomeRoot,
|
||||
});
|
||||
return {
|
||||
serverId: daemon.serverId,
|
||||
port: daemon.port,
|
||||
async dispose() {
|
||||
await daemon.stop();
|
||||
await rm(paseoHomeRoot, { recursive: true, force: true });
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
await rm(paseoHomeRoot, { recursive: true, force: true });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
interface VersionedHostDaemon {
|
||||
serverId: string;
|
||||
port: number;
|
||||
@@ -105,7 +73,6 @@ interface VersionedHostDaemonOptions {
|
||||
version: string;
|
||||
port: number;
|
||||
paseoHomeRoot: string;
|
||||
pluginRegistryUrl?: string;
|
||||
}
|
||||
|
||||
// Starts the versioned test daemon on an explicit port with a caller-owned PASEO_HOME. The caller
|
||||
@@ -116,12 +83,7 @@ async function startVersionedHostDaemon(
|
||||
const child = spawnTsx(
|
||||
VERSIONED_DAEMON_ENTRYPOINT,
|
||||
[options.version, String(options.port), options.paseoHomeRoot],
|
||||
{
|
||||
stdio: ["ignore", "pipe", "pipe", "ipc"],
|
||||
env: options.pluginRegistryUrl
|
||||
? { ...process.env, PASEO_PLUGIN_REGISTRY: options.pluginRegistryUrl }
|
||||
: process.env,
|
||||
},
|
||||
{ stdio: ["ignore", "pipe", "pipe", "ipc"] },
|
||||
);
|
||||
const ready = Promise.withResolvers<{ port: number; serverId: string }>();
|
||||
let output = "";
|
||||
|
||||
@@ -91,13 +91,10 @@ async function selectWorkspaceTab(tab: Locator): Promise<void> {
|
||||
export async function ensureExplorerSidebar(page: Page): Promise<Locator> {
|
||||
const toggle = page.getByTestId("workspace-explorer-toggle").first();
|
||||
await expect(toggle).toBeVisible({ timeout: 30_000 });
|
||||
// Decide from the toggle, which reports the open state. The sidebar's own visibility lags it:
|
||||
// a compact layout draws its closed Explorer for a frame before hiding it.
|
||||
if ((await toggle.getAttribute("aria-expanded")) !== "true") {
|
||||
const explorer = explorerSidebar(page);
|
||||
if ((await explorer.count()) === 0) {
|
||||
await toggle.click();
|
||||
}
|
||||
await expect(toggle).toHaveAttribute("aria-expanded", "true");
|
||||
const explorer = explorerSidebar(page);
|
||||
await expect(explorer).toBeVisible({ timeout: 30_000 });
|
||||
return explorer;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/app",
|
||||
"version": "0.16.0",
|
||||
"version": "0.16.0-beta.2",
|
||||
"private": true,
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
|
||||
@@ -394,56 +394,6 @@ describe("bottom anchor controller driver", () => {
|
||||
expect(harness.scrollAttempts).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("honors a submit made during a gesture when that gesture ends away", () => {
|
||||
const harness = createDriverHarness({ isNearBottom: false });
|
||||
harness.driver.beginUserScroll();
|
||||
harness.driver.requestLocalAnchor({ agentId: "agent-1", reason: "message-sent" });
|
||||
harness.scheduler.flushAll();
|
||||
expect(harness.scrollAttempts).toEqual([]);
|
||||
|
||||
harness.driver.endUserScroll({ isAtEnd: false });
|
||||
harness.scheduler.flushAll();
|
||||
|
||||
expect(harness.context.measurementState.offsetY).toBe(
|
||||
harness.context.measurementState.contentHeight -
|
||||
harness.context.measurementState.viewportHeight,
|
||||
);
|
||||
expect(harness.driver.getSnapshot()).toMatchObject({
|
||||
mode: "sticky-bottom",
|
||||
pendingRequest: null,
|
||||
});
|
||||
});
|
||||
|
||||
it.each(["rewind", "jump-to-bottom"] as const)(
|
||||
"lets scrolling away supersede a late %s request",
|
||||
(reason) => {
|
||||
const harness = createDriverHarness({ isNearBottom: false });
|
||||
harness.driver.beginUserScroll();
|
||||
harness.driver.requestLocalAnchor({ agentId: "agent-1", reason });
|
||||
harness.driver.endUserScroll({ isAtEnd: false });
|
||||
harness.scheduler.flushAll();
|
||||
|
||||
expect(harness.scrollAttempts).toEqual([]);
|
||||
expect(harness.driver.getSnapshot()).toMatchObject({
|
||||
mode: "detached",
|
||||
pendingRequest: null,
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
it("lets a new gesture supersede a submit requested during the previous gesture", () => {
|
||||
const harness = createDriverHarness({ isNearBottom: false });
|
||||
harness.driver.beginUserScroll();
|
||||
harness.driver.requestLocalAnchor({ agentId: "agent-1", reason: "message-sent" });
|
||||
harness.driver.endUserScroll({ isAtEnd: false });
|
||||
harness.driver.beginUserScroll();
|
||||
harness.driver.endUserScroll({ isAtEnd: false });
|
||||
harness.scheduler.flushAll();
|
||||
|
||||
expect(harness.scrollAttempts).toEqual([]);
|
||||
expect(harness.driver.getSnapshot()).toMatchObject({ mode: "detached", pendingRequest: null });
|
||||
});
|
||||
|
||||
it("resumes following when a user scroll ends at the end", () => {
|
||||
const harness = createDriverHarness({
|
||||
transportBehavior: {
|
||||
|
||||
@@ -499,16 +499,11 @@ function createBottomAnchorControllerDriver(
|
||||
cancelPendingAttempt();
|
||||
setModeInternal("detached");
|
||||
},
|
||||
// A gesture ending short stays detached unless a newer prompt submission requested the end.
|
||||
// Passive output must not move the rows the finger just let go of.
|
||||
// Following resumes only for a gesture that ends at the end. Resuming from short of it would
|
||||
// scroll the rows the finger just let go of, so a release above the end, or with output that
|
||||
// arrived below it during the gesture, stays detached with the pill.
|
||||
endUserScroll(params) {
|
||||
isUserScrollActive = false;
|
||||
// Submit arrives with the user's action; rewind and tail jumps can arrive after a fetch.
|
||||
// A newer gesture would have detached again, so only a still-sticky submit owns release.
|
||||
if (pendingRequest?.reason === "message-sent" && mode === "sticky-bottom") {
|
||||
evaluate(false, "user_scroll_end");
|
||||
return;
|
||||
}
|
||||
if (params.isAtEnd) {
|
||||
if (mode === "detached") {
|
||||
setModeInternal("sticky-bottom");
|
||||
|
||||
@@ -4,7 +4,6 @@ import { within } from "@testing-library/dom";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { i18n as testI18n } from "@/i18n/i18next";
|
||||
import { ToolCallDetailsContent } from "@/components/tool-call-details";
|
||||
import { ExpandableBadge } from "@/components/message";
|
||||
import { page, userEvent } from "vitest/browser";
|
||||
import { PlanCard } from "@/components/plan-card";
|
||||
@@ -203,87 +202,3 @@ describe("tool badge file action", () => {
|
||||
expect(view().queryByText("File contents")).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
const longDetail = {
|
||||
type: "unknown" as const,
|
||||
input: { text: "input\n".repeat(80) },
|
||||
output: { text: "output\n".repeat(80) },
|
||||
};
|
||||
|
||||
describe("inline tool detail height", () => {
|
||||
it("caps the complete detail, including input, output and error, to its allowance", () => {
|
||||
act(() =>
|
||||
root.render(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<ToolCallDetailsContent
|
||||
detail={longDetail}
|
||||
errorText={"error\n".repeat(80)}
|
||||
maxHeight={200}
|
||||
/>
|
||||
</QueryClientProvider>,
|
||||
),
|
||||
);
|
||||
expect(container.getBoundingClientRect().height).toBeLessThanOrEqual(200);
|
||||
expect(container.textContent).toContain("output");
|
||||
expect(container.textContent).toContain("error");
|
||||
});
|
||||
});
|
||||
|
||||
const longShellDetail = {
|
||||
type: "shell" as const,
|
||||
command: "echo command\n".repeat(80),
|
||||
output: "output\n".repeat(80),
|
||||
};
|
||||
|
||||
const longEditDetail = {
|
||||
type: "edit" as const,
|
||||
filePath: "example.txt",
|
||||
oldString: "old line\n".repeat(80),
|
||||
newString: "new line\n".repeat(80),
|
||||
};
|
||||
|
||||
describe("capped tool scrolling", () => {
|
||||
it.each([longShellDetail, longEditDetail])(
|
||||
"gives a capped $type detail one vertical scroll owner",
|
||||
(detail) => {
|
||||
act(() =>
|
||||
root.render(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<ToolCallDetailsContent detail={detail} maxHeight={200} />
|
||||
</QueryClientProvider>,
|
||||
),
|
||||
);
|
||||
const verticalScrollers = Array.from(container.querySelectorAll("*")).filter((node) =>
|
||||
["auto", "scroll"].includes(getComputedStyle(node).overflowY),
|
||||
);
|
||||
expect(verticalScrollers).toHaveLength(1);
|
||||
expect(container.getBoundingClientRect().height).toBeLessThanOrEqual(200);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
function renderCopyOutput() {
|
||||
return <button type="button">Copy output</button>;
|
||||
}
|
||||
|
||||
describe("tool detail interaction", () => {
|
||||
it("keeps detail controls in the tab order", async () => {
|
||||
function Badge() {
|
||||
const [expanded, setExpanded] = React.useState(true);
|
||||
const toggle = React.useCallback(() => setExpanded(!expanded), [expanded]);
|
||||
return (
|
||||
<ExpandableBadge
|
||||
label="Probe"
|
||||
isExpanded={expanded}
|
||||
onToggle={toggle}
|
||||
renderDetails={renderCopyOutput}
|
||||
/>
|
||||
);
|
||||
}
|
||||
act(() => root.render(<Badge />));
|
||||
const header = view().getByRole("button", { name: "Probe" });
|
||||
act(() => header.focus());
|
||||
await userEvent.keyboard("{Tab}");
|
||||
expect(document.activeElement).toBe(view().getByRole("button", { name: "Copy output" }));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -883,7 +883,6 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
|
||||
status={call.status}
|
||||
isLastInSequence={index === group.run.calls.length - 1}
|
||||
defaultExpanded={false}
|
||||
maxDetailHeight={GROUPED_TOOL_CALL_DETAIL_MAX_HEIGHT}
|
||||
standalone={false}
|
||||
onInlineDetailsExpandedChangeByItemId={setInlineDetailsExpanded}
|
||||
/>
|
||||
@@ -1376,7 +1375,6 @@ interface ThoughtSlotProps {
|
||||
isLastInSequence: boolean;
|
||||
defaultExpanded: boolean;
|
||||
standalone?: boolean;
|
||||
maxDetailHeight?: number;
|
||||
}
|
||||
|
||||
// Reasoning text is paced the same way assistant text is; see @/hooks/use-revealed-text.
|
||||
@@ -1388,7 +1386,6 @@ function ThoughtSlot({
|
||||
isLastInSequence,
|
||||
defaultExpanded,
|
||||
standalone,
|
||||
maxDetailHeight,
|
||||
}: ThoughtSlotProps) {
|
||||
const revealedText = useRevealedText(text, status === "ready" ? "complete" : "streaming");
|
||||
return (
|
||||
@@ -1401,7 +1398,6 @@ function ThoughtSlot({
|
||||
isLastInSequence={isLastInSequence}
|
||||
defaultExpanded={defaultExpanded}
|
||||
standalone={standalone}
|
||||
maxDetailHeight={maxDetailHeight}
|
||||
forceInline={defaultExpanded}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -931,9 +931,7 @@ function RootStack() {
|
||||
<Stack.Screen name="h/[serverId]" />
|
||||
<Stack.Screen name="settings/hosts/[serverId]/index" />
|
||||
<Stack.Screen name="settings/hosts/[serverId]/[hostSection]" />
|
||||
<Stack.Screen name="settings/hosts/[serverId]/plugins/[pluginId]/index" />
|
||||
<Stack.Screen name="settings/hosts/[serverId]/plugins/[pluginId]/[screenId]" />
|
||||
<Stack.Screen name="settings/hosts/[serverId]/plugin-directory/[owner]/[slug]" />
|
||||
<Stack.Screen name="settings/hosts/[serverId]/projects/index" />
|
||||
<Stack.Screen name="settings/hosts/[serverId]/projects/[projectId]" />
|
||||
</ThemedStack>
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { useMemo } from "react";
|
||||
|
||||
import { useLocalSearchParams } from "expo-router";
|
||||
import { HostRouteBootstrapBoundary } from "@/components/host-route-bootstrap-boundary";
|
||||
import SettingsScreen from "@/screens/settings-screen";
|
||||
|
||||
/** A plugin directory listing's page, by its `owner/slug` ID. */
|
||||
export default function PluginListingRoute() {
|
||||
const { serverId, owner, slug } = useLocalSearchParams<{
|
||||
serverId: string;
|
||||
owner: string;
|
||||
slug: string;
|
||||
}>();
|
||||
const view = useMemo(
|
||||
() => ({ kind: "pluginListing" as const, serverId, listingId: `${owner}/${slug}` }),
|
||||
[serverId, owner, slug],
|
||||
);
|
||||
return (
|
||||
<HostRouteBootstrapBoundary>
|
||||
<SettingsScreen view={view} />
|
||||
</HostRouteBootstrapBoundary>
|
||||
);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import { useMemo } from "react";
|
||||
|
||||
import { useLocalSearchParams } from "expo-router";
|
||||
import { HostRouteBootstrapBoundary } from "@/components/host-route-bootstrap-boundary";
|
||||
import SettingsScreen from "@/screens/settings-screen";
|
||||
|
||||
/** An installed plugin's page. A settings tab chosen on it arrives as `screenId`. */
|
||||
export default function PluginPageRoute() {
|
||||
const { serverId, pluginId, screenId } = useLocalSearchParams<{
|
||||
serverId: string;
|
||||
pluginId: string;
|
||||
screenId?: string;
|
||||
}>();
|
||||
const view = useMemo(
|
||||
() => ({ kind: "plugin" as const, serverId, pluginId, screenId }),
|
||||
[serverId, pluginId, screenId],
|
||||
);
|
||||
return (
|
||||
<HostRouteBootstrapBoundary>
|
||||
<SettingsScreen view={view} />
|
||||
</HostRouteBootstrapBoundary>
|
||||
);
|
||||
}
|
||||
@@ -25,13 +25,12 @@ function source(gitActions: GitActions): {
|
||||
dispatched: KeyboardActionDefinition[];
|
||||
copiedPaths: number;
|
||||
copiedBranchNames: number;
|
||||
archivedWorkspaces: number;
|
||||
toggledLabels: Array<{ name: string; assigned: boolean }>;
|
||||
} {
|
||||
const runGitActions: GitAction[] = [];
|
||||
const dispatched: KeyboardActionDefinition[] = [];
|
||||
const toggledLabels: Array<{ name: string; assigned: boolean }> = [];
|
||||
const counters = { copiedPaths: 0, copiedBranchNames: 0, archivedWorkspaces: 0 };
|
||||
const counters = { copiedPaths: 0, copiedBranchNames: 0 };
|
||||
return {
|
||||
value: {
|
||||
gitActions,
|
||||
@@ -69,7 +68,6 @@ function source(gitActions: GitActions): {
|
||||
closePane: "Close pane",
|
||||
toggleFocusMode: "Toggle focus mode",
|
||||
toggleExplorerSidebar: "Toggle Explorer sidebar",
|
||||
archiveWorkspace: "Archive workspace",
|
||||
rename: "Rename workspace",
|
||||
copyPath: "Copy workspace path",
|
||||
copyBranchName: "Copy branch name",
|
||||
@@ -95,9 +93,6 @@ function source(gitActions: GitActions): {
|
||||
labelCatalog: null,
|
||||
dispatch: (action) => dispatched.push(action),
|
||||
runGitAction: (action) => runGitActions.push(action),
|
||||
archiveWorkspace: () => {
|
||||
counters.archivedWorkspaces += 1;
|
||||
},
|
||||
copyPath: () => {
|
||||
counters.copiedPaths += 1;
|
||||
},
|
||||
@@ -117,48 +112,10 @@ function source(gitActions: GitActions): {
|
||||
get copiedBranchNames() {
|
||||
return counters.copiedBranchNames;
|
||||
},
|
||||
get archivedWorkspaces() {
|
||||
return counters.archivedWorkspaces;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
describe("workspace command center contributions", () => {
|
||||
it("offers archive in a non-Git workspace and runs the workspace's archive", () => {
|
||||
const fixture = source({ primary: null, secondary: [], menu: [] });
|
||||
|
||||
const archive = buildWorkspaceCommandCenterContributions(fixture.value).find(
|
||||
(item) => item.id === "workspace:archive",
|
||||
);
|
||||
|
||||
expect(archive?.visibility).toBe("query");
|
||||
expect(archive?.presentation).toMatchObject({ title: "Archive workspace" });
|
||||
archive?.run();
|
||||
expect(fixture.archivedWorkspaces).toBe(1);
|
||||
expect(fixture.dispatched).toEqual([]);
|
||||
});
|
||||
|
||||
it("omits archive while the workspace cannot be archived", () => {
|
||||
const fixture = source({ primary: null, secondary: [], menu: [] });
|
||||
fixture.value.archiveWorkspace = null;
|
||||
|
||||
const contributions = buildWorkspaceCommandCenterContributions(fixture.value);
|
||||
|
||||
expect(contributions.some((item) => item.id === "workspace:archive")).toBe(false);
|
||||
});
|
||||
|
||||
it("lists archive once in a Git workspace, through its Git action", () => {
|
||||
const archive = gitAction("archive-workspace", "Archive workspace");
|
||||
const fixture = source({ primary: null, secondary: [archive], menu: [] });
|
||||
fixture.value.capabilities.isGit = true;
|
||||
|
||||
const contributions = buildWorkspaceCommandCenterContributions(fixture.value);
|
||||
|
||||
expect(
|
||||
contributions.filter((item) => item.id.includes("archive")).map((item) => item.id),
|
||||
).toEqual(["git:archive-workspace"]);
|
||||
});
|
||||
|
||||
it("makes only the policy-selected primary Git action default-visible and runs it", () => {
|
||||
const primary = gitAction("commit", "Commit");
|
||||
const fixture = source({
|
||||
|
||||
@@ -50,7 +50,6 @@ export interface WorkspaceCommandCenterLabels {
|
||||
toggleFocusMode: string;
|
||||
toggleExplorerSidebar: string;
|
||||
// Workspace management actions
|
||||
archiveWorkspace: string;
|
||||
rename: string;
|
||||
copyPath: string;
|
||||
copyBranchName: string;
|
||||
@@ -80,7 +79,6 @@ export interface WorkspaceCommandCenterIcons {
|
||||
focusMode?: CommandCenterIcon;
|
||||
explorerSidebar?: CommandCenterIcon;
|
||||
// Workspace management action icons
|
||||
archiveWorkspace?: CommandCenterIcon;
|
||||
copyPath?: CommandCenterIcon;
|
||||
copyBranchName?: CommandCenterIcon;
|
||||
pin?: CommandCenterIcon;
|
||||
@@ -133,8 +131,6 @@ export interface WorkspaceCommandCenterSource {
|
||||
labelCatalog: readonly WorkspaceCommandCenterLabelChoice[] | null;
|
||||
dispatch(action: KeyboardActionDefinition): void;
|
||||
runGitAction(action: GitAction): void;
|
||||
/** Null while the workspace cannot be archived. A Git workspace archives through `gitActions`. */
|
||||
archiveWorkspace: (() => void) | null;
|
||||
copyPath(): void;
|
||||
copyBranchName(): void;
|
||||
toggleLabel(name: string, assigned: boolean): void | Promise<void>;
|
||||
@@ -589,23 +585,6 @@ export function buildWorkspaceCommandCenterContributions(
|
||||
contributions.push(buildGitContribution(source, action, 100 + index, "query"));
|
||||
}
|
||||
|
||||
// A Git workspace lists archive among its Git actions; any other workspace archives here.
|
||||
if (!source.capabilities.isGit && source.archiveWorkspace) {
|
||||
contributions.push(
|
||||
buildWorkspaceCallback({
|
||||
source,
|
||||
id: "workspace:archive",
|
||||
rank: 100,
|
||||
title: source.labels.archiveWorkspace,
|
||||
keywords: ["archive", "workspace"],
|
||||
icon: source.icons.archiveWorkspace,
|
||||
shortcutKeys: source.shortcuts.archiveWorkspace,
|
||||
run: source.archiveWorkspace,
|
||||
visibility: "query",
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
if (source.capabilities.canPin) {
|
||||
contributions.push(
|
||||
buildWorkspaceAction({
|
||||
|
||||
@@ -203,7 +203,7 @@ export function useWorkspaceCommandCenterActions(): void {
|
||||
supportsSetupObservation,
|
||||
);
|
||||
const { overrides } = useKeyboardShortcutOverrides();
|
||||
const { gitActions, isGit, archiveWorkspace } = useGitActions({
|
||||
const { gitActions, isGit } = useGitActions({
|
||||
serverId: serverId ?? "",
|
||||
cwd: cwd ?? "",
|
||||
icons: GIT_ACTION_ICONS,
|
||||
@@ -270,7 +270,6 @@ export function useWorkspaceCommandCenterActions(): void {
|
||||
toggleFocusMode: t("settings.shortcuts.help.toggleFocusMode"),
|
||||
toggleExplorerSidebar: t("workspace.tabs.explorerSidebar.toggle"),
|
||||
// Workspace management labels
|
||||
archiveWorkspace: t("workspace.git.actions.archive.label"),
|
||||
rename: t("sidebar.workspace.actions.rename"),
|
||||
copyPath: t("workspace.header.actions.copyPath"),
|
||||
copyBranchName: t("workspace.header.actions.copyBranchName"),
|
||||
@@ -281,7 +280,6 @@ export function useWorkspaceCommandCenterActions(): void {
|
||||
},
|
||||
icons: {
|
||||
...WORKSPACE_COMMAND_CENTER_ICONS,
|
||||
archiveWorkspace: staticIcon(GIT_ACTION_ICONS.archive),
|
||||
git: (action) => staticIcon(action.icon),
|
||||
},
|
||||
shortcuts: resolveWorkspaceShortcuts(overrides),
|
||||
@@ -303,14 +301,12 @@ export function useWorkspaceCommandCenterActions(): void {
|
||||
keyboardActionDispatcher.dispatch(action);
|
||||
},
|
||||
runGitAction,
|
||||
archiveWorkspace,
|
||||
copyPath,
|
||||
copyBranchName,
|
||||
toggleLabel,
|
||||
}),
|
||||
[
|
||||
activeTabIndex,
|
||||
archiveWorkspace,
|
||||
activeTabKind,
|
||||
canPin,
|
||||
canShowSetup,
|
||||
|
||||
@@ -15,6 +15,7 @@ const ScrollView = isWeb ? RNScrollView : GHScrollView;
|
||||
|
||||
interface DiffViewerProps {
|
||||
diffLines: DiffLine[];
|
||||
maxHeight?: number;
|
||||
emptyLabel?: string;
|
||||
fillAvailableHeight?: boolean;
|
||||
}
|
||||
@@ -118,6 +119,7 @@ function DiffSegment({
|
||||
|
||||
export function DiffViewer({
|
||||
diffLines,
|
||||
maxHeight,
|
||||
emptyLabel,
|
||||
fillAvailableHeight = false,
|
||||
}: DiffViewerProps) {
|
||||
@@ -131,8 +133,12 @@ export function DiffViewer({
|
||||
);
|
||||
|
||||
const outerScrollStyle = React.useMemo(
|
||||
() => [styles.verticalScroll, fillAvailableHeight && styles.fillHeight],
|
||||
[fillAvailableHeight],
|
||||
() => [
|
||||
styles.verticalScroll,
|
||||
maxHeight !== undefined && inlineUnistylesStyle({ maxHeight }),
|
||||
fillAvailableHeight && styles.fillHeight,
|
||||
],
|
||||
[maxHeight, fillAvailableHeight],
|
||||
);
|
||||
const linesContainerStyle = React.useMemo(
|
||||
() => [
|
||||
@@ -178,9 +184,6 @@ export function DiffViewer({
|
||||
</ScrollView>
|
||||
);
|
||||
|
||||
// Capped tool details own vertical scrolling outside the diff.
|
||||
if (!fillAvailableHeight) return horizontalScroll;
|
||||
|
||||
const content = (
|
||||
<ScrollView
|
||||
style={outerScrollStyle}
|
||||
|
||||
@@ -2,41 +2,31 @@ import { describe, expect, it } from "vitest";
|
||||
import { dragStateInitial, dragStateReducer } from "./drag-reducer";
|
||||
|
||||
describe("dragStateReducer", () => {
|
||||
it("starts tracking the active item with the rows on screen", () => {
|
||||
it("starts tracking the active item with a snapshot of the data", () => {
|
||||
const next = dragStateReducer(dragStateInitial<string>(), {
|
||||
type: "start",
|
||||
id: "alpha",
|
||||
items: ["alpha", "beta"],
|
||||
data: ["alpha", "beta"],
|
||||
});
|
||||
|
||||
expect(next).toEqual({ activeId: "alpha", dragItems: ["alpha", "beta"], dropped: null });
|
||||
expect(next).toEqual({ activeId: "alpha", dragItems: ["alpha", "beta"] });
|
||||
});
|
||||
|
||||
it("clears the active item and the rows", () => {
|
||||
it("clears the active item and the snapshot", () => {
|
||||
const next = dragStateReducer(
|
||||
{ activeId: "alpha", dragItems: ["alpha", "beta"], dropped: null },
|
||||
{ activeId: "alpha", dragItems: ["alpha", "beta"] },
|
||||
{ type: "clear" },
|
||||
);
|
||||
|
||||
expect(next).toEqual({ activeId: null, dragItems: null, dropped: null });
|
||||
});
|
||||
|
||||
it("holds the dropped order in place of the order it replaces", () => {
|
||||
const dropped = { order: ["beta", "alpha"], replaces: ["alpha", "beta"] };
|
||||
const next = dragStateReducer(
|
||||
{ activeId: "alpha", dragItems: ["alpha", "beta"], dropped: null },
|
||||
{ type: "drop", dropped },
|
||||
);
|
||||
|
||||
expect(next).toEqual({ activeId: null, dragItems: null, dropped });
|
||||
expect(next).toEqual({ activeId: null, dragItems: null });
|
||||
});
|
||||
|
||||
it("replaces an in-flight drag when a new one starts", () => {
|
||||
const next = dragStateReducer(
|
||||
{ activeId: "alpha", dragItems: ["alpha", "beta"], dropped: null },
|
||||
{ type: "start", id: "beta", items: ["beta", "gamma"] },
|
||||
{ activeId: "alpha", dragItems: ["alpha", "beta"] },
|
||||
{ type: "start", id: "beta", data: ["beta", "gamma"] },
|
||||
);
|
||||
|
||||
expect(next).toEqual({ activeId: "beta", dragItems: ["beta", "gamma"], dropped: null });
|
||||
expect(next).toEqual({ activeId: "beta", dragItems: ["beta", "gamma"] });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,33 +1,19 @@
|
||||
/** A dropped key order, shown in place of the owner's until the owner's order changes. */
|
||||
export interface DroppedOrder {
|
||||
order: string[];
|
||||
/** The owner's key order at the drop. */
|
||||
replaces: string[];
|
||||
}
|
||||
|
||||
export interface DragState<T> {
|
||||
activeId: string | null;
|
||||
/** The rows on screen while a drag is in flight. */
|
||||
dragItems: T[] | null;
|
||||
dropped: DroppedOrder | null;
|
||||
}
|
||||
|
||||
export type DragAction<T> =
|
||||
| { type: "start"; id: string; items: T[] }
|
||||
| { type: "drop"; dropped: DroppedOrder }
|
||||
| { type: "clear" };
|
||||
export type DragAction<T> = { type: "start"; id: string; data: T[] } | { type: "clear" };
|
||||
|
||||
export function dragStateInitial<T>(): DragState<T> {
|
||||
return { activeId: null, dragItems: null, dropped: null };
|
||||
return { activeId: null, dragItems: null };
|
||||
}
|
||||
|
||||
export function dragStateReducer<T>(state: DragState<T>, action: DragAction<T>): DragState<T> {
|
||||
switch (action.type) {
|
||||
case "start":
|
||||
return { activeId: action.id, dragItems: action.items, dropped: null };
|
||||
case "drop":
|
||||
return { activeId: null, dragItems: null, dropped: action.dropped };
|
||||
return { activeId: action.id, dragItems: action.data };
|
||||
case "clear":
|
||||
return dragStateInitial();
|
||||
return { activeId: null, dragItems: null };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCallback, useMemo, useReducer } from "react";
|
||||
import { useCallback, useReducer } from "react";
|
||||
import type { DragEndEvent, DragStartEvent } from "@dnd-kit/core";
|
||||
import { dragStateInitial, dragStateReducer, type DroppedOrder } from "./drag-reducer";
|
||||
import { dragStateInitial, dragStateReducer } from "./drag-reducer";
|
||||
import { reorderItemsOnDragEnd } from "./reorder-items";
|
||||
|
||||
export interface DragReorderHandlers {
|
||||
@@ -15,28 +15,6 @@ export interface DragReorderState<T> {
|
||||
handlers: DragReorderHandlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* The owner's rows in the dropped order, or null once the owner's own order has changed since
|
||||
* the drop.
|
||||
*/
|
||||
function arrangeAsDropped<T>(
|
||||
data: T[],
|
||||
keys: string[],
|
||||
{ order, replaces }: DroppedOrder,
|
||||
): T[] | null {
|
||||
const ownerOrderUnchanged =
|
||||
keys.length === replaces.length && keys.every((key, index) => key === replaces[index]);
|
||||
if (!ownerOrderUnchanged) return null;
|
||||
|
||||
const indexByKey = new Map(keys.map((key, index) => [key, index]));
|
||||
const arranged: T[] = [];
|
||||
for (const key of order) {
|
||||
const index = indexByKey.get(key);
|
||||
if (index !== undefined) arranged.push(data[index]);
|
||||
}
|
||||
return arranged.length === data.length ? arranged : null;
|
||||
}
|
||||
|
||||
export function useDragReorderState<T>({
|
||||
data,
|
||||
keyExtractor,
|
||||
@@ -52,22 +30,13 @@ export function useDragReorderState<T>({
|
||||
}): DragReorderState<T> {
|
||||
const [state, dispatch] = useReducer(dragStateReducer<T>, undefined, dragStateInitial<T>);
|
||||
|
||||
const keys = useMemo(() => data.map(keyExtractor), [data, keyExtractor]);
|
||||
const held = useMemo(
|
||||
() => (state.dropped ? arrangeAsDropped(data, keys, state.dropped) : null),
|
||||
[data, keys, state.dropped],
|
||||
);
|
||||
// The owner's order changed, so the dropped order has nothing left to stand in for.
|
||||
if (state.dropped && !held) dispatch({ type: "clear" });
|
||||
const items = state.dragItems ?? held ?? data;
|
||||
|
||||
const handleDragStart = useCallback(
|
||||
(event: DragStartEvent) => {
|
||||
if (disabled) return;
|
||||
dispatch({ type: "start", id: String(event.active.id), items });
|
||||
dispatch({ type: "start", id: String(event.active.id), data });
|
||||
onDragBegin?.();
|
||||
},
|
||||
[disabled, items, onDragBegin],
|
||||
[data, disabled, onDragBegin],
|
||||
);
|
||||
|
||||
const clearDragState = useCallback(() => {
|
||||
@@ -77,29 +46,25 @@ export function useDragReorderState<T>({
|
||||
const handleDragEnd = useCallback(
|
||||
(event: DragEndEvent) => {
|
||||
const { active, over } = event;
|
||||
const items = state.dragItems ?? data;
|
||||
dispatch({ type: "clear" });
|
||||
if (disabled) return;
|
||||
|
||||
const activeId = String(active.id);
|
||||
const reordered = disabled
|
||||
? null
|
||||
: reorderItemsOnDragEnd({
|
||||
items,
|
||||
activeId,
|
||||
overId: over ? String(over.id) : null,
|
||||
keyExtractor,
|
||||
});
|
||||
if (!reordered) {
|
||||
dispatch({ type: "clear" });
|
||||
return;
|
||||
}
|
||||
// The owner's new order can arrive in a later render. Hold the dropped order until it does.
|
||||
dispatch({ type: "drop", dropped: { order: reordered.map(keyExtractor), replaces: keys } });
|
||||
onDragEnd?.(reordered, activeId);
|
||||
const reordered = reorderItemsOnDragEnd({
|
||||
items,
|
||||
activeId,
|
||||
overId: over ? String(over.id) : null,
|
||||
keyExtractor,
|
||||
});
|
||||
if (reordered) onDragEnd?.(reordered, activeId);
|
||||
},
|
||||
[disabled, items, keyExtractor, keys, onDragEnd],
|
||||
[data, disabled, keyExtractor, onDragEnd, state.dragItems],
|
||||
);
|
||||
|
||||
return {
|
||||
activeId: state.activeId,
|
||||
items,
|
||||
items: state.dragItems ?? data,
|
||||
handlers: {
|
||||
onDragStart: handleDragStart,
|
||||
onDragCancel: clearDragState,
|
||||
|
||||
@@ -36,10 +36,7 @@ export interface DraggableListProps<T> {
|
||||
data: T[];
|
||||
keyExtractor: (item: T, index: number) => string;
|
||||
renderItem: (info: DraggableRenderItemInfo<T>) => ReactElement;
|
||||
/**
|
||||
* The new order, and the key of the item the user moved to reach it. The list keeps showing
|
||||
* this order until `data` arrives in a different order, so the owner must apply it.
|
||||
*/
|
||||
/** The new order, and the key of the item the user moved to reach it. */
|
||||
onDragEnd: (data: T[], movedKey: string) => void;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
/** Outer container style (useful for nested, non-scrolling lists). */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { act, useCallback, useState } from "react";
|
||||
import React, { act } from "react";
|
||||
import { createRoot, type Root } from "react-dom/client";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
@@ -11,7 +11,6 @@ Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
|
||||
|
||||
interface Item {
|
||||
id: string;
|
||||
label?: string;
|
||||
}
|
||||
|
||||
function keyExtractor(item: Item): string {
|
||||
@@ -42,7 +41,7 @@ function renderRowWithHandle(info: DraggableRenderItemInfo<Item>) {
|
||||
<DraggableListHandle accessibilityLabel={`Move ${info.item.id}`} testID="row-handle">
|
||||
<span>grip</span>
|
||||
</DraggableListHandle>
|
||||
<span data-testid="row-body">{info.item.label ?? info.item.id}</span>
|
||||
<span data-testid="row-body">{info.item.id}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -88,87 +87,6 @@ function pressAndMove(element: HTMLElement, distance: number) {
|
||||
});
|
||||
}
|
||||
|
||||
const OWNER_DELAY_MS = 50;
|
||||
|
||||
function wait(ms: number): Promise<void> {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* An owner that relabels its rows as soon as one is dropped, and whose new order reaches the list
|
||||
* in a later render, like one that saves to a store.
|
||||
*/
|
||||
function ListWithLateOwner() {
|
||||
const [items, setItems] = useState<Item[]>([{ id: "one" }, { id: "two" }]);
|
||||
const relabelThenReorderLater = useCallback((next: Item[]) => {
|
||||
const relabel = (item: Item): Item => ({ id: item.id, label: `${item.id} dropped` });
|
||||
setItems((current) => current.map(relabel));
|
||||
setTimeout(() => setItems(next.map(relabel)), OWNER_DELAY_MS);
|
||||
}, []);
|
||||
return (
|
||||
<DraggableList
|
||||
data={items}
|
||||
keyExtractor={keyExtractor}
|
||||
renderItem={renderRowWithHandle}
|
||||
onDragEnd={relabelThenReorderLater}
|
||||
useDragHandle
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function rowOrder(): (string | null)[] {
|
||||
return Array.from(container?.querySelectorAll('[data-testid="row-body"]') ?? []).map(
|
||||
(row) => row.textContent,
|
||||
);
|
||||
}
|
||||
|
||||
/** Drag the element down by `distance` in two mouse moves, letting dnd-kit measure in between. */
|
||||
async function dragDown(element: HTMLElement, distance: number) {
|
||||
const { left, top, width, height } = element.getBoundingClientRect();
|
||||
const x = left + width / 2;
|
||||
const y = top + height / 2;
|
||||
await act(async () => {
|
||||
element.dispatchEvent(
|
||||
new MouseEvent("mousedown", { bubbles: true, button: 0, clientX: x, clientY: y }),
|
||||
);
|
||||
});
|
||||
for (const moved of [distance / 2, distance]) {
|
||||
await act(async () => {
|
||||
document.dispatchEvent(
|
||||
new MouseEvent("mousemove", { bubbles: true, clientX: x, clientY: y + moved }),
|
||||
);
|
||||
await wait(20);
|
||||
});
|
||||
}
|
||||
act(() => {
|
||||
document.dispatchEvent(new MouseEvent("mouseup", { bubbles: true }));
|
||||
});
|
||||
}
|
||||
|
||||
describe("DraggableList on web", () => {
|
||||
it("shows the owner's current rows in the dropped order until its new order arrives", async () => {
|
||||
act(() => {
|
||||
root?.render(<ListWithLateOwner />);
|
||||
});
|
||||
const [firstHandle] = Array.from(
|
||||
container?.querySelectorAll<HTMLElement>('[data-testid="row-handle"]') ?? [],
|
||||
);
|
||||
const [firstRow, secondRow] = Array.from(
|
||||
container?.querySelectorAll<HTMLElement>('[data-testid="row-body"]') ?? [],
|
||||
);
|
||||
const rowDistance =
|
||||
secondRow.getBoundingClientRect().top - firstRow.getBoundingClientRect().top;
|
||||
|
||||
await dragDown(firstHandle, rowDistance);
|
||||
expect(rowOrder()).toEqual(["two dropped", "one dropped"]);
|
||||
|
||||
await act(() => wait(OWNER_DELAY_MS * 2));
|
||||
expect(rowOrder()).toEqual(["two dropped", "one dropped"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("DraggableListHandle on web", () => {
|
||||
it("starts the row's drag from the handle, and only from the handle", () => {
|
||||
const onDragBegin = vi.fn();
|
||||
|
||||
@@ -38,23 +38,18 @@ export interface MarkdownImageContext {
|
||||
export function useMarkdownSource(
|
||||
text: string,
|
||||
context: MarkdownImageContext,
|
||||
links: {
|
||||
commandNames?: ReadonlySet<string>;
|
||||
forgeReferencePattern?: string;
|
||||
external?: boolean;
|
||||
} = {},
|
||||
links: { commandNames?: ReadonlySet<string>; forgeReferencePattern?: string } = {},
|
||||
) {
|
||||
const occurrenceKey = useId();
|
||||
const { commandNames, forgeReferencePattern, external } = links;
|
||||
const { commandNames, forgeReferencePattern } = links;
|
||||
const prepared = useMemo(
|
||||
() =>
|
||||
prepareMarkdownSource(text, context.workspaceRoot, {
|
||||
supportsSvg: isWeb,
|
||||
commandNames,
|
||||
forgeReferencePattern,
|
||||
external,
|
||||
}),
|
||||
[text, context.workspaceRoot, commandNames, forgeReferencePattern, external],
|
||||
[text, context.workspaceRoot, commandNames, forgeReferencePattern],
|
||||
);
|
||||
const sources = [...new Set(prepared.images.map((image) => image.source))];
|
||||
const acquisitions = sources.map((source) => {
|
||||
|
||||
@@ -562,34 +562,6 @@ describe("bare URL sentence punctuation", () => {
|
||||
expect(tree.children?.[0]?.children?.[0]?.attributes?.url).toBe("https://example.com/a.");
|
||||
},
|
||||
);
|
||||
|
||||
it.each([
|
||||
["https://a.com、https://b.com!", ["https://a.com", "、", "https://b.com", "!"]],
|
||||
["https://a.com(说明)以及", ["https://a.com", "(说明)以及"]],
|
||||
["看这里:https://example.com/foo,还有", ["看这里:", "https://example.com/foo", ",还有"]],
|
||||
["(https://example.com/a)", ["(", "https://example.com/a", ")"]],
|
||||
["见【https://example.com/a】。", ["见【", "https://example.com/a", "】。"]],
|
||||
["“https://example.com/a”…", ["“", "https://example.com/a", "”…"]],
|
||||
[
|
||||
"见https://zh.wikipedia.org/wiki/人工智能。",
|
||||
["见", "https://zh.wikipedia.org/wiki/人工智能", "。"],
|
||||
],
|
||||
])("ends a bare URL at CJK and typographic punctuation: %s", async (source, expected) => {
|
||||
const prepared = prepareMarkdownSource(source);
|
||||
const tree = recognizeTextLinks(
|
||||
await parseMarkdown(prepared.render(), { latexMath: false }),
|
||||
prepared.linkRecognition.text,
|
||||
prepared.linkRecognition.inlineCode,
|
||||
);
|
||||
const parts = (tree.children?.[0]?.children ?? []).map((node) =>
|
||||
node.type === "Link" ? String(node.attributes?.url) : String(node.content),
|
||||
);
|
||||
expect(parts).toEqual(expected);
|
||||
expect(toNativeLinkRecognition(prepared.linkRecognition).text).toMatchObject({
|
||||
isDisabled: false,
|
||||
isDefault: false,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("requires workspace context for relative inline paths and escapes literal regex characters", () => {
|
||||
@@ -1124,30 +1096,3 @@ it.each([false, true])(
|
||||
expect(markdownStyle.codeBlock?.fontSize).toBe(theme.fontSize.code);
|
||||
},
|
||||
);
|
||||
|
||||
describe("external Markdown", () => {
|
||||
const external = (source: string) => prepareMarkdownSource(source, undefined, { external: true });
|
||||
|
||||
it("recognizes no files, forge references or commands, only https URLs", () => {
|
||||
const { linkRecognition } = external("Needs Node.js 22 and `~/.dsh/.env`, see #12");
|
||||
expect("Needs Node.js 22, see #12".match(linkRecognition.text)).toBeNull();
|
||||
expect(linkRecognition.inlineCode.test("~/.dsh/.env")).toBe(false);
|
||||
expect("Docs at https://example.com/a.".match(linkRecognition.text)).toEqual([
|
||||
"https://example.com/a",
|
||||
]);
|
||||
});
|
||||
|
||||
it("keeps https links and leaves any other destination as its label", () => {
|
||||
expect(
|
||||
external(
|
||||
"[Guide](docs/guide.md), [site](https://example.com), [mail](mailto:a@b.c), [ref][r]\n\n[r]: ./x",
|
||||
).render(),
|
||||
).toBe("Guide, [site](https://example.com), mail, ref\n\n[r]: ./x");
|
||||
});
|
||||
|
||||
it("shows a relative image as its alt text", () => {
|
||||
expect(external(" ").render()).toBe(
|
||||
"Demo ",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
import { useStableEvent } from "@/hooks/use-stable-event";
|
||||
import { matchCommandLink, useAgentCommandHints, type CommandHints } from "@/agent-commands";
|
||||
import { useForgeShorthand } from "@/git/forge-shorthand";
|
||||
import { pluginOverviewUrl } from "@getpaseo/protocol/plugin-overview";
|
||||
import { openExternalUrl } from "@/utils/open-external-url";
|
||||
import { AttachmentLightbox, type ImageLightboxSource } from "@/components/attachment-lightbox";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
@@ -25,8 +24,6 @@ import { MermaidFence, MermaidStreamingContext, splitMermaidFences } from "./fen
|
||||
|
||||
const ThemedMarkdown = withUnistyles(EnrichedMarkdownText);
|
||||
const MD4C_FLAGS = { latexMath: false, hardSoftBreaks: true, admonitions: true };
|
||||
// A README is written for its forge, where the lines of a paragraph join into one.
|
||||
const EXTERNAL_MD4C_FLAGS = { ...MD4C_FLAGS, hardSoftBreaks: false };
|
||||
|
||||
// Reading the breakpoint here makes Unistyles restyle the text when the layout crosses it.
|
||||
const markdownStyle =
|
||||
@@ -55,12 +52,6 @@ export interface MarkdownRendererProps extends MarkdownImageContext {
|
||||
streaming?: boolean;
|
||||
onLinkPress?: (url: string) => unknown;
|
||||
agentCommands?: boolean;
|
||||
/**
|
||||
* Author-controlled Markdown from outside this host, such as a plugin README: only its https
|
||||
* links and images work, nothing is read as a file, forge reference or command, and the lines of
|
||||
* a paragraph join as they do on its forge.
|
||||
*/
|
||||
external?: boolean;
|
||||
}
|
||||
|
||||
/** All Markdown surfaces share the same engine and source adaptation. */
|
||||
@@ -95,14 +86,12 @@ const MarkdownPart = memo(function MarkdownPart({
|
||||
streaming = false,
|
||||
onLinkPress,
|
||||
agentCommands: _agentCommands,
|
||||
external = false,
|
||||
commandHints = null,
|
||||
...imageContext
|
||||
}: MarkdownRendererProps & { commandHints?: CommandHints | null }) {
|
||||
const environment = useAssistantFileLinkEnvironment();
|
||||
const actions = useAssistantFileLinkActions();
|
||||
const workspaceForgeShorthand = useForgeShorthand();
|
||||
const forgeShorthand = external ? null : workspaceForgeShorthand;
|
||||
const forgeShorthand = useForgeShorthand();
|
||||
const client =
|
||||
imageContext.client ??
|
||||
(environment.client?.readFile
|
||||
@@ -116,20 +105,10 @@ const MarkdownPart = memo(function MarkdownPart({
|
||||
...imageContext,
|
||||
client,
|
||||
},
|
||||
{
|
||||
commandNames: commandHints?.names,
|
||||
forgeReferencePattern: forgeShorthand?.pattern,
|
||||
external,
|
||||
},
|
||||
{ commandNames: commandHints?.names, forgeReferencePattern: forgeShorthand?.pattern },
|
||||
);
|
||||
const [image, setImage] = useState<ImageLightboxSource | null>(null);
|
||||
const pressLink = useStableEvent(({ url, sourceType }: LinkPressEvent) => {
|
||||
if (external) {
|
||||
// The parser still autolinks bare http, www and email text; only https links open.
|
||||
const safe = pluginOverviewUrl(url);
|
||||
if (safe) void openExternalUrl(safe);
|
||||
return;
|
||||
}
|
||||
const command = commandHints && matchCommandLink(url, sourceType, commandHints.names);
|
||||
if (command) {
|
||||
commandHints.insert(command);
|
||||
@@ -166,7 +145,7 @@ const MarkdownPart = memo(function MarkdownPart({
|
||||
uniProps={pickMarkdownStyle(compact, muted)}
|
||||
flavor="github"
|
||||
selectable={selectable}
|
||||
md4cFlags={external ? EXTERNAL_MD4C_FLAGS : MD4C_FLAGS}
|
||||
md4cFlags={MD4C_FLAGS}
|
||||
linkRecognition={linkRecognition}
|
||||
enableTaskListItemToggle={false}
|
||||
enableLinkPreview={false}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { pluginOverviewUrl } from "@getpaseo/protocol/plugin-overview";
|
||||
import { classifyAssistantFileLink } from "@/assistant-file-links";
|
||||
import { ASSISTANT_FILE_EXTENSIONS } from "@/assistant-file-links/extensions";
|
||||
import { normalizeMarkdownHtml } from "./html";
|
||||
@@ -37,12 +36,9 @@ function createTextPattern(path: string, forgeReferencePattern?: string): RegExp
|
||||
|
||||
// Matches bare URLs that MD4C does not autolink, like single-label or bracketed hosts.
|
||||
// Quotes and unbalanced closing parentheses end the URL. Trailing sentence punctuation stays outside.
|
||||
// CJK, fullwidth and typographic punctuation (、。,()【】「」“”…) also ends it; CJK letters do not.
|
||||
const URL_BOUNDARY =
|
||||
"\\u2018\\u2019\\u201C\\u201D\\u2026\\u3000-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\uFF01-\\uFF0F\\uFF1A-\\uFF20\\uFF3B-\\uFF40\\uFF5B-\\uFF65";
|
||||
const URL_CHARACTER = String.raw`[^\s<>()"'\x60${URL_BOUNDARY}]`;
|
||||
const URL_CHARACTER = String.raw`[^\s<>()"'\x60]`;
|
||||
const URL_GROUP = String.raw`\(${URL_CHARACTER}*\)`;
|
||||
const BARE_URL = String.raw`https?://(?:${URL_CHARACTER}|${URL_GROUP})*(?:[^\s<>()"'\x60.,;:!?${URL_BOUNDARY}]|${URL_GROUP})`;
|
||||
const BARE_URL = String.raw`https?://(?:${URL_CHARACTER}|${URL_GROUP})*(?:[^\s<>()"'\x60.,;:!?]|${URL_GROUP})`;
|
||||
|
||||
const TEXT_PATTERN = createTextPattern(PROSE_PATH);
|
||||
// One entry per distinct workspace forge remote; reuse keeps the engine's regex identity stable.
|
||||
@@ -57,12 +53,6 @@ function textPattern(forgeReferencePattern?: string): RegExp {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
// External Markdown links only what its author wrote as an https URL.
|
||||
const EXTERNAL_LINKS = {
|
||||
text: new RegExp(BARE_URL.replace("https?", "https"), "g"),
|
||||
inlineCode: /^https:\/\/[^\s<>]+$/,
|
||||
};
|
||||
|
||||
function linkMetadata(inlineCodePaths: ReadonlySet<string>, forgeReferencePattern?: string) {
|
||||
// The engine accepts regexes on both platforms. Classify complete code spans
|
||||
// first, then pass literal matches rather than maintaining a second path grammar.
|
||||
@@ -149,12 +139,6 @@ export function prepareMarkdownSource(
|
||||
commandNames?: ReadonlySet<string>;
|
||||
/** Regex source for forge references such as `#12`; see `@/git/forge-shorthand`. */
|
||||
forgeReferencePattern?: string;
|
||||
/**
|
||||
* Author-controlled Markdown from outside this host, such as a plugin README. It follows the
|
||||
* registry's overview contract: only absolute https links and images, and nothing is
|
||||
* recognized as a file, forge reference or command.
|
||||
*/
|
||||
external?: boolean;
|
||||
} = {},
|
||||
) {
|
||||
source = normalizeMarkdownHtml(source);
|
||||
@@ -165,13 +149,10 @@ export function prepareMarkdownSource(
|
||||
extensions: [gfmTable()],
|
||||
mdastExtensions: [gfmTableFromMarkdown()],
|
||||
}));
|
||||
const external = options.external === true;
|
||||
const metadata = external
|
||||
? { linkRecognition: EXTERNAL_LINKS, linkSource: markdownLinkSource }
|
||||
: linkMetadata(
|
||||
collectInlineCodePaths(source, workspaceRoot, options.commandNames),
|
||||
options.forgeReferencePattern,
|
||||
);
|
||||
const metadata = linkMetadata(
|
||||
collectInlineCodePaths(source, workspaceRoot, options.commandNames),
|
||||
options.forgeReferencePattern,
|
||||
);
|
||||
const edits: { start: number; end: number; text: string }[] = [];
|
||||
if (
|
||||
!source.includes("![") &&
|
||||
@@ -181,8 +162,7 @@ export function prepareMarkdownSource(
|
||||
!/^[\t >]*[^\t >\r\n][^\r\n]*(?:\r\n|\r|\n)[^\r\n]+(?:\r\n|\r|\n)(?=[\t >:|-]*\|)[\t >|]*:?-[-\t :|]*$/m.test(
|
||||
source,
|
||||
) &&
|
||||
!(workspaceRoot && source.includes("](")) &&
|
||||
!(external && /\]|<[a-z]+:/i.test(source))
|
||||
!(workspaceRoot && source.includes("]("))
|
||||
) {
|
||||
return { images, ...metadata, render: () => source };
|
||||
}
|
||||
@@ -201,10 +181,9 @@ export function prepareMarkdownSource(
|
||||
) {
|
||||
const target = node.type === "image" ? node : definitions.get(node.identifier);
|
||||
if (
|
||||
(external && !pluginOverviewUrl(target?.url)) ||
|
||||
(target &&
|
||||
options.supportsSvg === false &&
|
||||
/(?:\.svg(?:[?#]|$)|^data:image\/svg\+xml)/i.test(target.url))
|
||||
target &&
|
||||
options.supportsSvg === false &&
|
||||
/(?:\.svg(?:[?#]|$)|^data:image\/svg\+xml)/i.test(target.url)
|
||||
) {
|
||||
edits.push({ start, end, text: escapeMarkdownText(node.alt ?? "") });
|
||||
return;
|
||||
@@ -257,21 +236,6 @@ export function prepareMarkdownSource(
|
||||
if (lineEnd < end) split(lineEnd);
|
||||
}
|
||||
}
|
||||
// An external link to anything but an https URL keeps its label and loses the brackets and
|
||||
// destination around it, so edits inside the label still apply.
|
||||
function dropUnsafeDestination(node: Nodes, start: number, end: number) {
|
||||
if (node.type !== "link" && node.type !== "linkReference") return;
|
||||
const target = node.type === "link" ? node : definitions.get(node.identifier);
|
||||
if (pluginOverviewUrl(target?.url)) return;
|
||||
const labelStart = node.children[0]?.position?.start.offset;
|
||||
const labelEnd = node.children.at(-1)?.position?.end.offset;
|
||||
if (labelStart === undefined || labelEnd === undefined) {
|
||||
edits.push({ start, end, text: "" });
|
||||
return;
|
||||
}
|
||||
edits.push({ start, end: labelStart, text: "" });
|
||||
edits.push({ start: labelEnd, end, text: "" });
|
||||
}
|
||||
function visit(node: Nodes, previous?: Nodes) {
|
||||
const position = node.position;
|
||||
if (position?.start.offset !== undefined && position.end.offset !== undefined) {
|
||||
@@ -291,7 +255,6 @@ export function prepareMarkdownSource(
|
||||
const boundary = lineStart - newline.length;
|
||||
edits.push({ start: boundary, end: lineStart, text: `${newline}${blank}${newline}` });
|
||||
}
|
||||
if (external) dropUnsafeDestination(node, start, end);
|
||||
if (node.type === "link") {
|
||||
const title = workspaceHoverTitle(node, source.slice(start, end), workspaceRoot);
|
||||
if (title !== null)
|
||||
|
||||
@@ -1562,6 +1562,7 @@ interface ExpandableBadgeProps {
|
||||
style?: StyleProp<ViewStyle>;
|
||||
onToggle?: () => void;
|
||||
onOpenFile?: () => void;
|
||||
onDetailHoverChange?: (hovered: boolean) => void;
|
||||
renderDetails?: () => ReactNode;
|
||||
isLoading?: boolean;
|
||||
isError?: boolean;
|
||||
@@ -1886,6 +1887,7 @@ export const ExpandableBadge = memo(function ExpandableBadge({
|
||||
isExpanded,
|
||||
onToggle,
|
||||
onOpenFile,
|
||||
onDetailHoverChange,
|
||||
renderDetails,
|
||||
isLoading = false,
|
||||
isError = false,
|
||||
@@ -1911,6 +1913,11 @@ export const ExpandableBadge = memo(function ExpandableBadge({
|
||||
}, []);
|
||||
const handlePressIn = useCallback(() => setIsPressed(true), []);
|
||||
const handlePressOut = useCallback(() => setIsPressed(false), []);
|
||||
const handleDetailHoverIn = useCallback(() => onDetailHoverChange?.(true), [onDetailHoverChange]);
|
||||
const handleDetailHoverOut = useCallback(
|
||||
() => onDetailHoverChange?.(false),
|
||||
[onDetailHoverChange],
|
||||
);
|
||||
const handleOpenFilePress = useCallback(
|
||||
(event: GestureResponderEvent) => {
|
||||
event.stopPropagation?.();
|
||||
@@ -2200,9 +2207,14 @@ export const ExpandableBadge = memo(function ExpandableBadge({
|
||||
) : null}
|
||||
</View>
|
||||
{detailContent ? (
|
||||
<View ref={detailWrapperRef} style={detailWrapperStyle}>
|
||||
<Pressable
|
||||
ref={detailWrapperRef}
|
||||
style={detailWrapperStyle}
|
||||
onHoverIn={handleDetailHoverIn}
|
||||
onHoverOut={handleDetailHoverOut}
|
||||
>
|
||||
{detailContent}
|
||||
</View>
|
||||
</Pressable>
|
||||
) : null}
|
||||
</View>
|
||||
);
|
||||
@@ -2222,6 +2234,7 @@ function areExpandableBadgePropsEqual(previous: ExpandableBadgeProps, next: Expa
|
||||
if (previous.testID !== next.testID) return false;
|
||||
if (previous.onToggle !== next.onToggle) return false;
|
||||
if (previous.onOpenFile !== next.onOpenFile) return false;
|
||||
if (previous.onDetailHoverChange !== next.onDetailHoverChange) return false;
|
||||
if (previous.renderDetails !== next.renderDetails) return false;
|
||||
return true;
|
||||
}
|
||||
@@ -2239,6 +2252,7 @@ interface ToolCallProps {
|
||||
metadata?: Record<string, unknown>;
|
||||
isLastInSequence?: boolean;
|
||||
disableOuterSpacing?: boolean;
|
||||
onInlineDetailsHoverChange?: (hovered: boolean) => void;
|
||||
onInlineDetailsExpandedChange?: (expanded: boolean) => void;
|
||||
onOpenFilePath?: (filePath: string) => void;
|
||||
defaultExpanded?: boolean;
|
||||
@@ -2262,6 +2276,7 @@ export const ToolCall = memo(function ToolCall({
|
||||
metadata,
|
||||
isLastInSequence = false,
|
||||
disableOuterSpacing,
|
||||
onInlineDetailsHoverChange,
|
||||
onInlineDetailsExpandedChange,
|
||||
onOpenFilePath,
|
||||
defaultExpanded,
|
||||
@@ -2347,6 +2362,13 @@ export const ToolCall = memo(function ToolCall({
|
||||
presentation.isLoadingDetails,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!onInlineDetailsHoverChange || !shouldRenderInline || isExpanded) {
|
||||
return;
|
||||
}
|
||||
onInlineDetailsHoverChange(false);
|
||||
}, [isExpanded, shouldRenderInline, onInlineDetailsHoverChange]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!onInlineDetailsExpandedChange) {
|
||||
return;
|
||||
@@ -2413,6 +2435,7 @@ export const ToolCall = memo(function ToolCall({
|
||||
isError={status === "failed"}
|
||||
isLastInSequence={isLastInSequence}
|
||||
disableOuterSpacing={disableOuterSpacing}
|
||||
onDetailHoverChange={onInlineDetailsHoverChange}
|
||||
/>
|
||||
);
|
||||
}, areToolCallPropsEqual);
|
||||
|
||||
@@ -19,8 +19,6 @@ interface PageLayoutProps {
|
||||
titleTestID?: string;
|
||||
/** Controls for the whole page: right of the title on desktop, in the back header on compact. */
|
||||
actions?: ReactNode;
|
||||
/** `wide` for pages that lay content out in a grid, such as a gallery. Defaults to a reading column. */
|
||||
width?: "default" | "wide";
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
@@ -35,7 +33,6 @@ export function PageLayout({
|
||||
testID,
|
||||
titleTestID,
|
||||
actions,
|
||||
width = "default",
|
||||
children,
|
||||
}: PageLayoutProps) {
|
||||
const isCompact = useIsCompactFormFactor();
|
||||
@@ -57,7 +54,7 @@ export function PageLayout({
|
||||
contentContainerStyle={scrollContentStyle}
|
||||
testID={testID}
|
||||
>
|
||||
<View style={width === "wide" ? styles.contentWide : styles.content}>
|
||||
<View style={styles.content}>
|
||||
{showTitle ? (
|
||||
<View style={styles.titleRow} testID={titleTestID}>
|
||||
<Text style={styles.title} testID="page-title">
|
||||
@@ -88,13 +85,6 @@ const styles = StyleSheet.create((theme) => ({
|
||||
maxWidth: 720,
|
||||
alignSelf: "center",
|
||||
},
|
||||
contentWide: {
|
||||
padding: theme.spacing[4],
|
||||
paddingTop: theme.spacing[6],
|
||||
width: "100%",
|
||||
maxWidth: 1080,
|
||||
alignSelf: "center",
|
||||
},
|
||||
titleRow: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
ScrollView as RNScrollView,
|
||||
type StyleProp,
|
||||
type ViewStyle,
|
||||
type ScrollViewProps,
|
||||
} from "react-native";
|
||||
import { ScrollView as GHScrollView } from "react-native-gesture-handler";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
@@ -29,25 +28,6 @@ import { isWeb } from "@/constants/platform";
|
||||
|
||||
const ScrollView = isWeb ? RNScrollView : GHScrollView;
|
||||
|
||||
// A capped detail scrolls as a whole. Only full-height sheets need section scrollers.
|
||||
function DetailSectionBody({
|
||||
fillAvailableHeight,
|
||||
style,
|
||||
contentContainerStyle,
|
||||
children,
|
||||
...scrollProps
|
||||
}: ScrollViewProps & { fillAvailableHeight: boolean }) {
|
||||
const bodyStyle = useMemo(() => [style, contentContainerStyle], [style, contentContainerStyle]);
|
||||
if (fillAvailableHeight) {
|
||||
return (
|
||||
<ScrollView {...scrollProps} style={style} contentContainerStyle={contentContainerStyle}>
|
||||
{children}
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
return <View style={bodyStyle}>{children}</View>;
|
||||
}
|
||||
|
||||
// ---- Content Component ----
|
||||
|
||||
interface ToolCallDetailsContentProps {
|
||||
@@ -60,7 +40,6 @@ interface ToolCallDetailsContentProps {
|
||||
}
|
||||
|
||||
interface DetailStyles {
|
||||
fillAvailableHeight: boolean;
|
||||
sectionFillStyle: StyleProp<ViewStyle>;
|
||||
codeBlockFillStyle: StyleProp<ViewStyle>;
|
||||
codeVerticalScrollStyle: StyleProp<ViewStyle>;
|
||||
@@ -70,6 +49,7 @@ interface DetailStyles {
|
||||
jsonScrollErrorCombined: StyleProp<ViewStyle>;
|
||||
fullBleedContainerStyle: StyleProp<ViewStyle>;
|
||||
loadingContainerStyle: StyleProp<ViewStyle>;
|
||||
resolvedMaxHeight: number | undefined;
|
||||
shouldFill: boolean;
|
||||
isFullBleed: boolean;
|
||||
}
|
||||
@@ -89,6 +69,7 @@ function resolveShouldFill(
|
||||
|
||||
function useDetailStyles(
|
||||
detail: ToolCallDetail | undefined,
|
||||
resolvedMaxHeight: number | undefined,
|
||||
fillAvailableHeight: boolean,
|
||||
): DetailStyles {
|
||||
const isFullBleed = resolveIsFullBleed(detail);
|
||||
@@ -104,14 +85,28 @@ function useDetailStyles(
|
||||
[codeBlockStyle, shouldFill],
|
||||
);
|
||||
const codeVerticalScrollStyle = useMemo(
|
||||
() => [styles.codeVerticalScroll, shouldFill && styles.fillHeight],
|
||||
[shouldFill],
|
||||
() => [
|
||||
styles.codeVerticalScroll,
|
||||
resolvedMaxHeight !== undefined && inlineUnistylesStyle({ maxHeight: resolvedMaxHeight }),
|
||||
shouldFill && styles.fillHeight,
|
||||
],
|
||||
[resolvedMaxHeight, shouldFill],
|
||||
);
|
||||
const scrollAreaFillStyle = useMemo(
|
||||
() => [styles.scrollArea, shouldFill && styles.fillHeight],
|
||||
[shouldFill],
|
||||
() => [
|
||||
styles.scrollArea,
|
||||
resolvedMaxHeight !== undefined && inlineUnistylesStyle({ maxHeight: resolvedMaxHeight }),
|
||||
shouldFill && styles.fillHeight,
|
||||
],
|
||||
[resolvedMaxHeight, shouldFill],
|
||||
);
|
||||
const scrollAreaStyle = useMemo(
|
||||
() => [
|
||||
styles.scrollArea,
|
||||
resolvedMaxHeight !== undefined && inlineUnistylesStyle({ maxHeight: resolvedMaxHeight }),
|
||||
],
|
||||
[resolvedMaxHeight],
|
||||
);
|
||||
const scrollAreaStyle = useMemo(() => [styles.scrollArea], []);
|
||||
const jsonScrollCombined = styles.jsonScroll;
|
||||
const jsonScrollErrorCombined = [styles.jsonScroll, styles.jsonScrollError];
|
||||
const fullBleedContainerStyle = useMemo(
|
||||
@@ -127,7 +122,6 @@ function useDetailStyles(
|
||||
);
|
||||
|
||||
return {
|
||||
fillAvailableHeight,
|
||||
sectionFillStyle,
|
||||
codeBlockFillStyle,
|
||||
codeVerticalScrollStyle,
|
||||
@@ -137,6 +131,7 @@ function useDetailStyles(
|
||||
jsonScrollErrorCombined,
|
||||
fullBleedContainerStyle,
|
||||
loadingContainerStyle,
|
||||
resolvedMaxHeight,
|
||||
shouldFill,
|
||||
isFullBleed,
|
||||
};
|
||||
@@ -165,8 +160,7 @@ function ShellDetailSection({ command, output, ds }: ShellDetailProps) {
|
||||
return (
|
||||
<View style={ds.sectionFillStyle}>
|
||||
<View style={ds.codeBlockFillStyle}>
|
||||
<DetailSectionBody
|
||||
fillAvailableHeight={ds.fillAvailableHeight}
|
||||
<ScrollView
|
||||
style={ds.codeVerticalScrollStyle}
|
||||
contentContainerStyle={styles.codeVerticalContent}
|
||||
nestedScrollEnabled
|
||||
@@ -186,7 +180,7 @@ function ShellDetailSection({ command, output, ds }: ShellDetailProps) {
|
||||
</Text>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</DetailSectionBody>
|
||||
</ScrollView>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
@@ -202,7 +196,11 @@ function EditDetailSection({ diffLines, ds }: EditDetailProps) {
|
||||
<View style={ds.sectionFillStyle}>
|
||||
{diffLines ? (
|
||||
<View style={ds.codeBlockFillStyle}>
|
||||
<DiffViewer diffLines={diffLines} fillAvailableHeight={ds.shouldFill} />
|
||||
<DiffViewer
|
||||
diffLines={diffLines}
|
||||
maxHeight={ds.resolvedMaxHeight}
|
||||
fillAvailableHeight={ds.shouldFill}
|
||||
/>
|
||||
</View>
|
||||
) : null}
|
||||
</View>
|
||||
@@ -230,8 +228,7 @@ function ScrollableTextSection({
|
||||
[content, filePath],
|
||||
);
|
||||
const body = (
|
||||
<DetailSectionBody
|
||||
fillAvailableHeight={ds.fillAvailableHeight}
|
||||
<ScrollView
|
||||
style={ds.scrollAreaFillStyle}
|
||||
contentContainerStyle={styles.scrollContent}
|
||||
nestedScrollEnabled
|
||||
@@ -246,7 +243,7 @@ function ScrollableTextSection({
|
||||
</Text>
|
||||
)}
|
||||
</ScrollView>
|
||||
</DetailSectionBody>
|
||||
</ScrollView>
|
||||
);
|
||||
if (!wrapInSectionFill) return body;
|
||||
return <View style={ds.sectionFillStyle}>{body}</View>;
|
||||
@@ -261,8 +258,7 @@ interface FetchDetailProps {
|
||||
function FetchDetailSection({ url, result, ds }: FetchDetailProps) {
|
||||
return (
|
||||
<View style={ds.sectionFillStyle}>
|
||||
<DetailSectionBody
|
||||
fillAvailableHeight={ds.fillAvailableHeight}
|
||||
<ScrollView
|
||||
style={ds.scrollAreaFillStyle}
|
||||
contentContainerStyle={styles.scrollContent}
|
||||
nestedScrollEnabled
|
||||
@@ -273,7 +269,7 @@ function FetchDetailSection({ url, result, ds }: FetchDetailProps) {
|
||||
{result ? `${url}\n\n${result}` : url}
|
||||
</Text>
|
||||
</ScrollView>
|
||||
</DetailSectionBody>
|
||||
</ScrollView>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -281,8 +277,7 @@ function FetchDetailSection({ url, result, ds }: FetchDetailProps) {
|
||||
function ScrollablePlainTextSection({ text, ds }: { text: string; ds: DetailStyles }) {
|
||||
return (
|
||||
<View style={styles.section}>
|
||||
<DetailSectionBody
|
||||
fillAvailableHeight={ds.fillAvailableHeight}
|
||||
<ScrollView
|
||||
style={ds.scrollAreaStyle}
|
||||
contentContainerStyle={styles.scrollContent}
|
||||
nestedScrollEnabled
|
||||
@@ -291,7 +286,7 @@ function ScrollablePlainTextSection({ text, ds }: { text: string; ds: DetailStyl
|
||||
<Text selectable style={styles.plainText}>
|
||||
{text}
|
||||
</Text>
|
||||
</DetailSectionBody>
|
||||
</ScrollView>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -309,8 +304,7 @@ function buildSearchSections(detail: SearchDetail, ds: DetailStyles): ReactNode[
|
||||
if (detail.content) {
|
||||
out.push(
|
||||
<View key="search-content" style={styles.section}>
|
||||
<DetailSectionBody
|
||||
fillAvailableHeight={ds.fillAvailableHeight}
|
||||
<ScrollView
|
||||
style={ds.scrollAreaStyle}
|
||||
contentContainerStyle={styles.scrollContent}
|
||||
nestedScrollEnabled
|
||||
@@ -321,7 +315,7 @@ function buildSearchSections(detail: SearchDetail, ds: DetailStyles): ReactNode[
|
||||
{detail.content}
|
||||
</Text>
|
||||
</ScrollView>
|
||||
</DetailSectionBody>
|
||||
</ScrollView>
|
||||
</View>,
|
||||
);
|
||||
}
|
||||
@@ -554,8 +548,7 @@ export function ToolCallDetailsContent({
|
||||
}: ToolCallDetailsContentProps) {
|
||||
const { t } = useTranslation();
|
||||
const resolvedMaxHeight = fillAvailableHeight ? undefined : (maxHeight ?? 300);
|
||||
// The allowance belongs to the whole disclosure, rather than each section.
|
||||
const ds = useDetailStyles(detail, fillAvailableHeight);
|
||||
const ds = useDetailStyles(detail, resolvedMaxHeight, fillAvailableHeight);
|
||||
const diffLines = useDiffLines(detail);
|
||||
|
||||
const sections: ReactNode[] = buildDetailSections(toolName, detail, diffLines, ds, t);
|
||||
@@ -571,17 +564,6 @@ export function ToolCallDetailsContent({
|
||||
return <Text style={styles.emptyStateText}>{t("toolCallDetails.empty")}</Text>;
|
||||
}
|
||||
|
||||
if (resolvedMaxHeight !== undefined) {
|
||||
return (
|
||||
<ScrollView
|
||||
style={inlineUnistylesStyle({ maxHeight: resolvedMaxHeight })}
|
||||
contentContainerStyle={ds.fullBleedContainerStyle}
|
||||
nestedScrollEnabled
|
||||
>
|
||||
{sections}
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
return <View style={ds.fullBleedContainerStyle}>{sections}</View>;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,10 +126,6 @@ export function smallIconButtonChromeFrameSize(compact = false): number {
|
||||
return ICON_BUTTON_SIZES.small[controlSizingForLayout(compact)];
|
||||
}
|
||||
|
||||
// Icon buttons sit in header and toolbar rows that clip overflow, so the keyboard focus ring
|
||||
// from public/index.html is drawn inside the frame instead of around it.
|
||||
const FOCUS_RING_INSET = -2;
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
large: {
|
||||
width: bySizing(ICON_BUTTON_SIZES.large),
|
||||
@@ -139,7 +135,8 @@ const styles = StyleSheet.create((theme) => ({
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
flexShrink: 0,
|
||||
outlineOffset: FOCUS_RING_INSET,
|
||||
outlineWidth: 0,
|
||||
outlineColor: "transparent",
|
||||
},
|
||||
small: {
|
||||
width: ICON_BUTTON_SIZES.small.pointer,
|
||||
@@ -149,7 +146,8 @@ const styles = StyleSheet.create((theme) => ({
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
flexShrink: 0,
|
||||
outlineOffset: FOCUS_RING_INSET,
|
||||
outlineWidth: 0,
|
||||
outlineColor: "transparent",
|
||||
},
|
||||
smallTouch: {
|
||||
width: ICON_BUTTON_SIZES.small.touch,
|
||||
@@ -159,7 +157,8 @@ const styles = StyleSheet.create((theme) => ({
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
flexShrink: 0,
|
||||
outlineOffset: FOCUS_RING_INSET,
|
||||
outlineWidth: 0,
|
||||
outlineColor: "transparent",
|
||||
},
|
||||
round: {
|
||||
borderRadius: theme.borderRadius.full,
|
||||
|
||||
@@ -43,7 +43,6 @@ vi.mock("@gorhom/portal", () => ({
|
||||
|
||||
/** Every `waitFor` Gorhom received, in render order. Gorhom rebuilds its content pan per value. */
|
||||
const sheetWaitFor = vi.hoisted(() => [] as unknown[]);
|
||||
const sheetSimultaneousHandlers = vi.hoisted(() => [] as unknown[]);
|
||||
|
||||
vi.mock("@gorhom/bottom-sheet", async () => {
|
||||
const { Portal } = await import("@gorhom/portal");
|
||||
@@ -56,17 +55,10 @@ vi.mock("@gorhom/bottom-sheet", async () => {
|
||||
children,
|
||||
stackBehavior,
|
||||
waitFor,
|
||||
simultaneousHandlers,
|
||||
}: {
|
||||
children?: React.ReactNode;
|
||||
stackBehavior?: string;
|
||||
waitFor?: unknown;
|
||||
simultaneousHandlers?: unknown;
|
||||
},
|
||||
}: { children?: React.ReactNode; stackBehavior?: string; waitFor?: unknown },
|
||||
_ref,
|
||||
) => {
|
||||
sheetWaitFor.push(waitFor);
|
||||
sheetSimultaneousHandlers.push(simultaneousHandlers);
|
||||
return React.createElement(
|
||||
Portal,
|
||||
null,
|
||||
@@ -267,7 +259,6 @@ describe("IsolatedBottomSheetModal content drag", () => {
|
||||
document.body.appendChild(container);
|
||||
root = createRoot(container);
|
||||
sheetWaitFor.length = 0;
|
||||
sheetSimultaneousHandlers.length = 0;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -284,19 +275,11 @@ describe("IsolatedBottomSheetModal content drag", () => {
|
||||
return null;
|
||||
}
|
||||
|
||||
function renderSheet(
|
||||
content: React.ReactNode,
|
||||
handlers: Pick<
|
||||
React.ComponentProps<typeof IsolatedBottomSheetModal>,
|
||||
"waitFor" | "simultaneousHandlers"
|
||||
> = {},
|
||||
) {
|
||||
function renderSheet(content: React.ReactNode) {
|
||||
act(() => {
|
||||
root.render(
|
||||
<>
|
||||
<IsolatedBottomSheetModal contextBridge={null} {...handlers}>
|
||||
{content}
|
||||
</IsolatedBottomSheetModal>
|
||||
<IsolatedBottomSheetModal contextBridge={null}>{content}</IsolatedBottomSheetModal>
|
||||
<PortalHostProbe />
|
||||
</>,
|
||||
);
|
||||
@@ -308,106 +291,9 @@ describe("IsolatedBottomSheetModal content drag", () => {
|
||||
expect(sheetWaitFor.at(-1)).toBeUndefined();
|
||||
|
||||
renderSheet(<ContentDrag />);
|
||||
expect(sheetSimultaneousHandlers.at(-1)).toEqual([dragGesture]);
|
||||
expect(sheetWaitFor.at(-1)).toEqual([dragGesture]);
|
||||
expect(sheetWaitFor.at(-1)).toBe(dragGesture);
|
||||
|
||||
renderSheet(null);
|
||||
expect(sheetWaitFor.at(-1)).toBeUndefined();
|
||||
expect(sheetSimultaneousHandlers.at(-1)).toBeUndefined();
|
||||
});
|
||||
|
||||
it.each([false, true])(
|
||||
"preserves supplied relations when a content drag mounts and unmounts (array=%s)",
|
||||
(array) => {
|
||||
const waiting = React.createRef<React.ComponentType>();
|
||||
const simultaneous = React.createRef<React.ComponentType>();
|
||||
const handlers = {
|
||||
waitFor: array ? [waiting] : waiting,
|
||||
simultaneousHandlers: array ? [simultaneous] : simultaneous,
|
||||
};
|
||||
renderSheet(<ContentDrag />, handlers);
|
||||
expect(sheetWaitFor.at(-1)).toEqual([waiting, dragGesture]);
|
||||
expect(sheetSimultaneousHandlers.at(-1)).toEqual([simultaneous, dragGesture]);
|
||||
renderSheet(null, handlers);
|
||||
expect(sheetWaitFor.at(-1)).toBe(handlers.waitFor);
|
||||
expect(sheetSimultaneousHandlers.at(-1)).toBe(handlers.simultaneousHandlers);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
// Load the real vendored implementations at runtime without typechecking Gorhom's entire source
|
||||
// tree (its hooks barrel reaches upstream files that don't compile under the app's TS settings).
|
||||
const gorhomSource = "@gorhom/bottom-sheet/src";
|
||||
const { default: BottomSheetDraggableView } = await import(
|
||||
`${gorhomSource}/components/bottomSheetDraggableView/BottomSheetDraggableView`
|
||||
);
|
||||
const { BottomSheetInternalContext } = await import(`${gorhomSource}/contexts/internal`);
|
||||
const { BottomSheetDraggableContext, BottomSheetGestureHandlersContext } = await import(
|
||||
`${gorhomSource}/contexts/gesture`
|
||||
);
|
||||
const rnghSource = "react-native-gesture-handler/src";
|
||||
const { extractGestureRelations } = await import(
|
||||
`${rnghSource}/handlers/gestures/GestureDetector/utils`
|
||||
);
|
||||
import { Gesture, type GestureType } from "react-native-gesture-handler";
|
||||
|
||||
const noGestureWork = () => {};
|
||||
const gestureHandlerContext = {
|
||||
contentPanGestureHandler: {
|
||||
handleOnStart: noGestureWork,
|
||||
handleOnChange: noGestureWork,
|
||||
handleOnEnd: noGestureWork,
|
||||
handleOnFinalize: noGestureWork,
|
||||
},
|
||||
handlePanGestureHandler: {
|
||||
handleOnStart: noGestureWork,
|
||||
handleOnChange: noGestureWork,
|
||||
handleOnEnd: noGestureWork,
|
||||
handleOnFinalize: noGestureWork,
|
||||
},
|
||||
};
|
||||
function dragInternalContext(relations: SheetContentDragGesture | SheetContentDragGesture[]) {
|
||||
return {
|
||||
enableContentPanningGesture: true,
|
||||
waitFor: relations,
|
||||
simultaneousHandlers: relations,
|
||||
};
|
||||
}
|
||||
|
||||
describe("bottom sheet native drag relations", () => {
|
||||
it.each([false, true])(
|
||||
"resolves both relations through the real content pan (array=%s)",
|
||||
(array) => {
|
||||
const container = document.createElement("div");
|
||||
const root = createRoot(container);
|
||||
const child = Gesture.Pan();
|
||||
child.handlerTag = 42;
|
||||
const ref = { current: child };
|
||||
const relations = array ? [ref] : ref;
|
||||
let resolved: ReturnType<typeof extractGestureRelations> | undefined;
|
||||
const internal = dragInternalContext(relations);
|
||||
function Probe() {
|
||||
const pan = useContext(BottomSheetDraggableContext) as GestureType | null;
|
||||
if (pan) resolved = extractGestureRelations(pan);
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
act(() =>
|
||||
root.render(
|
||||
<BottomSheetInternalContext.Provider value={internal}>
|
||||
<BottomSheetGestureHandlersContext.Provider value={gestureHandlerContext}>
|
||||
<BottomSheetDraggableView>
|
||||
<Probe />
|
||||
</BottomSheetDraggableView>
|
||||
</BottomSheetGestureHandlersContext.Provider>
|
||||
</BottomSheetInternalContext.Provider>,
|
||||
),
|
||||
);
|
||||
expect(resolved?.waitFor).toEqual([42]);
|
||||
expect(resolved?.simultaneousHandlers).toEqual([42]);
|
||||
} finally {
|
||||
act(() => root.unmount());
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@@ -105,8 +105,6 @@ export const IsolatedBottomSheetModal = forwardRef<
|
||||
contextBridge,
|
||||
backdropOpacity,
|
||||
enableDismissOnClose = true,
|
||||
waitFor,
|
||||
simultaneousHandlers,
|
||||
...bottomSheetProps
|
||||
} = props;
|
||||
// State, not a ref the child fills in: Gorhom builds its pan once per `waitFor`, and RNGH reads
|
||||
@@ -117,19 +115,6 @@ export const IsolatedBottomSheetModal = forwardRef<
|
||||
setContentDragGesture(gesture);
|
||||
return () => setContentDragGesture((current) => (current === gesture ? undefined : current));
|
||||
}, []);
|
||||
// RNGH Android's shouldBeCancelledByActiveHandler treats a waiting ancestor's raw ACTIVE
|
||||
// state as ownership and cancels its child at activation. Simultaneity lets the child activate;
|
||||
// waitFor still keeps the sheet stationary until the child fails.
|
||||
const contentDragHandlers = useMemo(() => {
|
||||
if (!contentDragGesture) return { waitFor, simultaneousHandlers };
|
||||
return {
|
||||
waitFor: [...(waitFor ? [waitFor].flat() : []), contentDragGesture],
|
||||
simultaneousHandlers: [
|
||||
...(simultaneousHandlers ? [simultaneousHandlers].flat() : []),
|
||||
contentDragGesture,
|
||||
],
|
||||
};
|
||||
}, [contentDragGesture, waitFor, simultaneousHandlers]);
|
||||
const renderBackdrop = useCallback(
|
||||
(backdropProps: BottomSheetBackdropProps) => (
|
||||
<SheetBackdrop
|
||||
@@ -147,8 +132,7 @@ export const IsolatedBottomSheetModal = forwardRef<
|
||||
enableDismissOnClose={enableDismissOnClose}
|
||||
stackBehavior={presentation}
|
||||
backdropComponent={backdropOpacity === undefined ? undefined : renderBackdrop}
|
||||
waitFor={contentDragHandlers.waitFor}
|
||||
simultaneousHandlers={contentDragHandlers.simultaneousHandlers}
|
||||
waitFor={contentDragGesture}
|
||||
>
|
||||
<BottomSheetScope attachContentDrag={attachContentDrag}>
|
||||
{contextBridge ? contextBridge(children) : children}
|
||||
|
||||
@@ -204,7 +204,7 @@ export interface MessageInputProps {
|
||||
onSubmitLoadingPress?: () => void;
|
||||
/** Intercept key press events before default handling. Return true to prevent default. */
|
||||
onKeyPress?: (event: ComposerKeyPressEvent) => boolean;
|
||||
/** Reports selection updates from user input and programmatic replacements. */
|
||||
/** Reports cursor selection updates from the underlying input. */
|
||||
onSelectionChange?: (selection: { start: number; end: number }) => void;
|
||||
onFocusChange?: (focused: boolean) => void;
|
||||
onHeightChange?: (height: number) => void;
|
||||
@@ -1468,18 +1468,11 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
|
||||
if (nextText === "") {
|
||||
textInputRef.current?.reset();
|
||||
} else {
|
||||
textInputRef.current?.replaceText(nextText, selectionRef.current);
|
||||
textInputRef.current?.replaceText(nextText, selection);
|
||||
}
|
||||
onChangeText(nextText);
|
||||
// iOS does not emit a selection event for a programmatic text replacement.
|
||||
onSelectionChangeCallback?.(selectionRef.current);
|
||||
},
|
||||
[
|
||||
onChangeText,
|
||||
onSelectionChangeCallback,
|
||||
updateComposerHeightForText,
|
||||
updateLiveTextPresence,
|
||||
],
|
||||
[onChangeText, updateComposerHeightForText, updateLiveTextPresence],
|
||||
);
|
||||
|
||||
useLayoutEffect(
|
||||
@@ -2346,6 +2339,7 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
|
||||
<ComposerInputPresentation
|
||||
fullscreen={isFullscreen}
|
||||
controlSizing={controlSizing}
|
||||
sendIconSize={toolbarGlyph.size}
|
||||
surface={textSurface}
|
||||
toolbar={toolbar}
|
||||
send={sendButton}
|
||||
|
||||
@@ -23,13 +23,14 @@ function keepEditorFocused(event: import("react-native").PointerEvent) {
|
||||
/**
|
||||
* One tree for both layout modes. The editing surface keeps its position so the
|
||||
* mounted editor, its native buffer, selection, and focus survive every toggle;
|
||||
* only the chrome around it changes. Fullscreen keeps the exit glyph on the text
|
||||
* rail and Send at the bottom right; a send error sits
|
||||
* only the chrome around it changes. Fullscreen shows exit top right and Send
|
||||
* bottom right, both on the rail the inline Send button uses; a send error sits
|
||||
* in the same footer as Send.
|
||||
*/
|
||||
export function ComposerInputPresentation({
|
||||
fullscreen,
|
||||
controlSizing,
|
||||
sendIconSize,
|
||||
surface,
|
||||
toolbar,
|
||||
send,
|
||||
@@ -46,6 +47,7 @@ export function ComposerInputPresentation({
|
||||
fullscreen: boolean;
|
||||
/** The sizing the toolbar's stylesheet resolves to; see `resolveControlSizing`. */
|
||||
controlSizing: ControlSizing;
|
||||
sendIconSize: number;
|
||||
surface: ReactNode;
|
||||
toolbar: ReactNode;
|
||||
send: ReactNode;
|
||||
@@ -67,6 +69,7 @@ export function ComposerInputPresentation({
|
||||
const glyphSize = iconSizeFor("md")[controlSizing];
|
||||
const railOffset = resolveGlyphRailOffset({
|
||||
controlSize: TOOLBAR_CONTROL_SIZES[controlSizing],
|
||||
sendIconSize,
|
||||
glyphIconSize: glyphSize,
|
||||
});
|
||||
const maximizeIcon = useCallback(
|
||||
@@ -77,8 +80,8 @@ export function ComposerInputPresentation({
|
||||
(color: string) => <Minimize2 color={color} size={glyphSize} />,
|
||||
[glyphSize],
|
||||
);
|
||||
// Fullscreen controls share the text rail; the toolbar disc owns its separate corner inset.
|
||||
const enterStyle = useMemo(() => [styles.enterButton, { right: railOffset }], [railOffset]);
|
||||
// The toolbar row bleeds 6px past the input padding; the inline glyph sits on that edge.
|
||||
const enterStyle = useMemo(() => [styles.enterButton, { right: -6 + railOffset }], [railOffset]);
|
||||
const exitStyle = useMemo(() => [styles.iconButton, { marginRight: railOffset }], [railOffset]);
|
||||
return (
|
||||
<View
|
||||
|
||||
@@ -603,14 +603,12 @@ describe("retained selection", () => {
|
||||
});
|
||||
|
||||
describe("fullscreen glyph rail", () => {
|
||||
it.each([
|
||||
{ controlSize: 28, glyphIconSize: 16 },
|
||||
{ controlSize: 44, glyphIconSize: 20 },
|
||||
])("puts the visible fullscreen edge on the text rail ($controlSize)", (geometry) => {
|
||||
const offset = resolveGlyphRailOffset(geometry);
|
||||
// Maximize2 and Minimize2 reach x21 in a 24-unit viewBox, with a 2-unit stroke.
|
||||
const inkInset =
|
||||
(geometry.controlSize - geometry.glyphIconSize) / 2 + (geometry.glyphIconSize * 2) / 24;
|
||||
expect(offset + inkInset).toBeCloseTo(0);
|
||||
it("nudges 16px fullscreen glyphs onto the Send arrow's ink edge", () => {
|
||||
expect(
|
||||
resolveGlyphRailOffset({ controlSize: 28, sendIconSize: 16, glyphIconSize: 16 }),
|
||||
).toBeCloseTo(4 / 3);
|
||||
expect(
|
||||
resolveGlyphRailOffset({ controlSize: 28, sendIconSize: 20, glyphIconSize: 16 }),
|
||||
).toBeCloseTo(1 / 6);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -234,16 +234,21 @@ export async function stopRealtimeVoice(ctx: StopRealtimeVoiceContext): Promise<
|
||||
}
|
||||
|
||||
/**
|
||||
* Put the fullscreen glyph's visible right edge on the text rail, letting its
|
||||
* hit area extend into the padding. Both Lucide glyphs reach x21 of 24 and use
|
||||
* the default 2-unit stroke (one viewBox unit beyond the path).
|
||||
* Offset that aligns a glyph's visible ink with the Send arrow's ink when both sit in
|
||||
* equal controls on the same right rail. In Lucide's 24px viewBox ArrowUp ends at
|
||||
* x19 while Maximize2/Minimize2 end at x21, so equal boxes leave the fullscreen
|
||||
* glyphs visibly past the arrow.
|
||||
*/
|
||||
export function resolveGlyphRailOffset(input: {
|
||||
controlSize: number;
|
||||
sendIconSize: number;
|
||||
glyphIconSize: number;
|
||||
}): number {
|
||||
const inkInset = (input.controlSize - input.glyphIconSize) / 2 + (2 * input.glyphIconSize) / 24;
|
||||
return -inkInset;
|
||||
const arrowInkInset =
|
||||
(input.controlSize - input.sendIconSize) / 2 + (5 * input.sendIconSize) / 24;
|
||||
const glyphInkInset =
|
||||
(input.controlSize - input.glyphIconSize) / 2 + (3 * input.glyphIconSize) / 24;
|
||||
return arrowInkInset - glyphInkInset;
|
||||
}
|
||||
|
||||
export function resolveComposerSurfaceText(
|
||||
|
||||
@@ -90,16 +90,6 @@ class FakeDaemonClient {
|
||||
cancelDictationStream(dictationId: string): void {
|
||||
this.cancels.push(dictationId);
|
||||
}
|
||||
|
||||
emitStreamError(dictationId: string, error: string): void {
|
||||
const message = {
|
||||
type: "dictation_stream_error",
|
||||
payload: { dictationId, error, retryable: true },
|
||||
} as SessionOutboundMessage;
|
||||
for (const listener of this.rawMessageListeners) {
|
||||
listener(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const tick = async () => {
|
||||
@@ -324,29 +314,6 @@ describe("DictationStreamSender", () => {
|
||||
await expect(finish).resolves.toEqual({ dictationId: "d1", text: "ok" });
|
||||
});
|
||||
|
||||
it("fails finish with the daemon's stream error instead of waiting for acks", async () => {
|
||||
const client = new FakeDaemonClient();
|
||||
client.autoAck = false;
|
||||
let nextId = 0;
|
||||
const sender = new DictationStreamSender({
|
||||
client,
|
||||
format: "audio/pcm;rate=16000;bits=16",
|
||||
createDictationId: () => `d${++nextId}`,
|
||||
});
|
||||
|
||||
sender.enqueueSegment("seg0");
|
||||
await tick();
|
||||
client.emitStreamError("d1", "Local speech worker request timed out: commit");
|
||||
sender.enqueueSegment("seg1");
|
||||
await tick();
|
||||
|
||||
const finish = sender.finish(1);
|
||||
await expect(promiseOutcome(finish, 1000)).resolves.toBe("rejected");
|
||||
await expect(finish).rejects.toThrow("Local speech worker request timed out");
|
||||
expect(client.finishes).toEqual([]);
|
||||
expect(sender.getSegmentCount()).toBe(2);
|
||||
});
|
||||
|
||||
it("does not replay long buffered native dictation in one synchronous burst", async () => {
|
||||
const client = new FakeDaemonClient();
|
||||
client.isConnected = false;
|
||||
|
||||
@@ -8,10 +8,6 @@ const DICTATION_DRAIN_IDLE_TIMEOUT_MS = 30_000;
|
||||
const waitForNextFlushTurn = (): Promise<void> => new Promise((resolve) => setTimeout(resolve, 0));
|
||||
|
||||
type DictationStreamAckMessage = Extract<SessionOutboundMessage, { type: "dictation_stream_ack" }>;
|
||||
type DictationStreamErrorMessage = Extract<
|
||||
SessionOutboundMessage,
|
||||
{ type: "dictation_stream_error" }
|
||||
>;
|
||||
|
||||
interface DrainWaitResult {
|
||||
kind: "signaled" | "timed-out";
|
||||
@@ -68,7 +64,6 @@ export class DictationStreamSender {
|
||||
|
||||
private startGeneration = 0;
|
||||
private startPromise: Promise<void> | null = null;
|
||||
private streamError: Error | null = null;
|
||||
|
||||
constructor(params: DictationStreamSenderParams) {
|
||||
this.format = params.format;
|
||||
@@ -93,11 +88,10 @@ export class DictationStreamSender {
|
||||
}
|
||||
|
||||
this.clientCleanup = client.subscribeRawMessages((message) => {
|
||||
if (message.type === "dictation_stream_ack") {
|
||||
this.handleAck(message);
|
||||
} else if (message.type === "dictation_stream_error") {
|
||||
this.handleStreamError(message);
|
||||
if (message.type !== "dictation_stream_ack") {
|
||||
return;
|
||||
}
|
||||
this.handleAck(message);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -133,7 +127,6 @@ export class DictationStreamSender {
|
||||
this.acknowledgedSeq = -1;
|
||||
this.streamReady = false;
|
||||
this.startPromise = null;
|
||||
this.streamError = null;
|
||||
this.startGeneration += 1;
|
||||
this.resolveDrainWaiters();
|
||||
}
|
||||
@@ -204,7 +197,6 @@ export class DictationStreamSender {
|
||||
this.sendSeq = 0;
|
||||
this.acknowledgedSeq = -1;
|
||||
this.streamReady = false;
|
||||
this.streamError = null;
|
||||
|
||||
const start = (async () => {
|
||||
await client.startDictationStream(dictationId, this.format);
|
||||
@@ -293,25 +285,6 @@ export class DictationStreamSender {
|
||||
this.resolveDrainWaiters();
|
||||
}
|
||||
|
||||
// The daemon drops a stream after an error and answers later chunks with
|
||||
// errors instead of acks, so waiting for delivery can only time out.
|
||||
private handleStreamError(message: DictationStreamErrorMessage): void {
|
||||
if (message.payload.dictationId !== this.dictationId || this.streamError) {
|
||||
return;
|
||||
}
|
||||
this.streamError = new Error(message.payload.error);
|
||||
this.resolveDrainWaiters();
|
||||
}
|
||||
|
||||
private throwStreamError(): void {
|
||||
const error = this.streamError;
|
||||
if (!error) {
|
||||
return;
|
||||
}
|
||||
this.invalidateStream();
|
||||
throw error;
|
||||
}
|
||||
|
||||
private invalidateStream(): void {
|
||||
this.resetStreamForReplay();
|
||||
}
|
||||
@@ -336,13 +309,11 @@ export class DictationStreamSender {
|
||||
|
||||
private async waitForFlushDrain(finalSeq: number): Promise<void> {
|
||||
while (this.hasPendingDelivery(finalSeq)) {
|
||||
this.throwStreamError();
|
||||
const client = this.client;
|
||||
if (!client?.isConnected || !this.dictationId || !this.streamReady) {
|
||||
throw new Error("Failed to flush dictation stream");
|
||||
}
|
||||
const result = await this.waitForDrainSignal();
|
||||
this.throwStreamError();
|
||||
if (result.kind === "timed-out") {
|
||||
this.invalidateStream();
|
||||
throw new Error("Timed out waiting for dictation stream delivery");
|
||||
|
||||
@@ -209,8 +209,6 @@ interface UseGitActionsResult {
|
||||
gitActions: GitActions;
|
||||
branchLabel: string;
|
||||
isGit: boolean;
|
||||
/** Archives this workspace, Git or not. Null while it cannot be archived. */
|
||||
archiveWorkspace: (() => void) | null;
|
||||
}
|
||||
|
||||
interface UseWorkspaceScreenArchiveControllerInput {
|
||||
@@ -268,13 +266,6 @@ function canArchiveWorkspace(
|
||||
);
|
||||
}
|
||||
|
||||
function availableArchive(
|
||||
controller: { canArchive: boolean; isArchiving: boolean },
|
||||
archive: () => void,
|
||||
): (() => void) | null {
|
||||
return controller.canArchive && !controller.isArchiving ? archive : null;
|
||||
}
|
||||
|
||||
function useWorkspaceScreenArchiveController({
|
||||
serverId,
|
||||
activeWorkspaceSelection,
|
||||
@@ -873,12 +864,7 @@ export function useGitActions({ serverId, cwd, icons }: UseGitActionsInput): Use
|
||||
[gitActionsInput, baseRefLabel, hasPullRequest, forge, t],
|
||||
);
|
||||
|
||||
return {
|
||||
gitActions,
|
||||
branchLabel,
|
||||
isGit,
|
||||
archiveWorkspace: availableArchive(archiveController, handleArchiveWorkspace),
|
||||
};
|
||||
return { gitActions, branchLabel, isGit };
|
||||
}
|
||||
|
||||
function translateGitActions(
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { pluginGallery } from "./plugin-gallery";
|
||||
|
||||
export const en = {
|
||||
pluginCombobox: {
|
||||
searching: "Searching…",
|
||||
@@ -2423,7 +2421,6 @@ export const en = {
|
||||
host: "Overview",
|
||||
},
|
||||
plugins: {
|
||||
gallery: pluginGallery.en,
|
||||
title: "Plugins",
|
||||
screens: {
|
||||
open: "Open",
|
||||
@@ -2461,22 +2458,21 @@ export const en = {
|
||||
enabling: "Enabling…",
|
||||
disable: "Disable",
|
||||
disabling: "Disabling…",
|
||||
remove: "Uninstall",
|
||||
removing: "Uninstalling…",
|
||||
remove: "Remove",
|
||||
removing: "Removing…",
|
||||
},
|
||||
feedback: {
|
||||
installed: "Installed {{name}}",
|
||||
reload: "Reloaded {{name}}",
|
||||
enable: "Enabled {{name}}",
|
||||
disable: "Disabled {{name}}",
|
||||
remove: "Uninstalled {{name}}",
|
||||
remove: "Removed {{name}}",
|
||||
kept: "Kept {{name}}",
|
||||
globalEnabled: "Plugins enabled",
|
||||
globalDisabled: "Plugins disabled",
|
||||
},
|
||||
removeConfirmTitle: "Uninstall {{name}}?",
|
||||
removeConfirmMessage: "Its download and settings on this host are deleted.",
|
||||
removeConfirmLocalMessage: "Its settings are deleted. Its folder stays on disk.",
|
||||
removeConfirmTitle: "Remove {{name}}?",
|
||||
removeConfirmMessage: "This removes the configuration. The source directory is not deleted.",
|
||||
states: {
|
||||
offlineTitle: "Plugin host is offline",
|
||||
offlineDescription: "Reconnect to this host to manage its plugins.",
|
||||
|
||||
@@ -1,559 +0,0 @@
|
||||
/** Settings → Plugins: the installed list, the directory and a plugin's page. */
|
||||
export const pluginGallery = {
|
||||
en: {
|
||||
tabs: { installed: "Installed", installedCount: "Installed · {{count}}", browse: "Browse" },
|
||||
search: { installed: "Search installed", browse: "Search plugins", clear: "Clear search" },
|
||||
filters: {
|
||||
category: "Category",
|
||||
allCategories: "All categories",
|
||||
sort: "Sort",
|
||||
popular: "Most installed",
|
||||
recent: "Recently updated",
|
||||
name: "Name",
|
||||
},
|
||||
sections: {
|
||||
updates: "Updates",
|
||||
installed: "Installed",
|
||||
featured: "Featured",
|
||||
all: "All plugins",
|
||||
overview: "Overview",
|
||||
details: "Details",
|
||||
},
|
||||
installs: "{{installs}} installs",
|
||||
installs_one: "{{installs}} install",
|
||||
menu: "More plugin actions",
|
||||
actions: {
|
||||
install: "Install",
|
||||
installing: "Installing…",
|
||||
installed: "Installed",
|
||||
retry: "Retry",
|
||||
update: "Update",
|
||||
updating: "Updating…",
|
||||
updateAll: "Update all",
|
||||
turnOn: "Turn on",
|
||||
turnOnAll: "Turn on plugins",
|
||||
turnOff: "Turn off plugins",
|
||||
installFromSource: "Install from source",
|
||||
submit: "Submit a plugin",
|
||||
repository: "Repository",
|
||||
showMore: "Show more",
|
||||
browse: "Browse plugins",
|
||||
},
|
||||
off: { title: "Plugins are off on {{host}}" },
|
||||
empty: { noMatches: "No plugins match" },
|
||||
directory: {
|
||||
errorTitle: "Unable to load the plugin directory",
|
||||
update: "Update this host to browse plugins",
|
||||
},
|
||||
install: {
|
||||
title: "Install {{name}}?",
|
||||
sourceTitle: "Install from source",
|
||||
author: "Author",
|
||||
source: "Source",
|
||||
version: "Version",
|
||||
warningTitle: "Runs with your access on {{host}}",
|
||||
warningDescription: "Plugins are not sandboxed. Install only code you trust.",
|
||||
turnsOn: "Plugins are not sandboxed. Installing also turns plugins on.",
|
||||
},
|
||||
update: { updated: "{{name}} updated", updatedMany: "{{count}} plugins updated" },
|
||||
details: { license: "License", updated: "Updated", openImage: "Open image" },
|
||||
missing: "This plugin is not installed or listed",
|
||||
},
|
||||
ar: {
|
||||
tabs: { installed: "المثبّتة", installedCount: "المثبّتة · {{count}}", browse: "تصفّح" },
|
||||
search: { installed: "ابحث في المثبّتة", browse: "ابحث عن إضافات", clear: "مسح البحث" },
|
||||
filters: {
|
||||
category: "الفئة",
|
||||
allCategories: "كل الفئات",
|
||||
sort: "الترتيب",
|
||||
popular: "الأكثر تثبيتًا",
|
||||
recent: "المحدّثة مؤخرًا",
|
||||
name: "الاسم",
|
||||
},
|
||||
sections: {
|
||||
updates: "التحديثات",
|
||||
installed: "المثبّتة",
|
||||
featured: "مميّزة",
|
||||
all: "كل الإضافات",
|
||||
overview: "نظرة عامة",
|
||||
details: "التفاصيل",
|
||||
},
|
||||
installs: "{{installs}} تثبيت",
|
||||
installs_one: "{{installs}} تثبيت",
|
||||
menu: "إجراءات أخرى للإضافات",
|
||||
actions: {
|
||||
install: "تثبيت",
|
||||
installing: "جارٍ التثبيت…",
|
||||
installed: "مثبّتة",
|
||||
retry: "إعادة المحاولة",
|
||||
update: "تحديث",
|
||||
updating: "جارٍ التحديث…",
|
||||
updateAll: "تحديث الكل",
|
||||
turnOn: "تشغيل",
|
||||
turnOnAll: "تشغيل الإضافات",
|
||||
turnOff: "إيقاف الإضافات",
|
||||
installFromSource: "التثبيت من مصدر",
|
||||
submit: "إرسال إضافة",
|
||||
repository: "المستودع",
|
||||
showMore: "عرض المزيد",
|
||||
browse: "تصفّح الإضافات",
|
||||
},
|
||||
off: { title: "الإضافات متوقفة على {{host}}" },
|
||||
empty: { noMatches: "لا توجد إضافات مطابقة" },
|
||||
directory: {
|
||||
errorTitle: "تعذّر تحميل دليل الإضافات",
|
||||
update: "حدّث هذا المضيف لتصفّح الإضافات",
|
||||
},
|
||||
install: {
|
||||
title: "تثبيت {{name}}؟",
|
||||
sourceTitle: "التثبيت من مصدر",
|
||||
author: "المؤلف",
|
||||
source: "المصدر",
|
||||
version: "الإصدار",
|
||||
warningTitle: "تعمل بصلاحياتك على {{host}}",
|
||||
warningDescription: "الإضافات غير معزولة. ثبّت فقط التعليمات البرمجية التي تثق بها.",
|
||||
turnsOn: "الإضافات غير معزولة. يؤدي التثبيت أيضًا إلى تشغيل الإضافات.",
|
||||
},
|
||||
update: { updated: "تم تحديث {{name}}", updatedMany: "تم تحديث {{count}} إضافات" },
|
||||
details: { license: "الترخيص", updated: "آخر تحديث", openImage: "فتح الصورة" },
|
||||
missing: "هذه الإضافة غير مثبّتة وغير مدرجة",
|
||||
},
|
||||
es: {
|
||||
tabs: { installed: "Instalados", installedCount: "Instalados · {{count}}", browse: "Explorar" },
|
||||
search: { installed: "Buscar instalados", browse: "Buscar plugins", clear: "Borrar búsqueda" },
|
||||
filters: {
|
||||
category: "Categoría",
|
||||
allCategories: "Todas las categorías",
|
||||
sort: "Orden",
|
||||
popular: "Más instalados",
|
||||
recent: "Actualizados recientemente",
|
||||
name: "Nombre",
|
||||
},
|
||||
sections: {
|
||||
updates: "Actualizaciones",
|
||||
installed: "Instalados",
|
||||
featured: "Destacados",
|
||||
all: "Todos los plugins",
|
||||
overview: "Descripción general",
|
||||
details: "Detalles",
|
||||
},
|
||||
installs: "{{installs}} instalaciones",
|
||||
installs_one: "{{installs}} instalación",
|
||||
menu: "Más acciones de plugins",
|
||||
actions: {
|
||||
install: "Instalar",
|
||||
installing: "Instalando…",
|
||||
installed: "Instalado",
|
||||
retry: "Reintentar",
|
||||
update: "Actualizar",
|
||||
updating: "Actualizando…",
|
||||
updateAll: "Actualizar todo",
|
||||
turnOn: "Activar",
|
||||
turnOnAll: "Activar plugins",
|
||||
turnOff: "Desactivar plugins",
|
||||
installFromSource: "Instalar desde una fuente",
|
||||
submit: "Enviar un plugin",
|
||||
repository: "Repositorio",
|
||||
showMore: "Mostrar más",
|
||||
browse: "Explorar plugins",
|
||||
},
|
||||
off: { title: "Los plugins están desactivados en {{host}}" },
|
||||
empty: { noMatches: "Ningún plugin coincide" },
|
||||
directory: {
|
||||
errorTitle: "No se pudo cargar el directorio de plugins",
|
||||
update: "Actualiza este host para explorar plugins",
|
||||
},
|
||||
install: {
|
||||
title: "¿Instalar {{name}}?",
|
||||
sourceTitle: "Instalar desde una fuente",
|
||||
author: "Autor",
|
||||
source: "Fuente",
|
||||
version: "Versión",
|
||||
warningTitle: "Se ejecuta con tu acceso en {{host}}",
|
||||
warningDescription: "Los plugins no están aislados. Instala solo código de confianza.",
|
||||
turnsOn: "Los plugins no están aislados. Instalar también activa los plugins.",
|
||||
},
|
||||
update: { updated: "{{name}} actualizado", updatedMany: "{{count}} plugins actualizados" },
|
||||
details: { license: "Licencia", updated: "Actualizado", openImage: "Abrir imagen" },
|
||||
missing: "Este plugin no está instalado ni publicado",
|
||||
},
|
||||
fr: {
|
||||
tabs: { installed: "Installés", installedCount: "Installés · {{count}}", browse: "Parcourir" },
|
||||
search: {
|
||||
installed: "Rechercher dans les installés",
|
||||
browse: "Rechercher des plugins",
|
||||
clear: "Effacer la recherche",
|
||||
},
|
||||
filters: {
|
||||
category: "Catégorie",
|
||||
allCategories: "Toutes les catégories",
|
||||
sort: "Tri",
|
||||
popular: "Les plus installés",
|
||||
recent: "Mis à jour récemment",
|
||||
name: "Nom",
|
||||
},
|
||||
sections: {
|
||||
updates: "Mises à jour",
|
||||
installed: "Installés",
|
||||
featured: "À la une",
|
||||
all: "Tous les plugins",
|
||||
overview: "Présentation",
|
||||
details: "Détails",
|
||||
},
|
||||
installs: "{{installs}} installations",
|
||||
installs_one: "{{installs}} installation",
|
||||
menu: "Autres actions sur les plugins",
|
||||
actions: {
|
||||
install: "Installer",
|
||||
installing: "Installation…",
|
||||
installed: "Installé",
|
||||
retry: "Réessayer",
|
||||
update: "Mettre à jour",
|
||||
updating: "Mise à jour…",
|
||||
updateAll: "Tout mettre à jour",
|
||||
turnOn: "Activer",
|
||||
turnOnAll: "Activer les plugins",
|
||||
turnOff: "Désactiver les plugins",
|
||||
installFromSource: "Installer depuis une source",
|
||||
submit: "Proposer un plugin",
|
||||
repository: "Dépôt",
|
||||
showMore: "Afficher plus",
|
||||
browse: "Parcourir les plugins",
|
||||
},
|
||||
off: { title: "Les plugins sont désactivés sur {{host}}" },
|
||||
empty: { noMatches: "Aucun plugin ne correspond" },
|
||||
directory: {
|
||||
errorTitle: "Impossible de charger l’annuaire des plugins",
|
||||
update: "Mettez à jour cet hôte pour parcourir les plugins",
|
||||
},
|
||||
install: {
|
||||
title: "Installer {{name}} ?",
|
||||
sourceTitle: "Installer depuis une source",
|
||||
author: "Auteur",
|
||||
source: "Source",
|
||||
version: "Version",
|
||||
warningTitle: "S’exécute avec vos accès sur {{host}}",
|
||||
warningDescription: "Les plugins ne sont pas isolés. N’installez que du code de confiance.",
|
||||
turnsOn: "Les plugins ne sont pas isolés. L’installation active aussi les plugins.",
|
||||
},
|
||||
update: { updated: "{{name}} mis à jour", updatedMany: "{{count}} plugins mis à jour" },
|
||||
details: { license: "Licence", updated: "Mis à jour", openImage: "Ouvrir l’image" },
|
||||
missing: "Ce plugin n’est ni installé ni publié",
|
||||
},
|
||||
ja: {
|
||||
tabs: {
|
||||
installed: "インストール済み",
|
||||
installedCount: "インストール済み · {{count}}",
|
||||
browse: "見つける",
|
||||
},
|
||||
search: {
|
||||
installed: "インストール済みを検索",
|
||||
browse: "プラグインを検索",
|
||||
clear: "検索をクリア",
|
||||
},
|
||||
filters: {
|
||||
category: "カテゴリ",
|
||||
allCategories: "すべてのカテゴリ",
|
||||
sort: "並び順",
|
||||
popular: "インストール数順",
|
||||
recent: "最近の更新順",
|
||||
name: "名前順",
|
||||
},
|
||||
sections: {
|
||||
updates: "アップデート",
|
||||
installed: "インストール済み",
|
||||
featured: "おすすめ",
|
||||
all: "すべてのプラグイン",
|
||||
overview: "概要",
|
||||
details: "詳細",
|
||||
},
|
||||
installs: "{{installs}} 件のインストール",
|
||||
installs_one: "{{installs}} 件のインストール",
|
||||
menu: "その他のプラグイン操作",
|
||||
actions: {
|
||||
install: "インストール",
|
||||
installing: "インストール中…",
|
||||
installed: "インストール済み",
|
||||
retry: "再試行",
|
||||
update: "アップデート",
|
||||
updating: "アップデート中…",
|
||||
updateAll: "すべてアップデート",
|
||||
turnOn: "オンにする",
|
||||
turnOnAll: "プラグインをオンにする",
|
||||
turnOff: "プラグインをオフにする",
|
||||
installFromSource: "ソースからインストール",
|
||||
submit: "プラグインを申請",
|
||||
repository: "リポジトリ",
|
||||
showMore: "さらに表示",
|
||||
browse: "プラグインを見つける",
|
||||
},
|
||||
off: { title: "{{host}} ではプラグインがオフです" },
|
||||
empty: { noMatches: "一致するプラグインはありません" },
|
||||
directory: {
|
||||
errorTitle: "プラグインディレクトリを読み込めません",
|
||||
update: "プラグインを探すにはこのホストをアップデートしてください",
|
||||
},
|
||||
install: {
|
||||
title: "{{name}} をインストールしますか?",
|
||||
sourceTitle: "ソースからインストール",
|
||||
author: "作者",
|
||||
source: "ソース",
|
||||
version: "バージョン",
|
||||
warningTitle: "{{host}} であなたの権限で動作します",
|
||||
warningDescription:
|
||||
"プラグインはサンドボックス化されていません。信頼できるコードのみインストールしてください。",
|
||||
turnsOn:
|
||||
"プラグインはサンドボックス化されていません。インストールするとプラグインもオンになります。",
|
||||
},
|
||||
update: {
|
||||
updated: "{{name}} をアップデートしました",
|
||||
updatedMany: "{{count}} 個のプラグインをアップデートしました",
|
||||
},
|
||||
details: { license: "ライセンス", updated: "更新日", openImage: "画像を開く" },
|
||||
missing: "このプラグインはインストールも公開もされていません",
|
||||
},
|
||||
ko: {
|
||||
tabs: { installed: "설치됨", installedCount: "설치됨 · {{count}}", browse: "찾아보기" },
|
||||
search: { installed: "설치된 항목 검색", browse: "플러그인 검색", clear: "검색 지우기" },
|
||||
filters: {
|
||||
category: "카테고리",
|
||||
allCategories: "모든 카테고리",
|
||||
sort: "정렬",
|
||||
popular: "설치 많은 순",
|
||||
recent: "최근 업데이트 순",
|
||||
name: "이름순",
|
||||
},
|
||||
sections: {
|
||||
updates: "업데이트",
|
||||
installed: "설치됨",
|
||||
featured: "추천",
|
||||
all: "모든 플러그인",
|
||||
overview: "개요",
|
||||
details: "세부 정보",
|
||||
},
|
||||
installs: "{{installs}}회 설치",
|
||||
installs_one: "{{installs}}회 설치",
|
||||
menu: "기타 플러그인 작업",
|
||||
actions: {
|
||||
install: "설치",
|
||||
installing: "설치 중…",
|
||||
installed: "설치됨",
|
||||
retry: "다시 시도",
|
||||
update: "업데이트",
|
||||
updating: "업데이트 중…",
|
||||
updateAll: "모두 업데이트",
|
||||
turnOn: "켜기",
|
||||
turnOnAll: "플러그인 켜기",
|
||||
turnOff: "플러그인 끄기",
|
||||
installFromSource: "소스에서 설치",
|
||||
submit: "플러그인 제출",
|
||||
repository: "저장소",
|
||||
showMore: "더 보기",
|
||||
browse: "플러그인 찾아보기",
|
||||
},
|
||||
off: { title: "{{host}}에서 플러그인이 꺼져 있습니다" },
|
||||
empty: { noMatches: "일치하는 플러그인이 없습니다" },
|
||||
directory: {
|
||||
errorTitle: "플러그인 디렉터리를 로드할 수 없습니다",
|
||||
update: "플러그인을 찾아보려면 이 호스트를 업데이트하세요",
|
||||
},
|
||||
install: {
|
||||
title: "{{name}}을(를) 설치할까요?",
|
||||
sourceTitle: "소스에서 설치",
|
||||
author: "작성자",
|
||||
source: "소스",
|
||||
version: "버전",
|
||||
warningTitle: "{{host}}에서 사용자 권한으로 실행됩니다",
|
||||
warningDescription: "플러그인은 격리되지 않습니다. 신뢰하는 코드만 설치하세요.",
|
||||
turnsOn: "플러그인은 격리되지 않습니다. 설치하면 플러그인도 켜집니다.",
|
||||
},
|
||||
update: { updated: "{{name}} 업데이트됨", updatedMany: "플러그인 {{count}}개 업데이트됨" },
|
||||
details: { license: "라이선스", updated: "업데이트", openImage: "이미지 열기" },
|
||||
missing: "이 플러그인은 설치되지 않았고 등록되어 있지도 않습니다",
|
||||
},
|
||||
"pt-BR": {
|
||||
tabs: { installed: "Instalados", installedCount: "Instalados · {{count}}", browse: "Explorar" },
|
||||
search: { installed: "Buscar instalados", browse: "Buscar plugins", clear: "Limpar busca" },
|
||||
filters: {
|
||||
category: "Categoria",
|
||||
allCategories: "Todas as categorias",
|
||||
sort: "Ordem",
|
||||
popular: "Mais instalados",
|
||||
recent: "Atualizados recentemente",
|
||||
name: "Nome",
|
||||
},
|
||||
sections: {
|
||||
updates: "Atualizações",
|
||||
installed: "Instalados",
|
||||
featured: "Destaques",
|
||||
all: "Todos os plugins",
|
||||
overview: "Visão geral",
|
||||
details: "Detalhes",
|
||||
},
|
||||
installs: "{{installs}} instalações",
|
||||
installs_one: "{{installs}} instalação",
|
||||
menu: "Mais ações de plugins",
|
||||
actions: {
|
||||
install: "Instalar",
|
||||
installing: "Instalando…",
|
||||
installed: "Instalado",
|
||||
retry: "Tentar novamente",
|
||||
update: "Atualizar",
|
||||
updating: "Atualizando…",
|
||||
updateAll: "Atualizar tudo",
|
||||
turnOn: "Ativar",
|
||||
turnOnAll: "Ativar plugins",
|
||||
turnOff: "Desativar plugins",
|
||||
installFromSource: "Instalar de uma fonte",
|
||||
submit: "Enviar um plugin",
|
||||
repository: "Repositório",
|
||||
showMore: "Mostrar mais",
|
||||
browse: "Explorar plugins",
|
||||
},
|
||||
off: { title: "Os plugins estão desativados em {{host}}" },
|
||||
empty: { noMatches: "Nenhum plugin corresponde" },
|
||||
directory: {
|
||||
errorTitle: "Não foi possível carregar o diretório de plugins",
|
||||
update: "Atualize este host para explorar plugins",
|
||||
},
|
||||
install: {
|
||||
title: "Instalar {{name}}?",
|
||||
sourceTitle: "Instalar de uma fonte",
|
||||
author: "Autor",
|
||||
source: "Fonte",
|
||||
version: "Versão",
|
||||
warningTitle: "Roda com o seu acesso em {{host}}",
|
||||
warningDescription: "Plugins não são isolados. Instale apenas código confiável.",
|
||||
turnsOn: "Plugins não são isolados. Instalar também ativa os plugins.",
|
||||
},
|
||||
update: { updated: "{{name}} atualizado", updatedMany: "{{count}} plugins atualizados" },
|
||||
details: { license: "Licença", updated: "Atualizado", openImage: "Abrir imagem" },
|
||||
missing: "Este plugin não está instalado nem publicado",
|
||||
},
|
||||
ru: {
|
||||
tabs: {
|
||||
installed: "Установленные",
|
||||
installedCount: "Установленные · {{count}}",
|
||||
browse: "Обзор",
|
||||
},
|
||||
search: {
|
||||
installed: "Поиск среди установленных",
|
||||
browse: "Поиск плагинов",
|
||||
clear: "Очистить поиск",
|
||||
},
|
||||
filters: {
|
||||
category: "Категория",
|
||||
allCategories: "Все категории",
|
||||
sort: "Сортировка",
|
||||
popular: "По установкам",
|
||||
recent: "Недавно обновлённые",
|
||||
name: "По названию",
|
||||
},
|
||||
sections: {
|
||||
updates: "Обновления",
|
||||
installed: "Установленные",
|
||||
featured: "Рекомендуемые",
|
||||
all: "Все плагины",
|
||||
overview: "Обзор",
|
||||
details: "Подробности",
|
||||
},
|
||||
installs: "Установок: {{installs}}",
|
||||
installs_one: "Установок: {{installs}}",
|
||||
menu: "Другие действия с плагинами",
|
||||
actions: {
|
||||
install: "Установить",
|
||||
installing: "Установка…",
|
||||
installed: "Установлен",
|
||||
retry: "Повторить",
|
||||
update: "Обновить",
|
||||
updating: "Обновление…",
|
||||
updateAll: "Обновить все",
|
||||
turnOn: "Включить",
|
||||
turnOnAll: "Включить плагины",
|
||||
turnOff: "Выключить плагины",
|
||||
installFromSource: "Установить из источника",
|
||||
submit: "Предложить плагин",
|
||||
repository: "Репозиторий",
|
||||
showMore: "Показать ещё",
|
||||
browse: "Обзор плагинов",
|
||||
},
|
||||
off: { title: "Плагины выключены на {{host}}" },
|
||||
empty: { noMatches: "Нет подходящих плагинов" },
|
||||
directory: {
|
||||
errorTitle: "Не удалось загрузить каталог плагинов",
|
||||
update: "Обновите этот хост, чтобы просматривать плагины",
|
||||
},
|
||||
install: {
|
||||
title: "Установить {{name}}?",
|
||||
sourceTitle: "Установить из источника",
|
||||
author: "Автор",
|
||||
source: "Источник",
|
||||
version: "Версия",
|
||||
warningTitle: "Работает с вашим доступом на {{host}}",
|
||||
warningDescription: "Плагины не изолированы. Устанавливайте только код, которому доверяете.",
|
||||
turnsOn: "Плагины не изолированы. Установка также включит плагины.",
|
||||
},
|
||||
update: { updated: "{{name}} обновлён", updatedMany: "Обновлено плагинов: {{count}}" },
|
||||
details: { license: "Лицензия", updated: "Обновлён", openImage: "Открыть изображение" },
|
||||
missing: "Этот плагин не установлен и не опубликован",
|
||||
},
|
||||
"zh-CN": {
|
||||
tabs: { installed: "已安装", installedCount: "已安装 · {{count}}", browse: "浏览" },
|
||||
search: { installed: "搜索已安装", browse: "搜索插件", clear: "清除搜索" },
|
||||
filters: {
|
||||
category: "分类",
|
||||
allCategories: "全部分类",
|
||||
sort: "排序",
|
||||
popular: "安装最多",
|
||||
recent: "最近更新",
|
||||
name: "名称",
|
||||
},
|
||||
sections: {
|
||||
updates: "更新",
|
||||
installed: "已安装",
|
||||
featured: "精选",
|
||||
all: "全部插件",
|
||||
overview: "概览",
|
||||
details: "详情",
|
||||
},
|
||||
installs: "{{installs}} 次安装",
|
||||
installs_one: "{{installs}} 次安装",
|
||||
menu: "更多插件操作",
|
||||
actions: {
|
||||
install: "安装",
|
||||
installing: "正在安装…",
|
||||
installed: "已安装",
|
||||
retry: "重试",
|
||||
update: "更新",
|
||||
updating: "正在更新…",
|
||||
updateAll: "全部更新",
|
||||
turnOn: "开启",
|
||||
turnOnAll: "开启插件",
|
||||
turnOff: "关闭插件",
|
||||
installFromSource: "从来源安装",
|
||||
submit: "提交插件",
|
||||
repository: "仓库",
|
||||
showMore: "显示更多",
|
||||
browse: "浏览插件",
|
||||
},
|
||||
off: { title: "{{host}} 上的插件已关闭" },
|
||||
empty: { noMatches: "没有匹配的插件" },
|
||||
directory: {
|
||||
errorTitle: "无法加载插件目录",
|
||||
update: "请更新此主机以浏览插件",
|
||||
},
|
||||
install: {
|
||||
title: "安装 {{name}}?",
|
||||
sourceTitle: "从来源安装",
|
||||
author: "作者",
|
||||
source: "来源",
|
||||
version: "版本",
|
||||
warningTitle: "以你在 {{host}} 上的权限运行",
|
||||
warningDescription: "插件没有沙箱隔离。只安装你信任的代码。",
|
||||
turnsOn: "插件没有沙箱隔离。安装后也会开启插件。",
|
||||
},
|
||||
update: { updated: "已更新 {{name}}", updatedMany: "已更新 {{count}} 个插件" },
|
||||
details: { license: "许可证", updated: "更新于", openImage: "打开图片" },
|
||||
missing: "此插件既未安装也未上架",
|
||||
},
|
||||
} as const;
|
||||
@@ -1,5 +1,3 @@
|
||||
import { pluginGallery } from "./plugin-gallery";
|
||||
|
||||
const shared = {
|
||||
logs: {
|
||||
action: "Logs",
|
||||
@@ -15,7 +13,6 @@ const shared = {
|
||||
export const pluginSettings = {
|
||||
ar: {
|
||||
...shared,
|
||||
gallery: pluginGallery.ar,
|
||||
screens: {
|
||||
open: "فتح",
|
||||
offline: "اتصل بهذا المضيف لفتح إعدادات الإضافة.",
|
||||
@@ -44,22 +41,21 @@ export const pluginSettings = {
|
||||
enabling: "جارٍ التفعيل…",
|
||||
disable: "تعطيل",
|
||||
disabling: "جارٍ التعطيل…",
|
||||
remove: "إلغاء التثبيت",
|
||||
removing: "جارٍ إلغاء التثبيت…",
|
||||
remove: "إزالة",
|
||||
removing: "جارٍ الإزالة…",
|
||||
},
|
||||
feedback: {
|
||||
installed: "تم تثبيت {{name}}",
|
||||
reload: "تمت إعادة تحميل {{name}}",
|
||||
enable: "تم تفعيل {{name}}",
|
||||
disable: "تم تعطيل {{name}}",
|
||||
remove: "تم إلغاء تثبيت {{name}}",
|
||||
remove: "تمت إزالة {{name}}",
|
||||
kept: "تم الإبقاء على {{name}}",
|
||||
globalEnabled: "تم تفعيل الإضافات",
|
||||
globalDisabled: "تم تعطيل الإضافات",
|
||||
},
|
||||
removeConfirmTitle: "إلغاء تثبيت {{name}}؟",
|
||||
removeConfirmMessage: "تُحذف نسختها المنزّلة وإعداداتها على هذا المضيف.",
|
||||
removeConfirmLocalMessage: "تُحذف إعداداتها. يبقى مجلدها على القرص.",
|
||||
removeConfirmTitle: "إزالة {{name}}؟",
|
||||
removeConfirmMessage: "يؤدي هذا إلى إزالة الإعداد فقط. لن يُحذف مجلد المصدر.",
|
||||
states: {
|
||||
offlineTitle: "مضيف الإضافات غير متصل",
|
||||
offlineDescription: "أعد الاتصال بهذا المضيف لإدارة إضافاته.",
|
||||
@@ -73,7 +69,6 @@ export const pluginSettings = {
|
||||
},
|
||||
es: {
|
||||
...shared,
|
||||
gallery: pluginGallery.es,
|
||||
screens: {
|
||||
open: "Abrir",
|
||||
offline: "Conéctate a este host para abrir los ajustes del plugin.",
|
||||
@@ -102,22 +97,21 @@ export const pluginSettings = {
|
||||
enabling: "Activando…",
|
||||
disable: "Desactivar",
|
||||
disabling: "Desactivando…",
|
||||
remove: "Desinstalar",
|
||||
removing: "Desinstalando…",
|
||||
remove: "Eliminar",
|
||||
removing: "Eliminando…",
|
||||
},
|
||||
feedback: {
|
||||
installed: "{{name}} instalado",
|
||||
reload: "{{name}} recargado",
|
||||
enable: "{{name}} activado",
|
||||
disable: "{{name}} desactivado",
|
||||
remove: "{{name}} desinstalado",
|
||||
remove: "{{name}} eliminado",
|
||||
kept: "Se conservó {{name}}",
|
||||
globalEnabled: "Plugins activados",
|
||||
globalDisabled: "Plugins desactivados",
|
||||
},
|
||||
removeConfirmTitle: "¿Desinstalar {{name}}?",
|
||||
removeConfirmMessage: "Se borran su descarga y sus ajustes en este host.",
|
||||
removeConfirmLocalMessage: "Se borran sus ajustes. Su carpeta se queda en el disco.",
|
||||
removeConfirmTitle: "¿Eliminar {{name}}?",
|
||||
removeConfirmMessage: "Esto elimina la configuración. El directorio de origen no se borra.",
|
||||
states: {
|
||||
offlineTitle: "El host de plugins está sin conexión",
|
||||
offlineDescription: "Vuelve a conectar este host para gestionar sus plugins.",
|
||||
@@ -131,7 +125,6 @@ export const pluginSettings = {
|
||||
},
|
||||
fr: {
|
||||
...shared,
|
||||
gallery: pluginGallery.fr,
|
||||
screens: {
|
||||
open: "Ouvrir",
|
||||
offline: "Connectez-vous à cet hôte pour ouvrir les paramètres du plugin.",
|
||||
@@ -160,22 +153,21 @@ export const pluginSettings = {
|
||||
enabling: "Activation…",
|
||||
disable: "Désactiver",
|
||||
disabling: "Désactivation…",
|
||||
remove: "Désinstaller",
|
||||
removing: "Désinstallation…",
|
||||
remove: "Supprimer",
|
||||
removing: "Suppression…",
|
||||
},
|
||||
feedback: {
|
||||
installed: "{{name}} installé",
|
||||
reload: "{{name}} rechargé",
|
||||
enable: "{{name}} activé",
|
||||
disable: "{{name}} désactivé",
|
||||
remove: "{{name}} désinstallé",
|
||||
remove: "{{name}} supprimé",
|
||||
kept: "{{name}} conservé",
|
||||
globalEnabled: "Plugins activés",
|
||||
globalDisabled: "Plugins désactivés",
|
||||
},
|
||||
removeConfirmTitle: "Désinstaller {{name}} ?",
|
||||
removeConfirmMessage: "Son téléchargement et ses réglages sur cet hôte sont supprimés.",
|
||||
removeConfirmLocalMessage: "Ses réglages sont supprimés. Son dossier reste sur le disque.",
|
||||
removeConfirmTitle: "Supprimer {{name}} ?",
|
||||
removeConfirmMessage: "La configuration sera supprimée. Le dossier source ne sera pas effacé.",
|
||||
states: {
|
||||
offlineTitle: "L’hôte des plugins est hors ligne",
|
||||
offlineDescription: "Reconnectez cet hôte pour gérer ses plugins.",
|
||||
@@ -189,7 +181,6 @@ export const pluginSettings = {
|
||||
},
|
||||
ja: {
|
||||
...shared,
|
||||
gallery: pluginGallery.ja,
|
||||
screens: {
|
||||
open: "開く",
|
||||
offline: "このホストに接続してプラグイン設定を開いてください。",
|
||||
@@ -218,22 +209,21 @@ export const pluginSettings = {
|
||||
enabling: "有効化中…",
|
||||
disable: "無効化",
|
||||
disabling: "無効化中…",
|
||||
remove: "アンインストール",
|
||||
removing: "アンインストール中…",
|
||||
remove: "削除",
|
||||
removing: "削除中…",
|
||||
},
|
||||
feedback: {
|
||||
installed: "{{name}} をインストールしました",
|
||||
reload: "{{name}} を再読み込みしました",
|
||||
enable: "{{name}} を有効にしました",
|
||||
disable: "{{name}} を無効にしました",
|
||||
remove: "{{name}} をアンインストールしました",
|
||||
remove: "{{name}} を削除しました",
|
||||
kept: "{{name}} を保持しました",
|
||||
globalEnabled: "プラグインを有効にしました",
|
||||
globalDisabled: "プラグインを無効にしました",
|
||||
},
|
||||
removeConfirmTitle: "{{name}} をアンインストールしますか?",
|
||||
removeConfirmMessage: "このホスト上のダウンロードと設定が削除されます。",
|
||||
removeConfirmLocalMessage: "設定が削除されます。フォルダはディスクに残ります。",
|
||||
removeConfirmTitle: "{{name}} を削除しますか?",
|
||||
removeConfirmMessage: "設定のみを削除します。ソースディレクトリは削除されません。",
|
||||
states: {
|
||||
offlineTitle: "プラグインホストはオフラインです",
|
||||
offlineDescription: "プラグインを管理するにはホストに再接続してください。",
|
||||
@@ -247,7 +237,6 @@ export const pluginSettings = {
|
||||
},
|
||||
ko: {
|
||||
...shared,
|
||||
gallery: pluginGallery.ko,
|
||||
screens: {
|
||||
open: "열기",
|
||||
offline: "플러그인 설정을 열려면 이 호스트에 연결하세요.",
|
||||
@@ -289,8 +278,7 @@ export const pluginSettings = {
|
||||
globalDisabled: "플러그인 비활성화됨",
|
||||
},
|
||||
removeConfirmTitle: "{{name}}을(를) 제거할까요?",
|
||||
removeConfirmMessage: "이 호스트의 다운로드와 설정이 삭제됩니다.",
|
||||
removeConfirmLocalMessage: "설정이 삭제됩니다. 폴더는 디스크에 남습니다.",
|
||||
removeConfirmMessage: "설정만 제거합니다. 소스 디렉터리는 삭제되지 않습니다.",
|
||||
states: {
|
||||
offlineTitle: "플러그인 호스트가 오프라인입니다",
|
||||
offlineDescription: "플러그인을 관리하려면 호스트에 다시 연결하세요.",
|
||||
@@ -304,7 +292,6 @@ export const pluginSettings = {
|
||||
},
|
||||
"pt-BR": {
|
||||
...shared,
|
||||
gallery: pluginGallery["pt-BR"],
|
||||
screens: {
|
||||
open: "Abrir",
|
||||
offline: "Conecte-se a este host para abrir as configurações do plugin.",
|
||||
@@ -333,22 +320,21 @@ export const pluginSettings = {
|
||||
enabling: "Ativando…",
|
||||
disable: "Desativar",
|
||||
disabling: "Desativando…",
|
||||
remove: "Desinstalar",
|
||||
removing: "Desinstalando…",
|
||||
remove: "Remover",
|
||||
removing: "Removendo…",
|
||||
},
|
||||
feedback: {
|
||||
installed: "{{name}} instalado",
|
||||
reload: "{{name}} recarregado",
|
||||
enable: "{{name}} ativado",
|
||||
disable: "{{name}} desativado",
|
||||
remove: "{{name}} desinstalado",
|
||||
remove: "{{name}} removido",
|
||||
kept: "{{name}} mantido",
|
||||
globalEnabled: "Plugins ativados",
|
||||
globalDisabled: "Plugins desativados",
|
||||
},
|
||||
removeConfirmTitle: "Desinstalar {{name}}?",
|
||||
removeConfirmMessage: "O download e as configurações neste host são apagados.",
|
||||
removeConfirmLocalMessage: "As configurações são apagadas. A pasta continua no disco.",
|
||||
removeConfirmTitle: "Remover {{name}}?",
|
||||
removeConfirmMessage: "Isso remove a configuração. O diretório de origem não será excluído.",
|
||||
states: {
|
||||
offlineTitle: "O host de plugins está offline",
|
||||
offlineDescription: "Reconecte este host para gerenciar seus plugins.",
|
||||
@@ -362,7 +348,6 @@ export const pluginSettings = {
|
||||
},
|
||||
ru: {
|
||||
...shared,
|
||||
gallery: pluginGallery.ru,
|
||||
screens: {
|
||||
open: "Открыть",
|
||||
offline: "Подключитесь к этому хосту, чтобы открыть настройки плагина.",
|
||||
@@ -405,8 +390,7 @@ export const pluginSettings = {
|
||||
globalDisabled: "Плагины отключены",
|
||||
},
|
||||
removeConfirmTitle: "Удалить {{name}}?",
|
||||
removeConfirmMessage: "Загруженные файлы и настройки на этом хосте будут удалены.",
|
||||
removeConfirmLocalMessage: "Настройки будут удалены. Папка останется на диске.",
|
||||
removeConfirmMessage: "Конфигурация будет удалена. Исходный каталог останется на месте.",
|
||||
states: {
|
||||
offlineTitle: "Хост плагинов не в сети",
|
||||
offlineDescription: "Подключите хост снова, чтобы управлять плагинами.",
|
||||
@@ -420,7 +404,6 @@ export const pluginSettings = {
|
||||
},
|
||||
"zh-CN": {
|
||||
...shared,
|
||||
gallery: pluginGallery["zh-CN"],
|
||||
screens: {
|
||||
open: "打开",
|
||||
offline: "连接到此主机以打开插件设置。",
|
||||
@@ -448,22 +431,21 @@ export const pluginSettings = {
|
||||
enabling: "正在启用…",
|
||||
disable: "禁用",
|
||||
disabling: "正在禁用…",
|
||||
remove: "卸载",
|
||||
removing: "正在卸载…",
|
||||
remove: "移除",
|
||||
removing: "正在移除…",
|
||||
},
|
||||
feedback: {
|
||||
installed: "已安装 {{name}}",
|
||||
reload: "已重新加载 {{name}}",
|
||||
enable: "已启用 {{name}}",
|
||||
disable: "已禁用 {{name}}",
|
||||
remove: "已卸载 {{name}}",
|
||||
remove: "已移除 {{name}}",
|
||||
kept: "已保留 {{name}}",
|
||||
globalEnabled: "插件已启用",
|
||||
globalDisabled: "插件已禁用",
|
||||
},
|
||||
removeConfirmTitle: "卸载 {{name}}?",
|
||||
removeConfirmMessage: "将删除此主机上的下载内容和设置。",
|
||||
removeConfirmLocalMessage: "将删除其设置。文件夹保留在磁盘上。",
|
||||
removeConfirmTitle: "移除 {{name}}?",
|
||||
removeConfirmMessage: "这会移除配置,但不会删除源目录。",
|
||||
states: {
|
||||
offlineTitle: "插件主机离线",
|
||||
offlineDescription: "重新连接此主机以管理其插件。",
|
||||
|
||||
@@ -35,8 +35,7 @@ export function openSettingsFromSidebar(input: {
|
||||
}
|
||||
|
||||
export type SettingsView =
|
||||
| { kind: "plugin"; serverId: string; pluginId: string; screenId?: string }
|
||||
| { kind: "pluginListing"; serverId: string; listingId: string }
|
||||
| { kind: "plugin"; serverId: string; pluginId: string; screenId: string }
|
||||
| { kind: "root" }
|
||||
| { kind: "section"; section: SettingsSectionSlug }
|
||||
| { kind: "host"; serverId: string; section: HostSectionSlug }
|
||||
@@ -62,17 +61,13 @@ export function returnFromSettings(view: SettingsView): void {
|
||||
return;
|
||||
}
|
||||
if (!navigateToLastWorkspace()) {
|
||||
// Detail pages such as a plugin's page are pushed onto Settings; replacing only the top
|
||||
// entry would leave the rest of Settings mounted underneath.
|
||||
if (router.canDismiss()) router.dismissAll();
|
||||
router.replace(buildOpenProjectRoute());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
let parent: Href = buildSettingsRoute();
|
||||
if (view.kind === "plugin" || view.kind === "pluginListing")
|
||||
parent = buildSettingsHostSectionRoute(view.serverId, "plugins");
|
||||
if (view.kind === "plugin") parent = buildSettingsHostSectionRoute(view.serverId, "plugins");
|
||||
if (view.kind === "project") parent = buildProjectsSettingsRoute(view.serverId);
|
||||
router.dismissTo(parent as Href);
|
||||
}
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import type { PluginListItem } from "@getpaseo/protocol/messages";
|
||||
import { useToast } from "@/contexts/toast-api-context";
|
||||
import { useHostRuntimeClient } from "@/runtime/host-runtime";
|
||||
import { pluginDisplayName, pluginListQueryKey } from "@/plugins/plugin-list";
|
||||
import { confirmDialog } from "@/utils/confirm-dialog";
|
||||
import { pluginErrorText } from "./error-text";
|
||||
import { dismissFailedOperation } from "./operations";
|
||||
|
||||
export type PluginAction = "enable" | "disable" | "reload" | "remove";
|
||||
|
||||
/**
|
||||
* Turning a plugin on or off, reloading and removing it. Each action writes its result into the
|
||||
* plugin list, so every row and page showing the plugin agrees. Toggling says nothing; the switch
|
||||
* already shows the result.
|
||||
*/
|
||||
export function usePluginActions(serverId: string) {
|
||||
const { t } = useTranslation();
|
||||
const toast = useToast();
|
||||
const queryClient = useQueryClient();
|
||||
const client = useHostRuntimeClient(serverId);
|
||||
const [pending, setPending] = useState<{ pluginId: string; action: PluginAction } | null>(null);
|
||||
|
||||
const replace = useCallback(
|
||||
(plugin: PluginListItem) =>
|
||||
queryClient.setQueryData<PluginListItem[]>(pluginListQueryKey(serverId), (plugins) =>
|
||||
plugins?.map((candidate) => (candidate.id === plugin.id ? plugin : candidate)),
|
||||
),
|
||||
[queryClient, serverId],
|
||||
);
|
||||
|
||||
const run = useCallback(
|
||||
/** Resolves true once the action is done; false when it was cancelled or failed. */
|
||||
async (action: PluginAction, plugin: PluginListItem): Promise<boolean> => {
|
||||
if (!client) return false;
|
||||
const name = pluginDisplayName(plugin);
|
||||
if (action === "remove") {
|
||||
const confirmed = await confirmDialog({
|
||||
title: t("settings.plugins.removeConfirmTitle", { name }),
|
||||
// A plugin installed from a source has its download deleted; a local folder is kept.
|
||||
message: plugin.installation
|
||||
? t("settings.plugins.removeConfirmMessage")
|
||||
: t("settings.plugins.removeConfirmLocalMessage"),
|
||||
confirmLabel: t("settings.plugins.actions.remove"),
|
||||
destructive: true,
|
||||
});
|
||||
if (!confirmed) return false;
|
||||
}
|
||||
setPending({ pluginId: plugin.id, action });
|
||||
try {
|
||||
if (action === "remove") {
|
||||
await client.removePlugin(plugin.id);
|
||||
// A failed update belonged to this installation, not to a later one with the same ID.
|
||||
dismissFailedOperation(serverId, plugin.id);
|
||||
queryClient.setQueryData<PluginListItem[]>(pluginListQueryKey(serverId), (plugins) =>
|
||||
plugins?.filter((candidate) => candidate.id !== plugin.id),
|
||||
);
|
||||
toast.show(t("settings.plugins.feedback.remove", { name }), { variant: "success" });
|
||||
} else {
|
||||
replace(await client[`${action}Plugin`](plugin.id));
|
||||
if (action === "reload")
|
||||
toast.show(t("settings.plugins.feedback.reload", { name }), { variant: "success" });
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
toast.error(pluginErrorText(error));
|
||||
return false;
|
||||
} finally {
|
||||
setPending(null);
|
||||
}
|
||||
},
|
||||
[client, queryClient, replace, serverId, t, toast],
|
||||
);
|
||||
|
||||
return useMemo(() => ({ run, pending }), [pending, run]);
|
||||
}
|
||||
@@ -1,459 +0,0 @@
|
||||
import { router } from "expo-router";
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Image, ScrollView, Text, View, type PressableStateCallbackType } from "react-native";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import type { PluginListItem } from "@getpaseo/protocol/messages";
|
||||
import type { PluginListingIndex, PluginListing } from "@getpaseo/protocol/plugin-registry";
|
||||
import { SettingsCard, SettingsSection } from "@/components/settings";
|
||||
import { Alert } from "@/components/ui/alert";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem } from "@/components/ui/dropdown-menu";
|
||||
import { DropdownTrigger } from "@/components/ui/dropdown-trigger";
|
||||
import { PressHighlight } from "@/components/ui/press-highlight";
|
||||
import { useIsCompactFormFactor } from "@/constants/layout";
|
||||
import { useContainerWidthBelow } from "@/hooks/use-container-width";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
import { usePluginActions } from "./actions";
|
||||
import { ListingInstallControl } from "./install-control";
|
||||
import {
|
||||
ALL_CATEGORIES,
|
||||
categoryLabel,
|
||||
featuredListings,
|
||||
filterDirectory,
|
||||
formatInstallCount,
|
||||
listingAuthor,
|
||||
listingAuthorAvatar,
|
||||
listingImages,
|
||||
listingText,
|
||||
type DirectorySort,
|
||||
} from "./listing";
|
||||
import { usePluginOperation } from "./operations";
|
||||
import { PluginMeta, PluginRow, PluginTile } from "./plugin-row";
|
||||
import { usePluginDirectory } from "./queries";
|
||||
import { buildPluginListingRoute } from "./routes";
|
||||
import { PluginRowsSkeleton } from "./skeletons";
|
||||
import { pluginErrorText } from "./error-text";
|
||||
|
||||
const SORTS: DirectorySort[] = ["popular", "recent", "name"];
|
||||
// Below this width the featured grid has two columns instead of four.
|
||||
const FEATURED_FOUR_COLUMNS = 760;
|
||||
const LISTING_PAGE = 50;
|
||||
|
||||
/** "author · 1.1k installs". */
|
||||
export function useListingMeta() {
|
||||
const { t } = useTranslation();
|
||||
return useCallback(
|
||||
(listing: PluginListing) =>
|
||||
listing.installs === undefined
|
||||
? listingAuthor(listing)
|
||||
: `${listingAuthor(listing)} · ${t("settings.plugins.gallery.installs", {
|
||||
count: listing.installs,
|
||||
installs: formatInstallCount(listing.installs),
|
||||
})}`,
|
||||
[t],
|
||||
);
|
||||
}
|
||||
|
||||
function ListingRow({
|
||||
serverId,
|
||||
listing,
|
||||
installedPlugin,
|
||||
uninstalling,
|
||||
onInstall,
|
||||
onUninstall,
|
||||
}: {
|
||||
serverId: string;
|
||||
listing: PluginListing;
|
||||
installedPlugin?: PluginListItem;
|
||||
uninstalling: boolean;
|
||||
onInstall(listing: PluginListing): void;
|
||||
onUninstall(plugin: PluginListItem): void;
|
||||
}) {
|
||||
const { i18n } = useTranslation();
|
||||
const meta = useListingMeta();
|
||||
const operation = usePluginOperation(serverId, listing.id);
|
||||
const { name, description } = listingText(listing, i18n.language);
|
||||
const open = useCallback(
|
||||
() => router.push(buildPluginListingRoute(serverId, listing.id)),
|
||||
[listing.id, serverId],
|
||||
);
|
||||
return (
|
||||
<PluginRow
|
||||
name={name}
|
||||
icon={listing.icon}
|
||||
description={description}
|
||||
meta={meta(listing)}
|
||||
authorAvatar={listingAuthorAvatar(listing)}
|
||||
error={!installedPlugin && operation?.status === "failed" ? operation.error : undefined}
|
||||
onPress={open}
|
||||
accessibilityLabel={name}
|
||||
testID={`plugin-listing-${listing.id}`}
|
||||
>
|
||||
<ListingInstallControl
|
||||
listing={listing}
|
||||
installedPlugin={installedPlugin}
|
||||
operation={operation}
|
||||
uninstalling={uninstalling}
|
||||
onInstall={onInstall}
|
||||
onUninstall={onUninstall}
|
||||
/>
|
||||
</PluginRow>
|
||||
);
|
||||
}
|
||||
|
||||
type HoverState = PressableStateCallbackType & { hovered?: boolean };
|
||||
|
||||
function FeaturedCard({ serverId, listing }: { serverId: string; listing: PluginListing }) {
|
||||
const { i18n } = useTranslation();
|
||||
const meta = useListingMeta();
|
||||
const { name, description } = listingText(listing, i18n.language);
|
||||
const image = listingImages(listing)[0];
|
||||
const source = useMemo(() => (image ? { uri: image } : null), [image]);
|
||||
const open = useCallback(
|
||||
() => router.push(buildPluginListingRoute(serverId, listing.id)),
|
||||
[listing.id, serverId],
|
||||
);
|
||||
const cardStyle = useCallback(
|
||||
({ hovered }: HoverState) => [styles.featured, hovered && styles.featuredHovered],
|
||||
[],
|
||||
);
|
||||
return (
|
||||
<PressHighlight
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={name}
|
||||
onPress={open}
|
||||
style={cardStyle}
|
||||
highlightStyle={styles.featuredPressed}
|
||||
testID={`plugin-featured-${listing.id}`}
|
||||
>
|
||||
<View style={styles.media}>
|
||||
{source ? <Image source={source} style={styles.mediaImage} resizeMode="cover" /> : null}
|
||||
</View>
|
||||
<View style={styles.featuredBody}>
|
||||
<View style={styles.featuredTitle}>
|
||||
<PluginTile name={name} icon={listing.icon} />
|
||||
<Text style={styles.featuredName} numberOfLines={1}>
|
||||
{name}
|
||||
</Text>
|
||||
</View>
|
||||
<Text style={styles.featuredDescription} numberOfLines={2}>
|
||||
{description}
|
||||
</Text>
|
||||
<PluginMeta text={meta(listing)} authorAvatar={listingAuthorAvatar(listing)} />
|
||||
</View>
|
||||
</PressHighlight>
|
||||
);
|
||||
}
|
||||
|
||||
/** Every featured listing: a row to swipe on a phone, a grid of four or two columns otherwise. */
|
||||
function Featured({ serverId, listings }: { serverId: string; listings: PluginListing[] }) {
|
||||
const { t } = useTranslation();
|
||||
const compact = useIsCompactFormFactor();
|
||||
const grid = useContainerWidthBelow(FEATURED_FOUR_COLUMNS, { initialIsBelow: false });
|
||||
const cellStyle = grid.isBelow ? styles.cellHalf : styles.cellQuarter;
|
||||
return (
|
||||
<SettingsSection title={t("settings.plugins.gallery.sections.featured")}>
|
||||
{compact ? (
|
||||
<ScrollView
|
||||
horizontal
|
||||
showsHorizontalScrollIndicator={false}
|
||||
contentContainerStyle={styles.featuredRow}
|
||||
>
|
||||
{listings.map((listing) => (
|
||||
<View key={listing.id} style={styles.cellSwipe}>
|
||||
<FeaturedCard serverId={serverId} listing={listing} />
|
||||
</View>
|
||||
))}
|
||||
</ScrollView>
|
||||
) : (
|
||||
<View style={styles.featuredGrid} onLayout={grid.onLayout}>
|
||||
{listings.map((listing) => (
|
||||
<View key={listing.id} style={cellStyle}>
|
||||
<FeaturedCard serverId={serverId} listing={listing} />
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
)}
|
||||
</SettingsSection>
|
||||
);
|
||||
}
|
||||
|
||||
function FilterOption<Value extends string>({
|
||||
option,
|
||||
selected,
|
||||
onChange,
|
||||
}: {
|
||||
option: { value: Value; label: string };
|
||||
selected: boolean;
|
||||
onChange(value: Value): void;
|
||||
}) {
|
||||
const select = useCallback(() => onChange(option.value), [onChange, option.value]);
|
||||
return (
|
||||
<DropdownMenuItem selected={selected} onSelect={select}>
|
||||
{option.label}
|
||||
</DropdownMenuItem>
|
||||
);
|
||||
}
|
||||
|
||||
function FilterMenu<Value extends string>({
|
||||
label,
|
||||
value,
|
||||
options,
|
||||
onChange,
|
||||
testID,
|
||||
}: {
|
||||
label: string;
|
||||
value: Value;
|
||||
options: { value: Value; label: string }[];
|
||||
onChange(value: Value): void;
|
||||
testID: string;
|
||||
}) {
|
||||
const selected = options.find((option) => option.value === value)?.label ?? value;
|
||||
return (
|
||||
<DropdownMenu>
|
||||
<DropdownTrigger
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={`${label}: ${selected}`}
|
||||
testID={testID}
|
||||
>
|
||||
{selected}
|
||||
</DropdownTrigger>
|
||||
<DropdownMenuContent side="bottom" align="start" width={220} sheetTitle={label}>
|
||||
{options.map((option) => (
|
||||
<FilterOption
|
||||
key={option.value}
|
||||
option={option}
|
||||
selected={option.value === value}
|
||||
onChange={onChange}
|
||||
/>
|
||||
))}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The listings in pages: the directory has hundreds, and rendering them all makes switching to
|
||||
* Browse and typing in search lag. A new query, category or sort starts again at the first page.
|
||||
*/
|
||||
function ListingList({
|
||||
serverId,
|
||||
listings,
|
||||
installed,
|
||||
onInstall,
|
||||
}: {
|
||||
serverId: string;
|
||||
listings: PluginListing[];
|
||||
installed: ReadonlyMap<string, PluginListItem>;
|
||||
onInstall(listing: PluginListing): void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const actions = usePluginActions(serverId);
|
||||
const uninstall = useCallback(
|
||||
(plugin: PluginListItem) => void actions.run("remove", plugin),
|
||||
[actions],
|
||||
);
|
||||
const [limit, setLimit] = useState(LISTING_PAGE);
|
||||
const showMore = useCallback(() => setLimit((value) => value + LISTING_PAGE), []);
|
||||
if (!listings.length)
|
||||
return (
|
||||
<SettingsCard testID="plugin-directory-list">
|
||||
<View style={styles.empty}>
|
||||
<Text style={settingsStyles.rowHint}>
|
||||
{t("settings.plugins.gallery.empty.noMatches")}
|
||||
</Text>
|
||||
</View>
|
||||
</SettingsCard>
|
||||
);
|
||||
return (
|
||||
<>
|
||||
<SettingsCard testID="plugin-directory-list">
|
||||
{listings.slice(0, limit).map((listing) => (
|
||||
<ListingRow
|
||||
key={listing.id}
|
||||
serverId={serverId}
|
||||
listing={listing}
|
||||
installedPlugin={installed.get(listing.id)}
|
||||
uninstalling={
|
||||
actions.pending?.action === "remove" &&
|
||||
actions.pending.pluginId === installed.get(listing.id)?.id
|
||||
}
|
||||
onInstall={onInstall}
|
||||
onUninstall={uninstall}
|
||||
/>
|
||||
))}
|
||||
</SettingsCard>
|
||||
{listings.length > limit ? (
|
||||
<View style={styles.more}>
|
||||
<Button variant="outline" onPress={showMore} testID="plugin-directory-more">
|
||||
{t("settings.plugins.gallery.actions.showMore")}
|
||||
</Button>
|
||||
</View>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function Directory({
|
||||
serverId,
|
||||
index,
|
||||
installed,
|
||||
query,
|
||||
onInstall,
|
||||
}: {
|
||||
serverId: string;
|
||||
index: PluginListingIndex;
|
||||
installed: ReadonlyMap<string, PluginListItem>;
|
||||
query: string;
|
||||
onInstall(listing: PluginListing): void;
|
||||
}) {
|
||||
const { t, i18n } = useTranslation();
|
||||
const [category, setCategory] = useState<string>(ALL_CATEGORIES);
|
||||
const [sort, setSort] = useState<DirectorySort>("popular");
|
||||
const listings = filterDirectory(index, { query, category, sort }, i18n.language);
|
||||
const browsing = !query.trim() && category === ALL_CATEGORIES;
|
||||
const featured = browsing ? featuredListings(index) : [];
|
||||
const categoryOptions = useMemo(
|
||||
() => [
|
||||
{ value: ALL_CATEGORIES, label: t("settings.plugins.gallery.filters.allCategories") },
|
||||
...index.categories.map((entry) => ({ value: entry.slug, label: entry.label })),
|
||||
],
|
||||
[index.categories, t],
|
||||
);
|
||||
const sortOptions = useMemo(
|
||||
(): { value: DirectorySort; label: string }[] =>
|
||||
SORTS.map((value) => ({ value, label: t(`settings.plugins.gallery.filters.${value}`) })),
|
||||
[t],
|
||||
);
|
||||
const listTitle =
|
||||
category === ALL_CATEGORIES
|
||||
? t("settings.plugins.gallery.sections.all")
|
||||
: categoryLabel(index, category);
|
||||
return (
|
||||
<>
|
||||
<View style={styles.filters}>
|
||||
<FilterMenu
|
||||
label={t("settings.plugins.gallery.filters.category")}
|
||||
value={category}
|
||||
options={categoryOptions}
|
||||
onChange={setCategory}
|
||||
testID="plugin-category-filter"
|
||||
/>
|
||||
<FilterMenu<DirectorySort>
|
||||
label={t("settings.plugins.gallery.filters.sort")}
|
||||
value={sort}
|
||||
options={sortOptions}
|
||||
onChange={setSort}
|
||||
testID="plugin-sort"
|
||||
/>
|
||||
</View>
|
||||
{featured.length ? <Featured serverId={serverId} listings={featured} /> : null}
|
||||
<SettingsSection title={listTitle}>
|
||||
<ListingList
|
||||
key={`${query}\n${category}\n${sort}`}
|
||||
serverId={serverId}
|
||||
listings={listings}
|
||||
installed={installed}
|
||||
onInstall={onInstall}
|
||||
/>
|
||||
</SettingsSection>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export function BrowseTab({
|
||||
serverId,
|
||||
installed,
|
||||
query,
|
||||
onInstall,
|
||||
}: {
|
||||
serverId: string;
|
||||
/** Installed plugins by the listing they came from. */
|
||||
installed: ReadonlyMap<string, PluginListItem>;
|
||||
query: string;
|
||||
onInstall(listing: PluginListing): void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const directory = usePluginDirectory(serverId);
|
||||
const retry = useCallback(() => void directory.query.refetch(), [directory.query]);
|
||||
if (!directory.supported)
|
||||
return (
|
||||
<Alert size="sm" variant="warning" title={t("settings.plugins.gallery.directory.update")} />
|
||||
);
|
||||
if (directory.query.isError)
|
||||
return (
|
||||
<Alert
|
||||
size="sm"
|
||||
variant="error"
|
||||
title={t("settings.plugins.gallery.directory.errorTitle")}
|
||||
description={pluginErrorText(directory.query.error)}
|
||||
>
|
||||
<Button variant="outline" onPress={retry}>
|
||||
{t("settings.plugins.states.retry")}
|
||||
</Button>
|
||||
</Alert>
|
||||
);
|
||||
if (!directory.query.data) return <PluginRowsSkeleton testID="plugin-directory-loading" />;
|
||||
return (
|
||||
<Directory
|
||||
serverId={serverId}
|
||||
index={directory.query.data}
|
||||
installed={installed}
|
||||
query={query}
|
||||
onInstall={onInstall}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
filters: {
|
||||
flexDirection: "row",
|
||||
flexWrap: "wrap",
|
||||
gap: theme.spacing[2],
|
||||
marginBottom: theme.spacing[6],
|
||||
},
|
||||
featuredRow: { flexDirection: "row", gap: theme.spacing[3] },
|
||||
// Percent widths and a gap would overflow the row, so each cell carries half the gap on each side
|
||||
// and the grid pulls out by the same amount to keep the cards on the section's edges.
|
||||
featuredGrid: {
|
||||
flexDirection: "row",
|
||||
flexWrap: "wrap",
|
||||
marginHorizontal: -theme.spacing[3] / 2,
|
||||
marginBottom: -theme.spacing[3],
|
||||
},
|
||||
cellQuarter: {
|
||||
width: "25%",
|
||||
paddingHorizontal: theme.spacing[3] / 2,
|
||||
marginBottom: theme.spacing[3],
|
||||
},
|
||||
cellHalf: {
|
||||
width: "50%",
|
||||
paddingHorizontal: theme.spacing[3] / 2,
|
||||
marginBottom: theme.spacing[3],
|
||||
},
|
||||
cellSwipe: { width: 260 },
|
||||
featured: {
|
||||
flexGrow: 1,
|
||||
backgroundColor: theme.colors.surface1,
|
||||
borderRadius: theme.borderRadius.lg,
|
||||
borderWidth: 1,
|
||||
borderColor: theme.colors.border,
|
||||
overflow: "hidden",
|
||||
},
|
||||
featuredHovered: { backgroundColor: theme.colors.surface2 },
|
||||
featuredPressed: { backgroundColor: theme.colors.surface3 },
|
||||
media: {
|
||||
aspectRatio: 16 / 10,
|
||||
backgroundColor: theme.colors.surface2,
|
||||
borderBottomWidth: 1,
|
||||
borderBottomColor: theme.colors.border,
|
||||
},
|
||||
mediaImage: { width: "100%", height: "100%" },
|
||||
featuredBody: { padding: theme.spacing[3], gap: theme.spacing[1] },
|
||||
featuredTitle: { flexDirection: "row", alignItems: "center", gap: theme.spacing[2] },
|
||||
featuredName: { flex: 1, color: theme.colors.foreground, fontSize: theme.fontSize.base },
|
||||
featuredDescription: { color: theme.colors.foregroundMuted, fontSize: theme.fontSize.sm },
|
||||
empty: { padding: theme.spacing[6], alignItems: "center" },
|
||||
more: { alignItems: "center", marginTop: theme.spacing[3] },
|
||||
}));
|
||||
@@ -1,19 +0,0 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { pluginErrorText } from "./error-text";
|
||||
|
||||
describe("pluginErrorText", () => {
|
||||
it("shows the daemon's text without the request details an RPC error adds", () => {
|
||||
const rpcError = Object.assign(
|
||||
new Error(
|
||||
"Registry credentials require HTTPS requestType=plugin.registry.list.request code=handler_error",
|
||||
),
|
||||
{ userMessage: "Registry credentials require HTTPS" },
|
||||
);
|
||||
expect(pluginErrorText(rpcError)).toBe("Registry credentials require HTTPS");
|
||||
});
|
||||
|
||||
it("shows any other error's message", () => {
|
||||
expect(pluginErrorText(new Error("Socket closed"))).toBe("Socket closed");
|
||||
expect(pluginErrorText("offline")).toBe("offline");
|
||||
});
|
||||
});
|
||||
@@ -1,9 +0,0 @@
|
||||
/**
|
||||
* What a failed plugin request tells the user. A daemon RPC error keeps the daemon's text in
|
||||
* `userMessage`; its `message` adds the request type and code for logs.
|
||||
*/
|
||||
export function pluginErrorText(error: unknown): string {
|
||||
if (!(error instanceof Error)) return String(error);
|
||||
const userMessage: unknown = Reflect.get(error, "userMessage");
|
||||
return typeof userMessage === "string" ? userMessage : error.message;
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { View } from "react-native";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import type { PluginListing } from "@getpaseo/protocol/plugin-registry";
|
||||
import { Alert } from "@/components/ui/alert";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { SearchField } from "@/components/ui/search-field";
|
||||
import { SegmentedControl } from "@/components/ui/segmented-control";
|
||||
import { useHostFeature } from "@/runtime/host-features";
|
||||
import { useHostRuntimeIsConnected } from "@/runtime/host-runtime";
|
||||
import { useInstalledPlugins } from "@/plugins/registry";
|
||||
import { BrowseTab } from "./browse-tab";
|
||||
import { InstallPluginSheet, type InstallTarget } from "./install-sheet";
|
||||
import { InstalledTab } from "./installed-tab";
|
||||
import { installedByListing } from "./listing";
|
||||
import { PluginsOffAlert } from "./plugins-off-alert";
|
||||
import { useLivePluginList, usePluginDirectory } from "./queries";
|
||||
import { PluginRowsSkeleton } from "./skeletons";
|
||||
import { pluginErrorText } from "./error-text";
|
||||
|
||||
type GalleryTab = "installed" | "browse";
|
||||
|
||||
/**
|
||||
* Settings → Plugins: the plugins on this host and the directory to add more, behind one switch.
|
||||
* Opens on Installed when something is installed, otherwise on Browse.
|
||||
*/
|
||||
export function PluginGalleryPage({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const connected = useHostRuntimeIsConnected(serverId);
|
||||
const supported = useHostFeature(serverId, "pluginManagement");
|
||||
useInstalledPlugins();
|
||||
const plugins = useLivePluginList(serverId);
|
||||
const directory = usePluginDirectory(serverId);
|
||||
const [chosenTab, setChosenTab] = useState<GalleryTab | null>(null);
|
||||
const [query, setQuery] = useState("");
|
||||
const [installTarget, setInstallTarget] = useState<InstallTarget | null>(null);
|
||||
const installed = useMemo(() => plugins.data ?? [], [plugins.data]);
|
||||
// The opening tab is chosen once, so installing the first plugin does not move the user off Browse.
|
||||
if (chosenTab === null && plugins.data)
|
||||
setChosenTab(plugins.data.length === 0 ? "browse" : "installed");
|
||||
const tab: GalleryTab = chosenTab ?? "installed";
|
||||
const byListing = useMemo(() => installedByListing(installed), [installed]);
|
||||
const listings = useMemo(
|
||||
() => new Map((directory.query.data?.plugins ?? []).map((listing) => [listing.id, listing])),
|
||||
[directory.query.data],
|
||||
);
|
||||
const tabs = useMemo(
|
||||
() => [
|
||||
{
|
||||
value: "installed" as const,
|
||||
label: plugins.data
|
||||
? t("settings.plugins.gallery.tabs.installedCount", { count: plugins.data.length })
|
||||
: t("settings.plugins.gallery.tabs.installed"),
|
||||
testID: "plugin-tab-installed",
|
||||
},
|
||||
{
|
||||
value: "browse" as const,
|
||||
label: t("settings.plugins.gallery.tabs.browse"),
|
||||
testID: "plugin-tab-browse",
|
||||
},
|
||||
],
|
||||
[plugins.data, t],
|
||||
);
|
||||
const browse = useCallback(() => setChosenTab("browse"), []);
|
||||
const install = useCallback(
|
||||
(listing: PluginListing) => setInstallTarget({ kind: "listing", listing }),
|
||||
[],
|
||||
);
|
||||
const closeInstall = useCallback(() => setInstallTarget(null), []);
|
||||
const retry = useCallback(() => void plugins.refetch(), [plugins]);
|
||||
|
||||
if (!connected)
|
||||
return (
|
||||
<Alert
|
||||
size="md"
|
||||
variant="warning"
|
||||
title={t("settings.plugins.states.offlineTitle")}
|
||||
description={t("settings.plugins.states.offlineDescription")}
|
||||
/>
|
||||
);
|
||||
if (!supported)
|
||||
return <Alert size="md" variant="warning" title={t("settings.plugins.states.updateTitle")} />;
|
||||
|
||||
let content = <PluginRowsSkeleton testID="plugin-list-loading" />;
|
||||
if (plugins.isError) {
|
||||
content = (
|
||||
<Alert
|
||||
size="sm"
|
||||
variant="error"
|
||||
title={t("settings.plugins.states.errorTitle")}
|
||||
description={pluginErrorText(plugins.error)}
|
||||
>
|
||||
<Button variant="outline" onPress={retry}>
|
||||
{t("settings.plugins.states.retry")}
|
||||
</Button>
|
||||
</Alert>
|
||||
);
|
||||
} else if (plugins.data) {
|
||||
content =
|
||||
tab === "installed" ? (
|
||||
<InstalledTab
|
||||
serverId={serverId}
|
||||
plugins={installed}
|
||||
listings={listings}
|
||||
query={query}
|
||||
onBrowse={browse}
|
||||
/>
|
||||
) : (
|
||||
<BrowseTab serverId={serverId} installed={byListing} query={query} onInstall={install} />
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<View>
|
||||
<View style={styles.toolbar}>
|
||||
<SegmentedControl
|
||||
options={tabs}
|
||||
value={tab}
|
||||
onValueChange={setChosenTab}
|
||||
testID="plugin-tabs"
|
||||
/>
|
||||
<View style={styles.search}>
|
||||
<SearchField
|
||||
value={query}
|
||||
onChangeText={setQuery}
|
||||
placeholder={
|
||||
tab === "installed"
|
||||
? t("settings.plugins.gallery.search.installed")
|
||||
: t("settings.plugins.gallery.search.browse")
|
||||
}
|
||||
clearAccessibilityLabel={t("settings.plugins.gallery.search.clear")}
|
||||
testID="plugin-search"
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
{tab === "installed" ? <PluginsOffAlert serverId={serverId} /> : null}
|
||||
{content}
|
||||
{installTarget ? (
|
||||
<InstallPluginSheet serverId={serverId} target={installTarget} onClose={closeInstall} />
|
||||
) : null}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
toolbar: {
|
||||
flexDirection: "row",
|
||||
flexWrap: "wrap",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[3],
|
||||
marginBottom: theme.spacing[6],
|
||||
},
|
||||
// The search box sits at the end of the row, as on the website, and takes the whole row when the
|
||||
// tabs leave it too little room.
|
||||
search: { flexGrow: 1, flexBasis: 220, flexDirection: "row", justifyContent: "flex-end" },
|
||||
}));
|
||||
@@ -1,4 +0,0 @@
|
||||
export { PluginGalleryPage } from "./gallery-page";
|
||||
export { PluginGalleryMenu } from "./menus";
|
||||
export { PluginPage, type PluginPageSubject } from "./plugin-page";
|
||||
export { buildPluginListingRoute, buildPluginPageRoute } from "./routes";
|
||||
@@ -1,72 +0,0 @@
|
||||
import { useCallback } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import type { PluginListItem } from "@getpaseo/protocol/messages";
|
||||
import type { PluginListing } from "@getpaseo/protocol/plugin-registry";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import type { PluginOperation } from "./operations";
|
||||
|
||||
function useInstallLabel(operation: PluginOperation | undefined): string {
|
||||
const { t } = useTranslation();
|
||||
if (operation?.status === "running") return t("settings.plugins.gallery.actions.installing");
|
||||
if (operation?.status === "failed") return t("settings.plugins.gallery.actions.retry");
|
||||
return t("settings.plugins.gallery.actions.install");
|
||||
}
|
||||
|
||||
/**
|
||||
* A listing's install state where the user is looking: Install, Installing… while it runs, Retry
|
||||
* after a failure (the row or page shows why), and Uninstall once it is on the host. Both ask
|
||||
* before they act.
|
||||
*/
|
||||
export function ListingInstallControl({
|
||||
listing,
|
||||
installedPlugin,
|
||||
operation,
|
||||
uninstalling = false,
|
||||
onInstall,
|
||||
onUninstall,
|
||||
primary = false,
|
||||
}: {
|
||||
listing: PluginListing;
|
||||
/** The plugin this listing installed on the host, when it is installed. */
|
||||
installedPlugin?: PluginListItem;
|
||||
operation: PluginOperation | undefined;
|
||||
uninstalling?: boolean;
|
||||
onInstall(listing: PluginListing): void;
|
||||
onUninstall?(plugin: PluginListItem): void;
|
||||
/** The page's one accent action, on the plugin's own page. */
|
||||
primary?: boolean;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const installLabel = useInstallLabel(operation);
|
||||
const install = useCallback(() => onInstall(listing), [listing, onInstall]);
|
||||
const uninstall = useCallback(() => {
|
||||
if (installedPlugin) onUninstall?.(installedPlugin);
|
||||
}, [installedPlugin, onUninstall]);
|
||||
if (installedPlugin) {
|
||||
const label = uninstalling
|
||||
? t("settings.plugins.actions.removing")
|
||||
: t("settings.plugins.actions.remove");
|
||||
return (
|
||||
<Button
|
||||
variant="outline"
|
||||
onPress={uninstall}
|
||||
loading={uninstalling}
|
||||
accessibilityLabel={`${label} ${listing.name}`}
|
||||
testID={`plugin-uninstall-${listing.id}`}
|
||||
>
|
||||
{label}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Button
|
||||
variant={primary ? "default" : "outline"}
|
||||
onPress={install}
|
||||
loading={operation?.status === "running"}
|
||||
accessibilityLabel={`${installLabel} ${listing.name}`}
|
||||
testID={`plugin-install-${listing.id}`}
|
||||
>
|
||||
{installLabel}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
@@ -1,191 +0,0 @@
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Text, View } from "react-native";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import type { PluginListItem } from "@getpaseo/protocol/messages";
|
||||
import type { PluginListing } from "@getpaseo/protocol/plugin-registry";
|
||||
import { AdaptiveModalSheet, type SheetHeader } from "@/components/adaptive-modal-sheet";
|
||||
import { SettingsCard, SettingsRow } from "@/components/settings";
|
||||
import { Alert } from "@/components/ui/alert";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ExternalLink } from "@/components/ui/external-link";
|
||||
import { Field, FormTextInput } from "@/components/ui/form-field";
|
||||
import { useToast } from "@/contexts/toast-api-context";
|
||||
import { useDaemonConfig } from "@/hooks/use-daemon-config";
|
||||
import { useHostRuntimeClient, useHosts } from "@/runtime/host-runtime";
|
||||
import { pluginDisplayName } from "@/plugins/plugin-list";
|
||||
import { listingAuthor, listingSource, listingText, listingVersion } from "./listing";
|
||||
import { dismissFailedOperation, installPlugin, usePluginOperation } from "./operations";
|
||||
|
||||
const PLUGIN_SOURCE_DOCS_URL = "https://paseo.sh/docs/plugins/reference#plugin-sources";
|
||||
const SOURCE_SUBJECT = "source";
|
||||
|
||||
/** What the sheet installs: a directory listing, or a source the user types. */
|
||||
export type InstallTarget = { kind: "listing"; listing: PluginListing } | { kind: "source" };
|
||||
|
||||
export function useHostLabel(serverId: string): string {
|
||||
const hosts = useHosts();
|
||||
return hosts.find((host) => host.serverId === serverId)?.label ?? serverId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Every install is confirmed here: who made the plugin, where its code comes from, and that it runs
|
||||
* unsandboxed on the host. A listing install closes the sheet and reports on the listing's row; an
|
||||
* install from source has no row, so the sheet stays open until it finishes.
|
||||
*/
|
||||
export function InstallPluginSheet({
|
||||
serverId,
|
||||
target,
|
||||
onClose,
|
||||
}: {
|
||||
serverId: string;
|
||||
target: InstallTarget;
|
||||
onClose(): void;
|
||||
}) {
|
||||
const { t, i18n } = useTranslation();
|
||||
const toast = useToast();
|
||||
const queryClient = useQueryClient();
|
||||
const client = useHostRuntimeClient(serverId);
|
||||
const hostLabel = useHostLabel(serverId);
|
||||
const { config } = useDaemonConfig(serverId);
|
||||
const pluginsOff = config?.pluginsEnabled !== true;
|
||||
const [source, setSource] = useState("");
|
||||
const sourceRun = usePluginOperation(serverId, target.kind === "source" ? SOURCE_SUBJECT : "");
|
||||
const sourceRunning = target.kind === "source" && sourceRun?.status === "running";
|
||||
const close = useCallback(() => {
|
||||
if (target.kind === "source") dismissFailedOperation(serverId, SOURCE_SUBJECT);
|
||||
onClose();
|
||||
}, [onClose, serverId, target.kind]);
|
||||
const name =
|
||||
target.kind === "listing"
|
||||
? listingText(target.listing, i18n.language).name
|
||||
: t("settings.plugins.gallery.install.sourceTitle");
|
||||
|
||||
const onInstalled = useCallback(
|
||||
(plugin: PluginListItem) => {
|
||||
toast.show(t("settings.plugins.feedback.installed", { name: pluginDisplayName(plugin) }), {
|
||||
variant: "success",
|
||||
});
|
||||
},
|
||||
[t, toast],
|
||||
);
|
||||
const confirm = useCallback(() => {
|
||||
if (!client) return;
|
||||
const request = { client, queryClient, serverId, enablePlugins: pluginsOff, onInstalled };
|
||||
if (target.kind === "listing") {
|
||||
void installPlugin({ ...request, source: target.listing.id, subject: target.listing.id });
|
||||
onClose();
|
||||
return;
|
||||
}
|
||||
void installPlugin({
|
||||
...request,
|
||||
source: source.trim(),
|
||||
subject: SOURCE_SUBJECT,
|
||||
onInstalled: (plugin) => {
|
||||
onInstalled(plugin);
|
||||
close();
|
||||
},
|
||||
});
|
||||
}, [client, close, onClose, onInstalled, pluginsOff, queryClient, serverId, source, target]);
|
||||
|
||||
const header = useMemo<SheetHeader>(
|
||||
() => ({
|
||||
title:
|
||||
target.kind === "listing"
|
||||
? t("settings.plugins.gallery.install.title", { name })
|
||||
: t("settings.plugins.gallery.install.sourceTitle"),
|
||||
}),
|
||||
[name, t, target.kind],
|
||||
);
|
||||
// Until the config loads, the sheet cannot say whether installing also turns plugins on.
|
||||
const canInstall =
|
||||
Boolean(client && config) && (target.kind === "listing" || source.trim().length > 0);
|
||||
const footer = useMemo(
|
||||
() => (
|
||||
<View style={styles.actions}>
|
||||
<Button variant="secondary" onPress={close}>
|
||||
{t("common.actions.cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="default"
|
||||
onPress={confirm}
|
||||
disabled={!canInstall}
|
||||
loading={sourceRunning}
|
||||
testID="plugin-install-confirm"
|
||||
>
|
||||
{sourceRunning
|
||||
? t("settings.plugins.gallery.actions.installing")
|
||||
: t("settings.plugins.gallery.actions.install")}
|
||||
</Button>
|
||||
</View>
|
||||
),
|
||||
[canInstall, close, confirm, sourceRunning, t],
|
||||
);
|
||||
const docsLink = useMemo(
|
||||
() => <ExternalLink href={PLUGIN_SOURCE_DOCS_URL} label={t("settings.plugins.docs")} />,
|
||||
[t],
|
||||
);
|
||||
|
||||
return (
|
||||
<AdaptiveModalSheet
|
||||
visible
|
||||
header={header}
|
||||
onClose={close}
|
||||
footer={footer}
|
||||
desktopMaxWidth={480}
|
||||
testID="plugin-install-sheet"
|
||||
>
|
||||
<View style={styles.body}>
|
||||
{target.kind === "listing" ? (
|
||||
<SettingsCard>
|
||||
<SettingsRow label={t("settings.plugins.gallery.install.author")}>
|
||||
<Text style={styles.value}>{listingAuthor(target.listing)}</Text>
|
||||
</SettingsRow>
|
||||
<SettingsRow label={t("settings.plugins.gallery.install.source")}>
|
||||
<Text style={styles.value} numberOfLines={1}>
|
||||
{listingSource(target.listing)}
|
||||
</Text>
|
||||
</SettingsRow>
|
||||
<SettingsRow label={t("settings.plugins.gallery.install.version")}>
|
||||
<Text style={styles.value}>{listingVersion(target.listing)}</Text>
|
||||
</SettingsRow>
|
||||
</SettingsCard>
|
||||
) : (
|
||||
<Field label={t("settings.plugins.sourceLabel")} trailing={docsLink}>
|
||||
<FormTextInput
|
||||
initialValue=""
|
||||
onChangeText={setSource}
|
||||
placeholder={t("settings.plugins.sourcePlaceholder")}
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
autoFocus
|
||||
editable={!sourceRunning}
|
||||
accessibilityLabel={t("settings.plugins.sourceLabel")}
|
||||
testID="plugin-source-input"
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
<Alert
|
||||
size="sm"
|
||||
variant="warning"
|
||||
title={t("settings.plugins.gallery.install.warningTitle", { host: hostLabel })}
|
||||
description={
|
||||
pluginsOff
|
||||
? t("settings.plugins.gallery.install.turnsOn")
|
||||
: t("settings.plugins.gallery.install.warningDescription")
|
||||
}
|
||||
/>
|
||||
{target.kind === "source" && sourceRun?.status === "failed" ? (
|
||||
<Alert size="sm" variant="error" title={sourceRun.error} />
|
||||
) : null}
|
||||
</View>
|
||||
</AdaptiveModalSheet>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
body: { gap: theme.spacing[4] },
|
||||
value: { color: theme.colors.foregroundMuted, fontSize: theme.fontSize.base, maxWidth: 260 },
|
||||
actions: { flex: 1, flexDirection: "row", justifyContent: "flex-end", gap: theme.spacing[2] },
|
||||
}));
|
||||
@@ -1,276 +0,0 @@
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { router } from "expo-router";
|
||||
import { useCallback, useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Text, View } from "react-native";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import type { PluginListItem, PluginUpdatePreview } from "@getpaseo/protocol/messages";
|
||||
import { formatPluginInstallation } from "@getpaseo/protocol/plugin-source-reference";
|
||||
import type { PluginListing } from "@getpaseo/protocol/plugin-registry";
|
||||
import { SettingsCard, SettingsSection } from "@/components/settings";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { StatusBadge } from "@/components/ui/status-badge";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { useToast } from "@/contexts/toast-api-context";
|
||||
import { useHostRuntimeClient } from "@/runtime/host-runtime";
|
||||
import { usePluginEvaluationError } from "@/plugins/registry";
|
||||
import { pluginDisplayName } from "@/plugins/plugin-list";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
import { usePluginActions } from "./actions";
|
||||
import { listingAuthor, listingAuthorAvatar, installedListingId } from "./listing";
|
||||
import { updatePlugins, usePluginOperation } from "./operations";
|
||||
import { PluginRow } from "./plugin-row";
|
||||
import { usePluginUpdates } from "./queries";
|
||||
import { buildPluginPageRoute } from "./routes";
|
||||
|
||||
function shortRevision(revision: string | undefined): string | undefined {
|
||||
return revision && /^[0-9a-f]{40,64}$/.test(revision) ? revision.slice(0, 7) : revision;
|
||||
}
|
||||
|
||||
function matchesQuery(plugin: PluginListItem, query: string): boolean {
|
||||
if (!query) return true;
|
||||
return [plugin.id, plugin.name ?? "", plugin.description ?? ""]
|
||||
.join("\n")
|
||||
.toLowerCase()
|
||||
.includes(query);
|
||||
}
|
||||
|
||||
/** "author · version" for a listed plugin; where it was installed from otherwise. */
|
||||
function installedMeta(plugin: PluginListItem, listing: PluginListing | undefined) {
|
||||
if (!plugin.installation) return plugin.path;
|
||||
if (!listing) return formatPluginInstallation(plugin.installation);
|
||||
const version = shortRevision(plugin.installation.currentRevision);
|
||||
return version ? `${listingAuthor(listing)} · ${version}` : listingAuthor(listing);
|
||||
}
|
||||
|
||||
function useUpdate(serverId: string) {
|
||||
const { t } = useTranslation();
|
||||
const toast = useToast();
|
||||
const queryClient = useQueryClient();
|
||||
const client = useHostRuntimeClient(serverId);
|
||||
return useCallback(
|
||||
(previews: PluginUpdatePreview[]) => {
|
||||
if (!client) return;
|
||||
void updatePlugins({
|
||||
client,
|
||||
queryClient,
|
||||
serverId,
|
||||
proposals: previews.flatMap((preview) => preview.proposal ?? []),
|
||||
onUpdated: (plugins) =>
|
||||
toast.show(
|
||||
plugins.length === 1
|
||||
? t("settings.plugins.gallery.update.updated", {
|
||||
name: pluginDisplayName(plugins[0]!),
|
||||
})
|
||||
: t("settings.plugins.gallery.update.updatedMany", { count: plugins.length }),
|
||||
{ variant: "success" },
|
||||
),
|
||||
});
|
||||
},
|
||||
[client, queryClient, serverId, t, toast],
|
||||
);
|
||||
}
|
||||
|
||||
function UpdateRow({
|
||||
serverId,
|
||||
plugin,
|
||||
preview,
|
||||
listing,
|
||||
onUpdate,
|
||||
}: {
|
||||
serverId: string;
|
||||
plugin: PluginListItem;
|
||||
preview: PluginUpdatePreview;
|
||||
listing?: PluginListing;
|
||||
onUpdate(previews: PluginUpdatePreview[]): void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const operation = usePluginOperation(serverId, plugin.id);
|
||||
const running = operation?.status === "running";
|
||||
const name = pluginDisplayName(plugin);
|
||||
const target =
|
||||
preview.target?.kind === "npm" ? preview.target.version : preview.target?.commit.slice(0, 7);
|
||||
const current = shortRevision(preview.current?.currentRevision);
|
||||
const open = useCallback(
|
||||
() => router.push(buildPluginPageRoute(serverId, plugin.id)),
|
||||
[plugin.id, serverId],
|
||||
);
|
||||
const update = useCallback(() => onUpdate([preview]), [onUpdate, preview]);
|
||||
let label = t("settings.plugins.gallery.actions.update");
|
||||
if (running) label = t("settings.plugins.gallery.actions.updating");
|
||||
else if (operation?.status === "failed") label = t("settings.plugins.gallery.actions.retry");
|
||||
return (
|
||||
<PluginRow
|
||||
name={name}
|
||||
icon={listing?.icon}
|
||||
description={plugin.description ?? listing?.description}
|
||||
meta={current && target ? `${current} → ${target}` : target}
|
||||
error={operation?.status === "failed" ? operation.error : undefined}
|
||||
onPress={open}
|
||||
accessibilityLabel={name}
|
||||
testID={`plugin-update-${plugin.id}`}
|
||||
>
|
||||
<Button variant="outline" onPress={update} loading={running}>
|
||||
{label}
|
||||
</Button>
|
||||
</PluginRow>
|
||||
);
|
||||
}
|
||||
|
||||
function InstalledRow({
|
||||
serverId,
|
||||
plugin,
|
||||
listing,
|
||||
pending,
|
||||
onToggle,
|
||||
}: {
|
||||
serverId: string;
|
||||
plugin: PluginListItem;
|
||||
listing?: PluginListing;
|
||||
pending: boolean;
|
||||
onToggle(plugin: PluginListItem, enabled: boolean): void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const name = pluginDisplayName(plugin);
|
||||
const error = usePluginEvaluationError(serverId, plugin.id) ?? plugin.error;
|
||||
const failed = error !== undefined || plugin.status === "failed";
|
||||
const open = useCallback(
|
||||
() => router.push(buildPluginPageRoute(serverId, plugin.id)),
|
||||
[plugin.id, serverId],
|
||||
);
|
||||
const toggle = useCallback((enabled: boolean) => onToggle(plugin, enabled), [onToggle, plugin]);
|
||||
const badge = useMemo(
|
||||
() =>
|
||||
failed ? (
|
||||
<StatusBadge label={t("settings.plugins.status.failed")} variant="error" size="xs" />
|
||||
) : null,
|
||||
[failed, t],
|
||||
);
|
||||
return (
|
||||
<PluginRow
|
||||
name={name}
|
||||
icon={listing?.icon}
|
||||
badge={badge}
|
||||
description={plugin.description ?? listing?.description}
|
||||
meta={installedMeta(plugin, listing)}
|
||||
authorAvatar={listing && listingAuthorAvatar(listing)}
|
||||
error={error}
|
||||
onPress={open}
|
||||
accessibilityLabel={name}
|
||||
testID={`plugin-row-${plugin.id}`}
|
||||
>
|
||||
<Switch
|
||||
value={plugin.enabled}
|
||||
onValueChange={toggle}
|
||||
disabled={pending}
|
||||
accessibilityLabel={`${name}: ${t(
|
||||
plugin.enabled ? "settings.plugins.actions.disable" : "settings.plugins.actions.enable",
|
||||
)}`}
|
||||
/>
|
||||
</PluginRow>
|
||||
);
|
||||
}
|
||||
|
||||
export function InstalledTab({
|
||||
serverId,
|
||||
plugins,
|
||||
listings,
|
||||
query,
|
||||
onBrowse,
|
||||
}: {
|
||||
serverId: string;
|
||||
plugins: readonly PluginListItem[];
|
||||
/** Directory listings by ID, for icons and authors. Empty until the directory loads. */
|
||||
listings: ReadonlyMap<string, PluginListing>;
|
||||
query: string;
|
||||
onBrowse(): void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const actions = usePluginActions(serverId);
|
||||
const updates = usePluginUpdates(serverId);
|
||||
const update = useUpdate(serverId);
|
||||
const normalizedQuery = query.trim().toLowerCase();
|
||||
const shown = plugins.filter((plugin) => matchesQuery(plugin, normalizedQuery));
|
||||
const byId = new Map(plugins.map((plugin) => [plugin.id, plugin]));
|
||||
const pendingUpdates = (updates.data ?? []).filter((preview) => byId.has(preview.id));
|
||||
const listingOf = (plugin: PluginListItem) => {
|
||||
const id = installedListingId(plugin);
|
||||
return id ? listings.get(id) : undefined;
|
||||
};
|
||||
const toggle = useCallback(
|
||||
(plugin: PluginListItem, enabled: boolean) =>
|
||||
void actions.run(enabled ? "enable" : "disable", plugin),
|
||||
[actions],
|
||||
);
|
||||
const updateAll = useCallback(() => update(pendingUpdates), [pendingUpdates, update]);
|
||||
const updatesTrailing = useMemo(
|
||||
() =>
|
||||
pendingUpdates.length > 1 ? (
|
||||
<Button variant="ghost" onPress={updateAll}>
|
||||
{t("settings.plugins.gallery.actions.updateAll")}
|
||||
</Button>
|
||||
) : undefined,
|
||||
[pendingUpdates.length, t, updateAll],
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
{pendingUpdates.length > 0 && !normalizedQuery ? (
|
||||
<SettingsSection
|
||||
title={t("settings.plugins.gallery.sections.updates")}
|
||||
trailing={updatesTrailing}
|
||||
testID="plugin-updates"
|
||||
>
|
||||
<SettingsCard>
|
||||
{pendingUpdates.map((preview) => {
|
||||
const plugin = byId.get(preview.id)!;
|
||||
return (
|
||||
<UpdateRow
|
||||
key={preview.id}
|
||||
serverId={serverId}
|
||||
plugin={plugin}
|
||||
preview={preview}
|
||||
listing={listingOf(plugin)}
|
||||
onUpdate={update}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</SettingsCard>
|
||||
</SettingsSection>
|
||||
) : null}
|
||||
<SettingsSection title={t("settings.plugins.gallery.sections.installed")}>
|
||||
<SettingsCard testID="plugin-installed-list">
|
||||
{shown.length ? (
|
||||
shown.map((plugin) => (
|
||||
<InstalledRow
|
||||
key={plugin.id}
|
||||
serverId={serverId}
|
||||
plugin={plugin}
|
||||
listing={listingOf(plugin)}
|
||||
pending={actions.pending?.pluginId === plugin.id}
|
||||
onToggle={toggle}
|
||||
/>
|
||||
))
|
||||
) : (
|
||||
<View style={styles.empty}>
|
||||
<Text style={settingsStyles.rowHint}>
|
||||
{normalizedQuery
|
||||
? t("settings.plugins.gallery.empty.noMatches")
|
||||
: t("settings.plugins.states.empty")}
|
||||
</Text>
|
||||
{normalizedQuery ? null : (
|
||||
<Button variant="outline" onPress={onBrowse}>
|
||||
{t("settings.plugins.gallery.actions.browse")}
|
||||
</Button>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
</SettingsCard>
|
||||
</SettingsSection>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
empty: { padding: theme.spacing[6], alignItems: "center", gap: theme.spacing[3] },
|
||||
}));
|
||||
@@ -1,121 +0,0 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { PluginListingIndex, PluginListing } from "@getpaseo/protocol/plugin-registry";
|
||||
import {
|
||||
ALL_CATEGORIES,
|
||||
featuredListings,
|
||||
filterDirectory,
|
||||
formatInstallCount,
|
||||
listingImages,
|
||||
listingText,
|
||||
} from "./listing";
|
||||
|
||||
function listing(id: string, overrides: Partial<PluginListing> = {}): PluginListing {
|
||||
return {
|
||||
id,
|
||||
name: id.split("/")[1] ?? id,
|
||||
description: `${id} description`,
|
||||
categories: [],
|
||||
author: { github: id.split("/")[0] ?? id },
|
||||
repository: { url: `https://github.com/${id}` },
|
||||
artifact: { kind: "git", remote: `https://github.com/${id}.git`, commit: "a".repeat(40) },
|
||||
media: [],
|
||||
submittedAt: "2026-01-01T00:00:00Z",
|
||||
reviewedAt: "2026-01-01T00:00:00Z",
|
||||
updatedAt: "2026-01-01T00:00:00Z",
|
||||
publishedAt: "2026-01-01T00:00:00Z",
|
||||
...overrides,
|
||||
} as PluginListing;
|
||||
}
|
||||
|
||||
function directory(plugins: PluginListing[], featured: string[] = []): PluginListingIndex {
|
||||
return {
|
||||
schemaVersion: 1,
|
||||
registry: { name: "Paseo", url: "https://plugins.paseo.sh" },
|
||||
categories: [{ slug: "git", label: "Git" }],
|
||||
plugins,
|
||||
featured,
|
||||
generatedAt: "2026-01-01T00:00:00Z",
|
||||
};
|
||||
}
|
||||
|
||||
const ids = (listings: PluginListing[]) => listings.map((entry) => entry.id);
|
||||
|
||||
describe("filterDirectory", () => {
|
||||
const index = directory([
|
||||
listing("acme/zeta", { installs: 5, updatedAt: "2026-03-01T00:00:00Z", categories: ["git"] }),
|
||||
listing("acme/alpha", { installs: 50, updatedAt: "2026-01-01T00:00:00Z" }),
|
||||
listing("other/beta", {
|
||||
updatedAt: "2026-02-01T00:00:00Z",
|
||||
translations: { fr: { name: "Bêta", description: "Revue de code" } },
|
||||
}),
|
||||
]);
|
||||
|
||||
it("orders by installs, recency or name", () => {
|
||||
const all = { query: "", category: ALL_CATEGORIES };
|
||||
expect(ids(filterDirectory(index, { ...all, sort: "popular" }, "en"))).toEqual([
|
||||
"acme/alpha",
|
||||
"acme/zeta",
|
||||
"other/beta",
|
||||
]);
|
||||
expect(ids(filterDirectory(index, { ...all, sort: "recent" }, "en"))).toEqual([
|
||||
"acme/zeta",
|
||||
"other/beta",
|
||||
"acme/alpha",
|
||||
]);
|
||||
expect(ids(filterDirectory(index, { ...all, sort: "name" }, "en"))).toEqual([
|
||||
"acme/alpha",
|
||||
"other/beta",
|
||||
"acme/zeta",
|
||||
]);
|
||||
});
|
||||
|
||||
it("keeps only the chosen category", () => {
|
||||
expect(
|
||||
ids(filterDirectory(index, { query: "", category: "git", sort: "popular" }, "en")),
|
||||
).toEqual(["acme/zeta"]);
|
||||
});
|
||||
|
||||
it("matches the query against the author and the reader's translation", () => {
|
||||
const search = (query: string, language: string) =>
|
||||
ids(filterDirectory(index, { query, category: ALL_CATEGORIES, sort: "name" }, language));
|
||||
expect(search(" ACME ", "en")).toEqual(["acme/alpha", "acme/zeta"]);
|
||||
expect(search("revue", "fr-CA")).toEqual(["other/beta"]);
|
||||
expect(search("revue", "en")).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("listing presentation", () => {
|
||||
it("falls back from a regional language to its base translation, then English", () => {
|
||||
const entry = listing("other/beta", { translations: { fr: { name: "Bêta" } } });
|
||||
expect(listingText(entry, "fr-CA")).toEqual({
|
||||
name: "Bêta",
|
||||
description: "other/beta description",
|
||||
});
|
||||
expect(listingText(entry, "ja").name).toBe("beta");
|
||||
});
|
||||
|
||||
it("formats install counts compactly", () => {
|
||||
expect([999, 1000, 1149, 9950, 12_400].map(formatInstallCount)).toEqual([
|
||||
"999",
|
||||
"1k",
|
||||
"1.1k",
|
||||
"9.9k",
|
||||
"12k",
|
||||
]);
|
||||
});
|
||||
|
||||
it("shows images and leaves videos out", () => {
|
||||
const entry = listing("acme/alpha", {
|
||||
media: ["https://cdn.test/a.png", "https://cdn.test/demo.mp4", "https://cdn.test/b.webp"],
|
||||
});
|
||||
expect(listingImages(entry)).toEqual(["https://cdn.test/a.png", "https://cdn.test/b.webp"]);
|
||||
});
|
||||
|
||||
it("features listed plugins in the maintainer's order and skips unlisted ones", () => {
|
||||
const index = directory(
|
||||
[listing("acme/alpha"), listing("acme/zeta")],
|
||||
["acme/zeta", "gone/plugin", "acme/alpha"],
|
||||
);
|
||||
expect(ids(featuredListings(index))).toEqual(["acme/zeta", "acme/alpha"]);
|
||||
});
|
||||
});
|
||||
@@ -1,115 +0,0 @@
|
||||
import type { PluginListItem } from "@getpaseo/protocol/messages";
|
||||
import {
|
||||
pluginMediaKind,
|
||||
type PluginListingIndex,
|
||||
type PluginListing,
|
||||
} from "@getpaseo/protocol/plugin-registry";
|
||||
|
||||
export type DirectorySort = "popular" | "recent" | "name";
|
||||
export const ALL_CATEGORIES = "all";
|
||||
|
||||
export interface DirectoryFilter {
|
||||
query: string;
|
||||
category: string;
|
||||
sort: DirectorySort;
|
||||
}
|
||||
|
||||
/** The listing's name and description in the reader's language, falling back to English. */
|
||||
export function listingText(listing: PluginListing, language: string) {
|
||||
const translation = listing.translations?.[language] ?? listing.translations?.[baseTag(language)];
|
||||
return {
|
||||
name: translation?.name ?? listing.name,
|
||||
description: translation?.description ?? listing.description,
|
||||
};
|
||||
}
|
||||
|
||||
function baseTag(language: string): string {
|
||||
return language.split("-")[0] ?? language;
|
||||
}
|
||||
|
||||
export function listingAuthor(listing: PluginListing): string {
|
||||
return listing.author.name ?? listing.author.github;
|
||||
}
|
||||
|
||||
/** The author's GitHub avatar, the same picture the website shows. */
|
||||
export function listingAuthorAvatar(listing: PluginListing): string {
|
||||
return `https://github.com/${encodeURIComponent(listing.author.github)}.png?size=40`;
|
||||
}
|
||||
|
||||
/** The version a listing pins: the npm version, or the short Git commit. */
|
||||
export function listingVersion(listing: PluginListing): string | undefined {
|
||||
return listing.artifact.version ?? listing.artifact.commit?.slice(0, 7);
|
||||
}
|
||||
|
||||
/** Where a listing's code comes from: the npm package, or the repository. */
|
||||
export function listingSource(listing: PluginListing): string {
|
||||
return listing.artifact.package ?? listing.repository.url;
|
||||
}
|
||||
|
||||
/** Image media in display order. Videos are left to the website. */
|
||||
export function listingImages(listing: PluginListing): string[] {
|
||||
return listing.media.filter((url) => pluginMediaKind(url) === "image");
|
||||
}
|
||||
|
||||
/** "1.1k" style counts: one decimal below ten thousand, whole thousands above. */
|
||||
export function formatInstallCount(count: number): string {
|
||||
if (count < 1000) return String(count);
|
||||
if (count < 10_000) return `${(count / 1000).toFixed(1).replace(/\.0$/, "")}k`;
|
||||
return `${Math.round(count / 1000)}k`;
|
||||
}
|
||||
|
||||
/** The registry listing an installed plugin came from, if it came from one. */
|
||||
export function installedListingId(plugin: PluginListItem): string | undefined {
|
||||
const identity = plugin.installation?.identity;
|
||||
if (!identity || identity.kind === "directory") return undefined;
|
||||
return identity.registry?.id;
|
||||
}
|
||||
|
||||
/** Installed plugins by the listing they came from. */
|
||||
export function installedByListing(plugins: readonly PluginListItem[]) {
|
||||
const byListing = new Map<string, PluginListItem>();
|
||||
for (const plugin of plugins) {
|
||||
const listingId = installedListingId(plugin);
|
||||
if (listingId) byListing.set(listingId, plugin);
|
||||
}
|
||||
return byListing;
|
||||
}
|
||||
|
||||
function matches(listing: PluginListing, language: string, query: string): boolean {
|
||||
if (!query) return true;
|
||||
const { name, description } = listingText(listing, language);
|
||||
const haystack = [name, description, listing.id, listingAuthor(listing)].join("\n").toLowerCase();
|
||||
return haystack.includes(query);
|
||||
}
|
||||
|
||||
const SORTS: Record<DirectorySort, (left: PluginListing, right: PluginListing) => number> = {
|
||||
popular: (left, right) => (right.installs ?? 0) - (left.installs ?? 0),
|
||||
recent: (left, right) => right.updatedAt.localeCompare(left.updatedAt),
|
||||
name: (left, right) => left.name.localeCompare(right.name),
|
||||
};
|
||||
|
||||
/** The directory's listings that pass the filter, in the chosen order. */
|
||||
export function filterDirectory(
|
||||
index: PluginListingIndex,
|
||||
filter: DirectoryFilter,
|
||||
language: string,
|
||||
): PluginListing[] {
|
||||
const query = filter.query.trim().toLowerCase();
|
||||
return index.plugins
|
||||
.filter(
|
||||
(listing) =>
|
||||
(filter.category === ALL_CATEGORIES || listing.categories.includes(filter.category)) &&
|
||||
matches(listing, language, query),
|
||||
)
|
||||
.sort(SORTS[filter.sort]);
|
||||
}
|
||||
|
||||
/** Featured listings that exist, in the maintainer's order. */
|
||||
export function featuredListings(index: PluginListingIndex): PluginListing[] {
|
||||
const byId = new Map(index.plugins.map((listing) => [listing.id, listing]));
|
||||
return index.featured.flatMap((id) => byId.get(id) ?? []);
|
||||
}
|
||||
|
||||
export function categoryLabel(index: PluginListingIndex, slug: string): string {
|
||||
return index.categories.find((category) => category.slug === slug)?.label ?? slug;
|
||||
}
|
||||
@@ -1,325 +0,0 @@
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Text, View, type PressableStateCallbackType } from "react-native";
|
||||
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||
import {
|
||||
ArrowUpRight,
|
||||
FileText,
|
||||
MoreHorizontal,
|
||||
PackagePlus,
|
||||
Power,
|
||||
RotateCw,
|
||||
Trash2,
|
||||
} from "lucide-react-native";
|
||||
import type { PluginListItem, PluginLogEntry } from "@getpaseo/protocol/messages";
|
||||
import {
|
||||
AdaptiveModalSheet,
|
||||
SheetHeaderIconButton,
|
||||
type SheetHeader,
|
||||
} from "@/components/adaptive-modal-sheet";
|
||||
import { Alert } from "@/components/ui/alert";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import {
|
||||
iconButtonChromeHang,
|
||||
useIconButtonChromeGlyphSize,
|
||||
useIconButtonChromeStyle,
|
||||
} from "@/components/ui/icon-button-chrome";
|
||||
import { foregroundIconColorMapping, mutedIconColorMapping } from "@/components/ui/icon-color";
|
||||
import { useIsCompactFormFactor } from "@/constants/layout";
|
||||
import { useToast } from "@/contexts/toast-api-context";
|
||||
import { useFetchQuery } from "@/data/query";
|
||||
import { useDaemonConfig } from "@/hooks/use-daemon-config";
|
||||
import { useHostFeature } from "@/runtime/host-features";
|
||||
import { useHostRuntimeClient } from "@/runtime/host-runtime";
|
||||
import { pluginDisplayName } from "@/plugins/plugin-list";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
import { openExternalUrl } from "@/utils/open-external-url";
|
||||
import type { PluginAction } from "./actions";
|
||||
import { InstallPluginSheet } from "./install-sheet";
|
||||
import { pluginErrorText } from "./error-text";
|
||||
|
||||
const SUBMIT_PLUGIN_URL =
|
||||
"https://github.com/getpaseo/plugins/issues/new?template=submit-plugin.yml";
|
||||
const ThemedMore = withUnistyles(MoreHorizontal);
|
||||
const dangerIconMapping = (theme: Theme) => ({ color: theme.colors.statusDanger });
|
||||
const ThemedPackagePlus = withUnistyles(PackagePlus);
|
||||
const ThemedPower = withUnistyles(Power);
|
||||
const ThemedArrow = withUnistyles(ArrowUpRight);
|
||||
const ThemedRotate = withUnistyles(RotateCw);
|
||||
const ThemedLogs = withUnistyles(FileText);
|
||||
const ThemedTrash = withUnistyles(Trash2);
|
||||
const installIcon = <ThemedPackagePlus size={14} uniProps={mutedIconColorMapping} />;
|
||||
const powerIcon = <ThemedPower size={14} uniProps={mutedIconColorMapping} />;
|
||||
const linkIcon = <ThemedArrow size={14} uniProps={mutedIconColorMapping} />;
|
||||
const reloadIcon = <ThemedRotate size={14} uniProps={mutedIconColorMapping} />;
|
||||
const logsIcon = <ThemedLogs size={14} uniProps={mutedIconColorMapping} />;
|
||||
const removeIcon = <ThemedTrash size={14} uniProps={dangerIconMapping} />;
|
||||
|
||||
type TriggerState = PressableStateCallbackType & { hovered?: boolean; open?: boolean };
|
||||
// The trigger hangs by how far its frame reaches past the glyph, so the glyph sits on the trailing
|
||||
// content rail and the frame does not grow the row.
|
||||
const TRIGGER_HANG = iconButtonChromeHang("small");
|
||||
|
||||
function MenuTrigger({ label, testID }: { label: string; testID: string }) {
|
||||
const compact = useIsCompactFormFactor();
|
||||
const style = useIconButtonChromeStyle({ size: "small", compact, style: styles.trigger });
|
||||
const glyphSize = useIconButtonChromeGlyphSize("small", compact);
|
||||
return (
|
||||
<DropdownMenuTrigger
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={label}
|
||||
style={style}
|
||||
testID={testID}
|
||||
>
|
||||
{({ hovered, open }: TriggerState) => (
|
||||
<ThemedMore
|
||||
size={glyphSize}
|
||||
uniProps={hovered || open ? foregroundIconColorMapping : mutedIconColorMapping}
|
||||
/>
|
||||
)}
|
||||
</DropdownMenuTrigger>
|
||||
);
|
||||
}
|
||||
|
||||
/** The page's occasional actions: install from a source, turn plugins off, submit a plugin. */
|
||||
export function PluginGalleryMenu({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const toast = useToast();
|
||||
// COMPAT(pluginSourceInstallation): added in v0.8.0; remove gate after 2027-03-16.
|
||||
const sourceInstallSupported = useHostFeature(serverId, "pluginSourceInstallation");
|
||||
const { config, patchConfig } = useDaemonConfig(serverId);
|
||||
const [installing, setInstalling] = useState(false);
|
||||
const pluginsOn = config?.pluginsEnabled === true;
|
||||
const openInstall = useCallback(() => setInstalling(true), []);
|
||||
const closeInstall = useCallback(() => setInstalling(false), []);
|
||||
const toggle = useCallback(async () => {
|
||||
try {
|
||||
await patchConfig({ pluginsEnabled: !pluginsOn });
|
||||
toast.show(
|
||||
pluginsOn
|
||||
? t("settings.plugins.feedback.globalDisabled")
|
||||
: t("settings.plugins.feedback.globalEnabled"),
|
||||
{ variant: "success" },
|
||||
);
|
||||
} catch (error) {
|
||||
toast.error(pluginErrorText(error));
|
||||
}
|
||||
}, [patchConfig, pluginsOn, t, toast]);
|
||||
const submit = useCallback(() => void openExternalUrl(SUBMIT_PLUGIN_URL), []);
|
||||
const label = t("settings.plugins.gallery.menu");
|
||||
return (
|
||||
<>
|
||||
<DropdownMenu>
|
||||
<MenuTrigger label={label} testID="plugin-gallery-menu" />
|
||||
<DropdownMenuContent align="end" width={220} sheetTitle={label}>
|
||||
{sourceInstallSupported ? (
|
||||
<DropdownMenuItem leading={installIcon} onSelect={openInstall}>
|
||||
{t("settings.plugins.gallery.actions.installFromSource")}
|
||||
</DropdownMenuItem>
|
||||
) : null}
|
||||
<DropdownMenuItem leading={powerIcon} onSelect={toggle} disabled={!config}>
|
||||
{pluginsOn
|
||||
? t("settings.plugins.gallery.actions.turnOff")
|
||||
: t("settings.plugins.gallery.actions.turnOnAll")}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem leading={linkIcon} onSelect={submit}>
|
||||
{t("settings.plugins.gallery.actions.submit")}
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
{installing ? (
|
||||
<InstallPluginSheet serverId={serverId} target={SOURCE_TARGET} onClose={closeInstall} />
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
const SOURCE_TARGET = { kind: "source" } as const;
|
||||
|
||||
/** One installed plugin's occasional actions, on its page. */
|
||||
export function PluginActionsMenu({
|
||||
serverId,
|
||||
plugin,
|
||||
repositoryUrl,
|
||||
pendingAction,
|
||||
onAction,
|
||||
}: {
|
||||
serverId: string;
|
||||
plugin: PluginListItem;
|
||||
repositoryUrl?: string;
|
||||
pendingAction?: PluginAction;
|
||||
onAction(action: PluginAction): void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
// COMPAT(pluginLogs): added in v0.4.0, remove gate after 2027-08-16.
|
||||
const logsSupported = useHostFeature(serverId, "pluginLogs");
|
||||
const [logsOpen, setLogsOpen] = useState(false);
|
||||
const reload = useCallback(() => onAction("reload"), [onAction]);
|
||||
const remove = useCallback(() => onAction("remove"), [onAction]);
|
||||
const openLogs = useCallback(() => setLogsOpen(true), []);
|
||||
const closeLogs = useCallback(() => setLogsOpen(false), []);
|
||||
const openRepository = useCallback(() => {
|
||||
if (repositoryUrl) void openExternalUrl(repositoryUrl);
|
||||
}, [repositoryUrl]);
|
||||
const label = t("settings.plugins.actions.menu", { name: pluginDisplayName(plugin) });
|
||||
return (
|
||||
<>
|
||||
<DropdownMenu>
|
||||
<MenuTrigger label={label} testID={`plugin-actions-${plugin.id}`} />
|
||||
<DropdownMenuContent align="end" width={220} sheetTitle={label}>
|
||||
<DropdownMenuItem
|
||||
leading={reloadIcon}
|
||||
onSelect={reload}
|
||||
disabled={!plugin.enabled || pendingAction !== undefined}
|
||||
status={pendingAction === "reload" ? "pending" : "idle"}
|
||||
pendingLabel={t("settings.plugins.actions.reloading")}
|
||||
>
|
||||
{t("settings.plugins.actions.reload")}
|
||||
</DropdownMenuItem>
|
||||
{logsSupported ? (
|
||||
<DropdownMenuItem leading={logsIcon} onSelect={openLogs}>
|
||||
{t("settings.plugins.logs.action")}
|
||||
</DropdownMenuItem>
|
||||
) : null}
|
||||
{repositoryUrl ? (
|
||||
<DropdownMenuItem leading={linkIcon} onSelect={openRepository}>
|
||||
{t("settings.plugins.gallery.actions.repository")}
|
||||
</DropdownMenuItem>
|
||||
) : null}
|
||||
<DropdownMenuItem
|
||||
destructive
|
||||
leading={removeIcon}
|
||||
onSelect={remove}
|
||||
disabled={pendingAction !== undefined}
|
||||
status={pendingAction === "remove" ? "pending" : "idle"}
|
||||
pendingLabel={t("settings.plugins.actions.removing")}
|
||||
>
|
||||
{t("settings.plugins.actions.remove")}
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
{logsOpen ? (
|
||||
<PluginLogsSheet serverId={serverId} plugin={plugin} onClose={closeLogs} />
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function PluginLogsSheet({
|
||||
serverId,
|
||||
plugin,
|
||||
onClose,
|
||||
}: {
|
||||
serverId: string;
|
||||
plugin: PluginListItem;
|
||||
onClose(): void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const client = useHostRuntimeClient(serverId);
|
||||
const pluginId = plugin.id;
|
||||
const logs = useFetchQuery({
|
||||
queryKey: ["plugin-logs", serverId, pluginId],
|
||||
queryFn: () => {
|
||||
if (!client) throw new Error("Plugin host is offline");
|
||||
return client.getPluginLogs(pluginId);
|
||||
},
|
||||
enabled: Boolean(client),
|
||||
dataShape: "list",
|
||||
staleTimeMs: 0,
|
||||
});
|
||||
const refresh = useCallback(() => {
|
||||
void logs.refetch();
|
||||
}, [logs]);
|
||||
const header = useMemo<SheetHeader>(
|
||||
() => ({
|
||||
title: t("settings.plugins.logs.title", { name: pluginDisplayName(plugin) }),
|
||||
actions: (
|
||||
<SheetHeaderIconButton
|
||||
icon={RotateCw}
|
||||
label={
|
||||
logs.isFetching
|
||||
? t("settings.plugins.logs.refreshing")
|
||||
: t("settings.plugins.logs.refresh")
|
||||
}
|
||||
onPress={refresh}
|
||||
busy={logs.isFetching}
|
||||
/>
|
||||
),
|
||||
}),
|
||||
[logs.isFetching, plugin, refresh, t],
|
||||
);
|
||||
|
||||
let content = <Text style={styles.logsState}>{t("settings.plugins.logs.loading")}</Text>;
|
||||
if (logs.isError) {
|
||||
content = (
|
||||
<Alert
|
||||
size="sm"
|
||||
variant="error"
|
||||
title={t("settings.plugins.logs.errorTitle")}
|
||||
description={pluginErrorText(logs.error)}
|
||||
>
|
||||
<Button variant="outline" onPress={refresh}>
|
||||
{t("settings.plugins.logs.refresh")}
|
||||
</Button>
|
||||
</Alert>
|
||||
);
|
||||
} else if (!logs.isLoading) {
|
||||
content = logs.data?.length ? (
|
||||
<View style={styles.logList}>
|
||||
{logs.data.map((entry: PluginLogEntry) => (
|
||||
<View key={entry.sequence} style={styles.logEntry}>
|
||||
<Text style={entry.stream === "stderr" ? styles.logStderr : styles.logStdout}>
|
||||
{entry.timestamp} {entry.stream}
|
||||
</Text>
|
||||
<Text style={styles.logMessage}>{entry.message}</Text>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
) : (
|
||||
<Text style={styles.logsState}>{t("settings.plugins.logs.empty")}</Text>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<AdaptiveModalSheet header={header} visible onClose={onClose} testID="plugin-logs-sheet">
|
||||
{content}
|
||||
</AdaptiveModalSheet>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
trigger: { marginVertical: TRIGGER_HANG, marginRight: TRIGGER_HANG },
|
||||
logsState: {
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontSize: theme.fontSize.base,
|
||||
textAlign: "center",
|
||||
paddingVertical: theme.spacing[6],
|
||||
},
|
||||
logList: { gap: theme.spacing[2] },
|
||||
logEntry: {
|
||||
padding: theme.spacing[3],
|
||||
gap: theme.spacing[1],
|
||||
backgroundColor: theme.colors.surface2,
|
||||
borderRadius: theme.borderRadius.md,
|
||||
},
|
||||
logStdout: {
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontFamily: theme.fontFamily.mono,
|
||||
fontSize: theme.fontSize.sm,
|
||||
},
|
||||
logStderr: {
|
||||
color: theme.colors.statusDanger,
|
||||
fontFamily: theme.fontFamily.mono,
|
||||
fontSize: theme.fontSize.sm,
|
||||
},
|
||||
logMessage: {
|
||||
color: theme.colors.foreground,
|
||||
fontFamily: theme.fontFamily.mono,
|
||||
fontSize: theme.fontSize.base,
|
||||
},
|
||||
}));
|
||||
@@ -1,159 +0,0 @@
|
||||
import type { QueryClient } from "@tanstack/react-query";
|
||||
import { useCallback, useSyncExternalStore } from "react";
|
||||
import type { DaemonClient } from "@getpaseo/client/internal/daemon-client";
|
||||
import type {
|
||||
PluginListItem,
|
||||
PluginUpdatePreview,
|
||||
PluginUpdateProposal,
|
||||
} from "@getpaseo/protocol/messages";
|
||||
import { daemonConfigQueryKey } from "@/data/daemon-config";
|
||||
import { pluginListQueryKey } from "@/plugins/plugin-list";
|
||||
import { pluginErrorText } from "./error-text";
|
||||
|
||||
/**
|
||||
* Installs and updates outlive the screen that started them: leaving Plugins and coming back
|
||||
* mid-run still shows the run on its row. A finished run leaves no entry; the plugin list says
|
||||
* what changed.
|
||||
*/
|
||||
export type PluginOperation =
|
||||
| { kind: "install" | "update"; status: "running" }
|
||||
| { kind: "install" | "update"; status: "failed"; error: string };
|
||||
|
||||
type Listener = () => void;
|
||||
|
||||
const operations = new Map<string, PluginOperation>();
|
||||
const listeners = new Set<Listener>();
|
||||
|
||||
function operationKey(serverId: string, subject: string): string {
|
||||
return `${serverId}\n${subject}`;
|
||||
}
|
||||
|
||||
function setOperation(serverId: string, subject: string, operation: PluginOperation | null) {
|
||||
const key = operationKey(serverId, subject);
|
||||
if (operation) operations.set(key, operation);
|
||||
else operations.delete(key);
|
||||
for (const listener of listeners) listener();
|
||||
}
|
||||
|
||||
function subscribe(listener: Listener) {
|
||||
listeners.add(listener);
|
||||
return () => {
|
||||
listeners.delete(listener);
|
||||
};
|
||||
}
|
||||
|
||||
/** The install or update running or failed for a plugin, keyed by listing ID or plugin ID. */
|
||||
export function usePluginOperation(serverId: string, subject: string | undefined) {
|
||||
const read = useCallback(
|
||||
() => (subject ? operations.get(operationKey(serverId, subject)) : undefined),
|
||||
[serverId, subject],
|
||||
);
|
||||
return useSyncExternalStore(subscribe, read, read);
|
||||
}
|
||||
|
||||
/** Forgets a failed run once its error has been read. A running one keeps going. */
|
||||
export function dismissFailedOperation(serverId: string, subject: string) {
|
||||
if (operations.get(operationKey(serverId, subject))?.status === "failed")
|
||||
setOperation(serverId, subject, null);
|
||||
}
|
||||
|
||||
export function pluginUpdatesQueryKey(serverId: string) {
|
||||
return ["plugin-updates", serverId] as const;
|
||||
}
|
||||
|
||||
function upsertPlugin(queryClient: QueryClient, serverId: string, plugin: PluginListItem) {
|
||||
queryClient.setQueryData<PluginListItem[]>(pluginListQueryKey(serverId), (plugins = []) => {
|
||||
const others = plugins.filter((candidate) => candidate.id !== plugin.id);
|
||||
return [...others, plugin].sort((left, right) => left.id.localeCompare(right.id));
|
||||
});
|
||||
}
|
||||
|
||||
interface HostContext {
|
||||
client: DaemonClient;
|
||||
queryClient: QueryClient;
|
||||
serverId: string;
|
||||
}
|
||||
|
||||
export interface InstallRequest extends HostContext {
|
||||
/** A registry ID such as `acme/example`, or any source the CLI accepts. */
|
||||
source: string;
|
||||
/** Where the run shows: the listing ID, or the source for an install from source. */
|
||||
subject: string;
|
||||
/** Plugins are off on the host; the confirmation said installing turns them on. */
|
||||
enablePlugins: boolean;
|
||||
onInstalled(plugin: PluginListItem): void;
|
||||
}
|
||||
|
||||
export async function installPlugin(request: InstallRequest): Promise<void> {
|
||||
const { client, queryClient, serverId, subject } = request;
|
||||
if (operations.get(operationKey(serverId, subject))?.status === "running") return;
|
||||
setOperation(serverId, subject, { kind: "install", status: "running" });
|
||||
try {
|
||||
if (request.enablePlugins) {
|
||||
const result = await client.patchDaemonConfig({ pluginsEnabled: true });
|
||||
queryClient.setQueryData(daemonConfigQueryKey(serverId), result.config);
|
||||
}
|
||||
const plugin = await client.installPluginSource({ source: request.source });
|
||||
// Write the result before clearing the run, so the row goes straight to Installed.
|
||||
upsertPlugin(queryClient, serverId, plugin);
|
||||
setOperation(serverId, subject, null);
|
||||
request.onInstalled(plugin);
|
||||
} catch (error) {
|
||||
setOperation(serverId, subject, {
|
||||
kind: "install",
|
||||
status: "failed",
|
||||
error: pluginErrorText(error),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export interface UpdateRequest extends HostContext {
|
||||
proposals: PluginUpdateProposal[];
|
||||
onUpdated(plugins: PluginListItem[]): void;
|
||||
}
|
||||
|
||||
export async function updatePlugins(request: UpdateRequest): Promise<void> {
|
||||
const { client, queryClient, serverId } = request;
|
||||
const proposals = request.proposals.filter(
|
||||
(proposal) => operations.get(operationKey(serverId, proposal.id))?.status !== "running",
|
||||
);
|
||||
if (proposals.length === 0) return;
|
||||
for (const proposal of proposals)
|
||||
setOperation(serverId, proposal.id, { kind: "update", status: "running" });
|
||||
try {
|
||||
const results = await client.applyPluginUpdates(proposals);
|
||||
const updated: PluginListItem[] = [];
|
||||
for (const result of results) {
|
||||
if (result.outcome === "updated" && result.plugin) {
|
||||
upsertPlugin(queryClient, serverId, result.plugin);
|
||||
updated.push(result.plugin);
|
||||
setOperation(serverId, result.id, null);
|
||||
} else {
|
||||
setOperation(serverId, result.id, {
|
||||
kind: "update",
|
||||
status: "failed",
|
||||
error: result.error ?? "Update failed",
|
||||
});
|
||||
}
|
||||
}
|
||||
const updatedIds = new Set(updated.map((plugin) => plugin.id));
|
||||
queryClient.setQueryData<PluginUpdatePreview[]>(pluginUpdatesQueryKey(serverId), (previews) =>
|
||||
previews?.filter((preview) => !updatedIds.has(preview.id)),
|
||||
);
|
||||
if (updated.length) request.onUpdated(updated);
|
||||
if (updated.length < results.length) recheckUpdates(request);
|
||||
} catch (error) {
|
||||
for (const proposal of proposals)
|
||||
setOperation(serverId, proposal.id, {
|
||||
kind: "update",
|
||||
status: "failed",
|
||||
error: pluginErrorText(error),
|
||||
});
|
||||
recheckUpdates(request);
|
||||
}
|
||||
}
|
||||
|
||||
// A proposal fails when the plugin changed since it was reviewed; Retry needs a fresh one.
|
||||
function recheckUpdates({ queryClient, serverId }: HostContext): void {
|
||||
void queryClient.invalidateQueries({ queryKey: pluginUpdatesQueryKey(serverId) });
|
||||
}
|
||||
@@ -1,581 +0,0 @@
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { router } from "expo-router";
|
||||
import { ArrowLeft } from "lucide-react-native";
|
||||
import { useCallback, useMemo, useState, type ReactNode } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Image, ScrollView, Text, View } from "react-native";
|
||||
import { AttachmentLightbox, type ImageLightboxSource } from "@/components/attachment-lightbox";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import type { PluginListItem, PluginUpdatePreview } from "@getpaseo/protocol/messages";
|
||||
import { formatPluginInstallation } from "@getpaseo/protocol/plugin-source-reference";
|
||||
import type {
|
||||
PluginListingIndex,
|
||||
PluginListing,
|
||||
PluginListingDetail,
|
||||
} from "@getpaseo/protocol/plugin-registry";
|
||||
import { MarkdownRenderer } from "@/components/markdown/renderer";
|
||||
import { SettingsCard, SettingsRow, SettingsSection } from "@/components/settings";
|
||||
import { Alert } from "@/components/ui/alert";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ExternalLink } from "@/components/ui/external-link";
|
||||
import { PressHighlight } from "@/components/ui/press-highlight";
|
||||
import { StatusBadge } from "@/components/ui/status-badge";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { useIsCompactFormFactor } from "@/constants/layout";
|
||||
import { useToast } from "@/contexts/toast-api-context";
|
||||
import { useHostRuntimeClient } from "@/runtime/host-runtime";
|
||||
import { useInstalledPlugin, usePluginEvaluationError } from "@/plugins/registry";
|
||||
import { pluginDisplayName } from "@/plugins/plugin-list";
|
||||
import { PluginSettingsContent } from "@/plugins/settings";
|
||||
import { usePluginActions, type PluginAction } from "./actions";
|
||||
import { useListingMeta } from "./browse-tab";
|
||||
import { ListingInstallControl } from "./install-control";
|
||||
import { InstallPluginSheet, type InstallTarget } from "./install-sheet";
|
||||
import {
|
||||
categoryLabel,
|
||||
installedByListing,
|
||||
installedListingId,
|
||||
listingAuthorAvatar,
|
||||
listingImages,
|
||||
listingText,
|
||||
listingSource,
|
||||
listingVersion,
|
||||
} from "./listing";
|
||||
import { PluginActionsMenu } from "./menus";
|
||||
import { updatePlugins, usePluginOperation, type PluginOperation } from "./operations";
|
||||
import { PluginMeta, PluginTile } from "./plugin-row";
|
||||
import { buildPluginListingRoute } from "./routes";
|
||||
import { PluginsOffAlert } from "./plugins-off-alert";
|
||||
import { OverviewSkeleton, PluginPageSkeleton } from "./skeletons";
|
||||
import {
|
||||
useLivePluginList,
|
||||
usePluginDirectory,
|
||||
usePluginListing,
|
||||
usePluginUpdates,
|
||||
} from "./queries";
|
||||
import { pluginErrorText } from "./error-text";
|
||||
|
||||
/** Which plugin the page is for: one installed on the host, or one listed in the directory. */
|
||||
export type PluginPageSubject =
|
||||
| { kind: "installed"; pluginId: string; screenId?: string }
|
||||
| { kind: "listing"; listingId: string };
|
||||
|
||||
function useResolvedPlugin(serverId: string, subject: PluginPageSubject) {
|
||||
const plugins = useLivePluginList(serverId);
|
||||
const plugin = useMemo(() => {
|
||||
const list = plugins.data ?? [];
|
||||
if (subject.kind === "installed") return list.find((item) => item.id === subject.pluginId);
|
||||
return installedByListing(list).get(subject.listingId);
|
||||
}, [plugins.data, subject]);
|
||||
const listingId =
|
||||
subject.kind === "listing" ? subject.listingId : plugin && installedListingId(plugin);
|
||||
const detail = usePluginListing(serverId, listingId);
|
||||
const directory = usePluginDirectory(serverId);
|
||||
// The directory the user came from already has the listing, so the page shows it at once and
|
||||
// only the overview waits for the listing's own request.
|
||||
const listing =
|
||||
detail.data ?? directory.query.data?.plugins.find((entry) => entry.id === listingId);
|
||||
const listingLoading = detail.isLoading && !listing;
|
||||
return {
|
||||
plugin,
|
||||
listingId,
|
||||
listing,
|
||||
detail,
|
||||
loading: plugins.isLoading || (subject.kind === "listing" && listingLoading),
|
||||
};
|
||||
}
|
||||
|
||||
function UpdateButton({ serverId, plugin }: { serverId: string; plugin: PluginListItem }) {
|
||||
const { t } = useTranslation();
|
||||
const toast = useToast();
|
||||
const queryClient = useQueryClient();
|
||||
const client = useHostRuntimeClient(serverId);
|
||||
const updates = usePluginUpdates(serverId);
|
||||
const operation = usePluginOperation(serverId, plugin.id);
|
||||
const preview = updates.data?.find((candidate) => candidate.id === plugin.id);
|
||||
const update = useCallback(() => {
|
||||
if (!client || !preview?.proposal) return;
|
||||
void updatePlugins({
|
||||
client,
|
||||
queryClient,
|
||||
serverId,
|
||||
proposals: [preview.proposal],
|
||||
onUpdated: ([updated]) =>
|
||||
toast.show(
|
||||
t("settings.plugins.gallery.update.updated", { name: pluginDisplayName(updated!) }),
|
||||
{ variant: "success" },
|
||||
),
|
||||
});
|
||||
}, [client, preview, queryClient, serverId, t, toast]);
|
||||
if (!preview) return null;
|
||||
const running = operation?.status === "running";
|
||||
let label = t("settings.plugins.gallery.actions.update");
|
||||
if (running) label = t("settings.plugins.gallery.actions.updating");
|
||||
else if (operation?.status === "failed") label = t("settings.plugins.gallery.actions.retry");
|
||||
return (
|
||||
<Button variant="outline" onPress={update} loading={running} testID="plugin-update">
|
||||
{label}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
function InstalledControls({
|
||||
serverId,
|
||||
plugin,
|
||||
repositoryUrl,
|
||||
onRemoved,
|
||||
}: {
|
||||
serverId: string;
|
||||
plugin: PluginListItem;
|
||||
repositoryUrl?: string;
|
||||
onRemoved(): void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const actions = usePluginActions(serverId);
|
||||
const name = pluginDisplayName(plugin);
|
||||
const pendingAction =
|
||||
actions.pending?.pluginId === plugin.id ? actions.pending.action : undefined;
|
||||
const toggle = useCallback(
|
||||
(enabled: boolean) => void actions.run(enabled ? "enable" : "disable", plugin),
|
||||
[actions, plugin],
|
||||
);
|
||||
const act = useCallback(
|
||||
async (action: PluginAction) => {
|
||||
if ((await actions.run(action, plugin)) && action === "remove") onRemoved();
|
||||
},
|
||||
[actions, onRemoved, plugin],
|
||||
);
|
||||
const onAction = useCallback((action: PluginAction) => void act(action), [act]);
|
||||
return (
|
||||
<View style={styles.controls}>
|
||||
<UpdateButton serverId={serverId} plugin={plugin} />
|
||||
<Switch
|
||||
value={plugin.enabled}
|
||||
onValueChange={toggle}
|
||||
disabled={pendingAction !== undefined}
|
||||
accessibilityLabel={`${name}: ${t(
|
||||
plugin.enabled ? "settings.plugins.actions.disable" : "settings.plugins.actions.enable",
|
||||
)}`}
|
||||
/>
|
||||
<PluginActionsMenu
|
||||
serverId={serverId}
|
||||
plugin={plugin}
|
||||
repositoryUrl={repositoryUrl}
|
||||
pendingAction={pendingAction}
|
||||
onAction={onAction}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
function MediaImage({ url, onOpen }: { url: string; onOpen(url: string): void }) {
|
||||
const { t } = useTranslation();
|
||||
const source = useMemo(() => ({ uri: url }), [url]);
|
||||
const open = useCallback(() => onOpen(url), [onOpen, url]);
|
||||
return (
|
||||
<PressHighlight
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={t("settings.plugins.gallery.details.openImage")}
|
||||
onPress={open}
|
||||
style={styles.media}
|
||||
>
|
||||
<Image source={source} style={styles.mediaImage} resizeMode="cover" />
|
||||
</PressHighlight>
|
||||
);
|
||||
}
|
||||
|
||||
/** The listing's screenshots in a row; one opens full size in the lightbox. */
|
||||
function MediaStrip({ urls }: { urls: string[] }) {
|
||||
const [image, setImage] = useState<ImageLightboxSource | null>(null);
|
||||
const open = useCallback((uri: string) => setImage({ type: "uri", uri }), []);
|
||||
const close = useCallback(() => setImage(null), []);
|
||||
if (urls.length === 0) return null;
|
||||
return (
|
||||
<>
|
||||
<ScrollView
|
||||
horizontal
|
||||
showsHorizontalScrollIndicator={false}
|
||||
style={styles.mediaStrip}
|
||||
contentContainerStyle={styles.mediaRow}
|
||||
>
|
||||
{urls.map((url) => (
|
||||
<MediaImage key={url} url={url} onOpen={open} />
|
||||
))}
|
||||
</ScrollView>
|
||||
<AttachmentLightbox source={image} onClose={close} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function DetailValue({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<Text style={styles.detailValue} numberOfLines={1}>
|
||||
{children}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
|
||||
function detailSource(plugin: PluginListItem | undefined, listing: PluginListing | undefined) {
|
||||
if (plugin?.installation) return formatPluginInstallation(plugin.installation);
|
||||
if (plugin) return plugin.path;
|
||||
if (!listing) return undefined;
|
||||
return listingSource(listing);
|
||||
}
|
||||
|
||||
function Details({ plugin, listing }: { plugin?: PluginListItem; listing?: PluginListing }) {
|
||||
const { t } = useTranslation();
|
||||
const version = plugin?.installation?.currentRevision ?? (listing && listingVersion(listing));
|
||||
const source = detailSource(plugin, listing);
|
||||
const repository = listing?.repository.url;
|
||||
return (
|
||||
<SettingsSection title={t("settings.plugins.gallery.sections.details")}>
|
||||
<SettingsCard>
|
||||
{version ? (
|
||||
<SettingsRow label={t("settings.plugins.gallery.install.version")}>
|
||||
<DetailValue>{version}</DetailValue>
|
||||
</SettingsRow>
|
||||
) : null}
|
||||
{source ? (
|
||||
<SettingsRow label={t("settings.plugins.gallery.install.source")}>
|
||||
<DetailValue>{source}</DetailValue>
|
||||
</SettingsRow>
|
||||
) : null}
|
||||
{listing?.license ? (
|
||||
<SettingsRow label={t("settings.plugins.gallery.details.license")}>
|
||||
<DetailValue>{listing.license}</DetailValue>
|
||||
</SettingsRow>
|
||||
) : null}
|
||||
{listing ? (
|
||||
<SettingsRow label={t("settings.plugins.gallery.details.updated")}>
|
||||
<DetailValue>{listing.updatedAt.slice(0, 10)}</DetailValue>
|
||||
</SettingsRow>
|
||||
) : null}
|
||||
{repository ? (
|
||||
<SettingsRow label={t("settings.plugins.gallery.actions.repository")}>
|
||||
<ExternalLink href={repository} label={repository.replace(/^https:\/\//, "")} />
|
||||
</SettingsRow>
|
||||
) : null}
|
||||
</SettingsCard>
|
||||
</SettingsSection>
|
||||
);
|
||||
}
|
||||
|
||||
/** What the page shows about the plugin, from whichever of the installed plugin and listing exist. */
|
||||
interface PluginPageModel {
|
||||
name: string;
|
||||
description?: string;
|
||||
/** "author · installs · category" for a listing; the ID when the name hides it. */
|
||||
metaLine?: string;
|
||||
/** The listing author's picture, before the meta line. */
|
||||
authorAvatar?: string;
|
||||
/** Why the plugin failed to load, or why its install failed. */
|
||||
error?: string;
|
||||
/** Why the last update failed, while the update is still offered. The installed version keeps running. */
|
||||
updateError?: string;
|
||||
/** The plugin's own settings screen, shown inline. */
|
||||
screenId?: string;
|
||||
overview?: string;
|
||||
}
|
||||
|
||||
function usePluginPageModel({
|
||||
serverId,
|
||||
subject,
|
||||
plugin,
|
||||
listing,
|
||||
detail,
|
||||
installOperation,
|
||||
}: {
|
||||
serverId: string;
|
||||
subject: PluginPageSubject;
|
||||
plugin?: PluginListItem;
|
||||
listing?: PluginListing;
|
||||
/** The listing with its overview, once its own request returns. */
|
||||
detail?: PluginListingDetail;
|
||||
installOperation: PluginOperation | undefined;
|
||||
}): PluginPageModel {
|
||||
const { i18n } = useTranslation();
|
||||
const directory = usePluginDirectory(serverId);
|
||||
const meta = useListingMeta();
|
||||
const pluginId = plugin?.id ?? "";
|
||||
const installedPlugin = useInstalledPlugin(serverId, pluginId);
|
||||
const evaluationError = usePluginEvaluationError(serverId, pluginId);
|
||||
const pluginOperation = usePluginOperation(serverId, pluginId);
|
||||
const updates = usePluginUpdates(serverId);
|
||||
const text = listing ? listingText(listing, i18n.language) : undefined;
|
||||
const requestedScreen = subject.kind === "installed" ? subject.screenId : undefined;
|
||||
return {
|
||||
name: plugin ? pluginDisplayName(plugin) : (text?.name ?? subjectId(subject)),
|
||||
description: text?.description ?? plugin?.description,
|
||||
metaLine: listing
|
||||
? listingMetaLine(meta(listing), directory.query.data, listing)
|
||||
: installedMetaLine(plugin),
|
||||
authorAvatar: listing && listingAuthorAvatar(listing),
|
||||
error: plugin ? (evaluationError ?? plugin.error) : failedError(installOperation),
|
||||
updateError: failedUpdateError(pluginOperation, updates.data, pluginId),
|
||||
screenId: plugin ? (requestedScreen ?? installedPlugin?.settingsScreens[0]?.id) : undefined,
|
||||
overview: detail && listingOverview(detail, i18n.language),
|
||||
};
|
||||
}
|
||||
|
||||
function subjectId(subject: PluginPageSubject): string {
|
||||
return subject.kind === "listing" ? subject.listingId : subject.pluginId;
|
||||
}
|
||||
|
||||
function listingOverview(listing: PluginListingDetail, language: string): string {
|
||||
return (listing.overviewTranslations?.[language] ?? listing.readme).trim();
|
||||
}
|
||||
|
||||
function listingMetaLine(
|
||||
meta: string,
|
||||
index: PluginListingIndex | undefined,
|
||||
listing: PluginListing,
|
||||
): string {
|
||||
const category = listing.categories[0];
|
||||
return category && index ? `${meta} · ${categoryLabel(index, category)}` : meta;
|
||||
}
|
||||
|
||||
function installedMetaLine(plugin: PluginListItem | undefined): string | undefined {
|
||||
return plugin?.name && plugin.name !== plugin.id ? plugin.id : undefined;
|
||||
}
|
||||
|
||||
function failedError(operation: PluginOperation | undefined): string | undefined {
|
||||
return operation?.status === "failed" ? operation.error : undefined;
|
||||
}
|
||||
|
||||
/** Shown with the Update button it belongs to, as on the Installed tab's Updates row. */
|
||||
function failedUpdateError(
|
||||
operation: PluginOperation | undefined,
|
||||
updates: PluginUpdatePreview[] | undefined,
|
||||
pluginId: string,
|
||||
): string | undefined {
|
||||
if (operation?.kind !== "update" || !updates?.some((preview) => preview.id === pluginId))
|
||||
return undefined;
|
||||
return failedError(operation);
|
||||
}
|
||||
|
||||
function HeaderControl({
|
||||
serverId,
|
||||
plugin,
|
||||
listing,
|
||||
installOperation,
|
||||
onInstall,
|
||||
onRemoved,
|
||||
}: {
|
||||
serverId: string;
|
||||
plugin?: PluginListItem;
|
||||
listing?: PluginListing;
|
||||
installOperation: PluginOperation | undefined;
|
||||
onInstall(listing: PluginListing): void;
|
||||
onRemoved(): void;
|
||||
}) {
|
||||
if (plugin)
|
||||
return (
|
||||
<InstalledControls
|
||||
serverId={serverId}
|
||||
plugin={plugin}
|
||||
repositoryUrl={listing?.repository.url}
|
||||
onRemoved={onRemoved}
|
||||
/>
|
||||
);
|
||||
if (!listing) return null;
|
||||
return (
|
||||
<ListingInstallControl
|
||||
listing={listing}
|
||||
operation={installOperation}
|
||||
onInstall={onInstall}
|
||||
primary
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* A plugin's page: what it is, its install or on/off control, its own settings, its overview and
|
||||
* the facts about where it came from. The same page serves an installed plugin and a listing.
|
||||
*/
|
||||
export function PluginPage({
|
||||
serverId,
|
||||
subject,
|
||||
onBack,
|
||||
}: {
|
||||
serverId: string;
|
||||
subject: PluginPageSubject;
|
||||
onBack(): void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const compact = useIsCompactFormFactor();
|
||||
const { plugin, listingId, listing, detail, loading } = useResolvedPlugin(serverId, subject);
|
||||
const installOperation = usePluginOperation(serverId, listingId);
|
||||
const model = usePluginPageModel({
|
||||
serverId,
|
||||
subject,
|
||||
plugin,
|
||||
listing,
|
||||
detail: detail.data,
|
||||
installOperation,
|
||||
});
|
||||
const [installTarget, setInstallTarget] = useState<InstallTarget | null>(null);
|
||||
const install = useCallback(
|
||||
(target: PluginListing) => setInstallTarget({ kind: "listing", listing: target }),
|
||||
[],
|
||||
);
|
||||
const closeInstall = useCallback(() => setInstallTarget(null), []);
|
||||
// An installed page finds its listing through the plugin, which uninstalling removes. A listed
|
||||
// plugin's page becomes its listing's page, offering Install again; any other returns to Plugins.
|
||||
const onRemoved = useCallback(() => {
|
||||
if (subject.kind !== "installed") return;
|
||||
if (listingId) router.replace(buildPluginListingRoute(serverId, listingId));
|
||||
else onBack();
|
||||
}, [listingId, onBack, serverId, subject.kind]);
|
||||
|
||||
const back = compact ? null : (
|
||||
<Button onPress={onBack} variant="ghost" leftIcon={ArrowLeft} style={styles.back}>
|
||||
{t("settings.plugins.screens.backToPlugins")}
|
||||
</Button>
|
||||
);
|
||||
if (loading)
|
||||
return (
|
||||
<View>
|
||||
{back}
|
||||
<PluginPageSkeleton />
|
||||
</View>
|
||||
);
|
||||
if (!plugin && !listing)
|
||||
return (
|
||||
<Alert
|
||||
size="sm"
|
||||
variant="warning"
|
||||
title={t("settings.plugins.gallery.missing")}
|
||||
description={detail.error ? pluginErrorText(detail.error) : undefined}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<View>
|
||||
{back}
|
||||
<View style={styles.header}>
|
||||
<PluginTile name={model.name} icon={listing?.icon} size="lg" />
|
||||
<View style={styles.identity}>
|
||||
<View style={styles.nameRow}>
|
||||
<Text style={styles.name} numberOfLines={1} testID="plugin-page-name">
|
||||
{model.name}
|
||||
</Text>
|
||||
{plugin && model.error ? (
|
||||
<StatusBadge label={t("settings.plugins.status.failed")} variant="error" size="xs" />
|
||||
) : null}
|
||||
</View>
|
||||
{model.metaLine ? (
|
||||
<PluginMeta text={model.metaLine} authorAvatar={model.authorAvatar} />
|
||||
) : null}
|
||||
</View>
|
||||
<HeaderControl
|
||||
serverId={serverId}
|
||||
plugin={plugin}
|
||||
listing={listing}
|
||||
installOperation={installOperation}
|
||||
onInstall={install}
|
||||
onRemoved={onRemoved}
|
||||
/>
|
||||
</View>
|
||||
<PluginPageBody
|
||||
serverId={serverId}
|
||||
plugin={plugin}
|
||||
listing={listing}
|
||||
overviewLoading={detail.isLoading}
|
||||
model={model}
|
||||
/>
|
||||
{installTarget ? (
|
||||
<InstallPluginSheet serverId={serverId} target={installTarget} onClose={closeInstall} />
|
||||
) : null}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
function PluginPageBody({
|
||||
serverId,
|
||||
plugin,
|
||||
listing,
|
||||
overviewLoading,
|
||||
model,
|
||||
}: {
|
||||
serverId: string;
|
||||
plugin?: PluginListItem;
|
||||
listing?: PluginListing;
|
||||
overviewLoading: boolean;
|
||||
model: PluginPageModel;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<>
|
||||
{plugin ? <PluginsOffAlert serverId={serverId} /> : null}
|
||||
{model.description ? <Text style={styles.description}>{model.description}</Text> : null}
|
||||
{model.error ? (
|
||||
<View style={styles.block}>
|
||||
<Alert size="sm" variant="error" title={model.error} />
|
||||
</View>
|
||||
) : null}
|
||||
{model.updateError ? (
|
||||
<View style={styles.block}>
|
||||
<Alert size="sm" variant="error" title={model.updateError} />
|
||||
</View>
|
||||
) : null}
|
||||
{listing ? <MediaStrip urls={listingImages(listing)} /> : null}
|
||||
{plugin && model.screenId ? (
|
||||
// The plugin's settings screen brings its own sections.
|
||||
<PluginSettingsContent serverId={serverId} pluginId={plugin.id} screenId={model.screenId} />
|
||||
) : null}
|
||||
{model.overview || (listing && overviewLoading) ? (
|
||||
<SettingsSection title={t("settings.plugins.gallery.sections.overview")}>
|
||||
{model.overview ? (
|
||||
<SettingsCard>
|
||||
<View style={styles.overview}>
|
||||
<MarkdownRenderer text={model.overview} external />
|
||||
</View>
|
||||
</SettingsCard>
|
||||
) : (
|
||||
<OverviewSkeleton />
|
||||
)}
|
||||
</SettingsSection>
|
||||
) : null}
|
||||
<Details plugin={plugin} listing={listing} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
back: { alignSelf: "flex-start", paddingHorizontal: 0, marginBottom: theme.spacing[4] },
|
||||
header: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[3],
|
||||
marginBottom: theme.spacing[4],
|
||||
},
|
||||
identity: { flex: 1, minWidth: 0, gap: theme.spacing[1] },
|
||||
nameRow: { flexDirection: "row", alignItems: "center", gap: theme.spacing[2] },
|
||||
name: { flexShrink: 1, color: theme.colors.foreground, fontSize: theme.fontSize.xl },
|
||||
controls: { flexDirection: "row", alignItems: "center", gap: theme.spacing[2] },
|
||||
description: {
|
||||
color: theme.colors.foreground,
|
||||
fontSize: theme.fontSize.base,
|
||||
marginBottom: theme.spacing[6],
|
||||
},
|
||||
block: { marginBottom: theme.spacing[6] },
|
||||
// The settings row's padding, so the overview's text sits where a row's label would.
|
||||
overview: { padding: theme.spacing[4] },
|
||||
mediaStrip: { flexGrow: 0, marginBottom: theme.spacing[6] },
|
||||
mediaRow: { gap: theme.spacing[3] },
|
||||
media: {
|
||||
height: 180,
|
||||
aspectRatio: 16 / 10,
|
||||
borderRadius: theme.borderRadius.lg,
|
||||
borderWidth: 1,
|
||||
borderColor: theme.colors.border,
|
||||
backgroundColor: theme.colors.surface2,
|
||||
overflow: "hidden",
|
||||
},
|
||||
mediaImage: { width: "100%", height: "100%" },
|
||||
detailValue: {
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontSize: theme.fontSize.base,
|
||||
maxWidth: 320,
|
||||
},
|
||||
}));
|
||||
@@ -1,202 +0,0 @@
|
||||
import { ChevronRight } from "lucide-react-native";
|
||||
import { useCallback, useMemo, type ReactNode } from "react";
|
||||
import { Image, Text, View, type PressableStateCallbackType } from "react-native";
|
||||
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||
import { foregroundIconColorMapping, mutedIconColorMapping } from "@/components/ui/icon-color";
|
||||
import { PressHighlight } from "@/components/ui/press-highlight";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
import { ICON_SIZE } from "@/styles/theme";
|
||||
|
||||
const ThemedChevron = withUnistyles(ChevronRight);
|
||||
type HoverState = PressableStateCallbackType & { hovered?: boolean };
|
||||
|
||||
/** A plugin's icon, or its initial on a neutral tile when it has none. */
|
||||
export function PluginTile({
|
||||
name,
|
||||
icon,
|
||||
size = "md",
|
||||
}: {
|
||||
name: string;
|
||||
icon?: string;
|
||||
size?: "md" | "lg";
|
||||
}) {
|
||||
const tileStyle = useMemo(() => [styles.tile, size === "lg" && styles.tileLarge], [size]);
|
||||
const source = useMemo(() => (icon ? { uri: icon } : null), [icon]);
|
||||
if (source) return <Image source={source} style={tileStyle} accessibilityIgnoresInvertColors />;
|
||||
return (
|
||||
<View style={tileStyle}>
|
||||
<Text style={size === "lg" ? styles.initialLarge : styles.initial}>
|
||||
{name.slice(0, 1).toUpperCase()}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
/** A listing author's GitHub picture, before their name in a meta line. */
|
||||
export function AuthorAvatar({ url }: { url: string }) {
|
||||
const source = useMemo(() => ({ uri: url }), [url]);
|
||||
return <Image source={source} style={styles.avatar} accessibilityIgnoresInvertColors />;
|
||||
}
|
||||
|
||||
/** A line of facts, led by the author's picture when the plugin is listed. */
|
||||
export function PluginMeta({
|
||||
text,
|
||||
authorAvatar,
|
||||
testID,
|
||||
}: {
|
||||
text: string;
|
||||
authorAvatar?: string;
|
||||
testID?: string;
|
||||
}) {
|
||||
return (
|
||||
<View style={styles.metaRow} testID={testID}>
|
||||
{authorAvatar ? <AuthorAvatar url={authorAvatar} /> : null}
|
||||
<Text style={styles.metaText} numberOfLines={1}>
|
||||
{text}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export interface PluginRowProps {
|
||||
name: string;
|
||||
icon?: string;
|
||||
/** Beside the name, such as a Failed badge. */
|
||||
badge?: ReactNode;
|
||||
description?: string;
|
||||
/** Who made it and which version, or how many installs. */
|
||||
meta?: string;
|
||||
/** The listing author's picture, before the meta line. */
|
||||
authorAvatar?: string;
|
||||
/** Replaces the meta line: what went wrong, in the row the user is looking at. */
|
||||
error?: string;
|
||||
/** The row's control: a switch, or the install or update button. The chevron follows it. */
|
||||
children?: ReactNode;
|
||||
onPress(): void;
|
||||
accessibilityLabel: string;
|
||||
testID?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* One plugin in a card: icon, name, a line of description and a line of facts. The whole row opens
|
||||
* the plugin's page; the control in the trailing slot acts without opening it.
|
||||
*/
|
||||
export function PluginRow({
|
||||
name,
|
||||
icon,
|
||||
badge,
|
||||
description,
|
||||
meta,
|
||||
authorAvatar,
|
||||
error,
|
||||
children,
|
||||
onPress,
|
||||
accessibilityLabel,
|
||||
testID,
|
||||
}: PluginRowProps) {
|
||||
const rowStyle = useCallback(
|
||||
({ hovered }: HoverState) => [settingsStyles.row, styles.row, hovered && styles.hovered],
|
||||
[],
|
||||
);
|
||||
return (
|
||||
<PressHighlight
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={accessibilityLabel}
|
||||
onPress={onPress}
|
||||
style={rowStyle}
|
||||
highlightStyle={styles.pressed}
|
||||
testID={testID}
|
||||
>
|
||||
{({ hovered }: HoverState) => (
|
||||
<>
|
||||
<PluginTile name={name} icon={icon} />
|
||||
<View style={styles.text}>
|
||||
<View style={styles.titleRow}>
|
||||
<Text style={styles.title} numberOfLines={1}>
|
||||
{name}
|
||||
</Text>
|
||||
{badge}
|
||||
</View>
|
||||
{description ? (
|
||||
<Text style={styles.description} numberOfLines={1}>
|
||||
{description}
|
||||
</Text>
|
||||
) : null}
|
||||
{error ? (
|
||||
<Text accessibilityRole="alert" style={styles.error} numberOfLines={2}>
|
||||
{error}
|
||||
</Text>
|
||||
) : null}
|
||||
{meta && !error ? (
|
||||
<View style={styles.meta}>
|
||||
<PluginMeta text={meta} authorAvatar={authorAvatar} />
|
||||
</View>
|
||||
) : null}
|
||||
</View>
|
||||
{children}
|
||||
<View style={styles.chevron}>
|
||||
<ThemedChevron
|
||||
size={ICON_SIZE.sm}
|
||||
uniProps={hovered ? foregroundIconColorMapping : mutedIconColorMapping}
|
||||
/>
|
||||
</View>
|
||||
</>
|
||||
)}
|
||||
</PressHighlight>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
row: { gap: theme.spacing[3] },
|
||||
hovered: { backgroundColor: theme.colors.surface2 },
|
||||
pressed: { backgroundColor: theme.colors.surface3 },
|
||||
tile: {
|
||||
width: theme.spacing[8],
|
||||
height: theme.spacing[8],
|
||||
borderRadius: theme.borderRadius.lg,
|
||||
borderWidth: 1,
|
||||
borderColor: theme.colors.border,
|
||||
backgroundColor: theme.colors.surface2,
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
overflow: "hidden",
|
||||
},
|
||||
tileLarge: {
|
||||
width: theme.spacing[12],
|
||||
height: theme.spacing[12],
|
||||
borderRadius: theme.borderRadius.xl,
|
||||
},
|
||||
initial: { color: theme.colors.foregroundMuted, fontSize: theme.fontSize.base },
|
||||
initialLarge: { color: theme.colors.foregroundMuted, fontSize: theme.fontSize.xl },
|
||||
text: { flex: 1, minWidth: 0 },
|
||||
titleRow: { flexDirection: "row", alignItems: "center", gap: theme.spacing[2] },
|
||||
title: { flexShrink: 1, color: theme.colors.foreground, fontSize: theme.fontSize.base },
|
||||
description: {
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontSize: theme.fontSize.sm,
|
||||
marginTop: theme.spacing[0.5],
|
||||
},
|
||||
meta: { marginTop: theme.spacing[0.5] },
|
||||
metaRow: { flexDirection: "row", alignItems: "center", gap: theme.spacing[1.5] },
|
||||
metaText: {
|
||||
flexShrink: 1,
|
||||
color: theme.colors.foregroundExtraMuted,
|
||||
fontSize: theme.fontSize.sm,
|
||||
},
|
||||
avatar: {
|
||||
width: theme.iconSize.sm,
|
||||
height: theme.iconSize.sm,
|
||||
borderRadius: theme.borderRadius.full,
|
||||
borderWidth: 1,
|
||||
borderColor: theme.colors.border,
|
||||
backgroundColor: theme.colors.surface2,
|
||||
},
|
||||
error: {
|
||||
color: theme.colors.statusDanger,
|
||||
fontSize: theme.fontSize.sm,
|
||||
marginTop: theme.spacing[0.5],
|
||||
},
|
||||
// Optical: the chevron's ink sits about 4px inside its box; this puts it on the card's trailing
|
||||
// rail, the same as SettingsRowHeader.
|
||||
chevron: { marginRight: -theme.spacing[1] },
|
||||
}));
|
||||
@@ -1,48 +0,0 @@
|
||||
import { useCallback, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { View } from "react-native";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import { Alert } from "@/components/ui/alert";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useToast } from "@/contexts/toast-api-context";
|
||||
import { useDaemonConfig } from "@/hooks/use-daemon-config";
|
||||
import { useHostLabel } from "./install-sheet";
|
||||
import { pluginErrorText } from "./error-text";
|
||||
|
||||
/** Says that installed plugins are not running on this host, with the switch that runs them. */
|
||||
export function PluginsOffAlert({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const toast = useToast();
|
||||
const hostLabel = useHostLabel(serverId);
|
||||
const { config, patchConfig } = useDaemonConfig(serverId);
|
||||
const [turningOn, setTurningOn] = useState(false);
|
||||
const turnOn = useCallback(async () => {
|
||||
setTurningOn(true);
|
||||
try {
|
||||
await patchConfig({ pluginsEnabled: true });
|
||||
} catch (error) {
|
||||
toast.error(pluginErrorText(error));
|
||||
} finally {
|
||||
setTurningOn(false);
|
||||
}
|
||||
}, [patchConfig, toast]);
|
||||
if (!config || config.pluginsEnabled === true) return null;
|
||||
return (
|
||||
<View style={styles.block}>
|
||||
<Alert
|
||||
size="sm"
|
||||
variant="warning"
|
||||
title={t("settings.plugins.gallery.off.title", { host: hostLabel })}
|
||||
testID="plugins-off"
|
||||
>
|
||||
<Button variant="outline" onPress={turnOn} loading={turningOn}>
|
||||
{t("settings.plugins.gallery.actions.turnOn")}
|
||||
</Button>
|
||||
</Alert>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
block: { marginBottom: theme.spacing[6] },
|
||||
}));
|
||||
@@ -1,112 +0,0 @@
|
||||
import { useCallback, useEffect } from "react";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { usePluginList } from "@/plugins/plugin-list";
|
||||
import { useFetchQuery } from "@/data/query";
|
||||
import { useHostFeature } from "@/runtime/host-features";
|
||||
import { useHostRuntimeClient, useHostRuntimeIsConnected } from "@/runtime/host-runtime";
|
||||
import { pluginUpdatesQueryKey } from "./operations";
|
||||
|
||||
// The directory changes when a maintainer publishes, not while someone browses. These queries
|
||||
// refetch on mount only once stale, so opening a plugin's page does not fetch them again.
|
||||
const DIRECTORY_STALE_MS = 10 * 60_000;
|
||||
|
||||
function useHostReady(serverId: string) {
|
||||
const client = useHostRuntimeClient(serverId);
|
||||
const connected = useHostRuntimeIsConnected(serverId);
|
||||
return { client, ready: Boolean(client && connected) };
|
||||
}
|
||||
|
||||
/** The host's plugin directory. `supported` is false until the host proxies the registry. */
|
||||
export function usePluginDirectory(serverId: string) {
|
||||
const { client, ready } = useHostReady(serverId);
|
||||
// COMPAT(pluginRegistry): added in v0.16.0, remove gate after 2027-05-15.
|
||||
const supported = useHostFeature(serverId, "pluginRegistry");
|
||||
const query = useFetchQuery({
|
||||
queryKey: ["plugin-directory", serverId] as const,
|
||||
queryFn: () => {
|
||||
if (!client) throw new Error("Plugin host is offline");
|
||||
return client.listPluginRegistry();
|
||||
},
|
||||
enabled: ready && supported,
|
||||
dataShape: "value",
|
||||
staleTimeMs: DIRECTORY_STALE_MS,
|
||||
refetchOnMount: true,
|
||||
});
|
||||
return { supported, query };
|
||||
}
|
||||
|
||||
/** One listing with its overview. */
|
||||
export function usePluginListing(serverId: string, listingId: string | undefined) {
|
||||
const { client, ready } = useHostReady(serverId);
|
||||
// COMPAT(pluginRegistry): added in v0.16.0, remove gate after 2027-05-15.
|
||||
const supported = useHostFeature(serverId, "pluginRegistry");
|
||||
return useFetchQuery({
|
||||
queryKey: ["plugin-listing", serverId, listingId] as const,
|
||||
queryFn: () => {
|
||||
if (!client || !listingId) throw new Error("Plugin host is offline");
|
||||
return client.getRegistryPlugin(listingId);
|
||||
},
|
||||
enabled: ready && supported && listingId !== undefined,
|
||||
dataShape: "value",
|
||||
staleTimeMs: DIRECTORY_STALE_MS,
|
||||
refetchOnMount: true,
|
||||
});
|
||||
}
|
||||
|
||||
/** Installed plugins with a newer reviewed version, by plugin ID. */
|
||||
export function usePluginUpdates(serverId: string) {
|
||||
const { client, ready } = useHostReady(serverId);
|
||||
// COMPAT(pluginSourceUpdates): added in v0.8.0, remove gate after 2027-03-16.
|
||||
const supported = useHostFeature(serverId, "pluginSourceUpdates");
|
||||
return useFetchQuery({
|
||||
queryKey: pluginUpdatesQueryKey(serverId),
|
||||
queryFn: () => {
|
||||
if (!client) throw new Error("Plugin host is offline");
|
||||
return client.previewPluginUpdates();
|
||||
},
|
||||
enabled: ready && supported,
|
||||
dataShape: "list",
|
||||
staleTimeMs: DIRECTORY_STALE_MS,
|
||||
refetchOnMount: true,
|
||||
select: (previews) => previews.filter((preview) => preview.outcome === "update"),
|
||||
});
|
||||
}
|
||||
|
||||
/** Refetches the plugin list when another client or the CLI changes it. */
|
||||
function usePluginCatalogFeed(serverId: string, refetch: () => unknown) {
|
||||
const client = useHostRuntimeClient(serverId);
|
||||
const connected = useHostRuntimeIsConnected(serverId);
|
||||
const supported = useHostFeature(serverId, "pluginManagement");
|
||||
useEffect(() => {
|
||||
if (!client || !connected || !supported) return;
|
||||
const observation = client.observeEvents(["status.plugin_catalog_changed"]);
|
||||
observation.subscribe({
|
||||
snapshot: () => {},
|
||||
update: (message) => {
|
||||
if (message.type === "status" && message.payload.status === "plugin_catalog_changed")
|
||||
void refetch();
|
||||
},
|
||||
});
|
||||
return () => {
|
||||
void observation
|
||||
.release()
|
||||
.catch((error) => console.warn("[Plugins] Failed to release settings feed", error));
|
||||
};
|
||||
}, [client, connected, supported, refetch]);
|
||||
}
|
||||
|
||||
/**
|
||||
* The host's plugins, refetched whenever another client or the CLI changes them. A change also
|
||||
* re-checks updates, whose proposals name the revision each plugin had when checked.
|
||||
*/
|
||||
export function useLivePluginList(serverId: string) {
|
||||
const plugins = usePluginList(serverId);
|
||||
const queryClient = useQueryClient();
|
||||
const { refetch } = plugins;
|
||||
const refresh = useCallback(() => {
|
||||
void queryClient.invalidateQueries({ queryKey: pluginUpdatesQueryKey(serverId) });
|
||||
return refetch();
|
||||
}, [queryClient, refetch, serverId]);
|
||||
usePluginCatalogFeed(serverId, refresh);
|
||||
return plugins;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
/** An installed plugin's page. Its settings screens open at `buildPluginSettingsRoute`. */
|
||||
export function buildPluginPageRoute(serverId: string, pluginId: string) {
|
||||
return {
|
||||
pathname: "/settings/hosts/[serverId]/plugins/[pluginId]" as const,
|
||||
params: { serverId, pluginId },
|
||||
};
|
||||
}
|
||||
|
||||
/** A directory listing's page, by its `owner/slug` ID. */
|
||||
export function buildPluginListingRoute(serverId: string, listingId: string) {
|
||||
const [owner = "", slug = ""] = listingId.split("/");
|
||||
return {
|
||||
pathname: "/settings/hosts/[serverId]/plugin-directory/[owner]/[slug]" as const,
|
||||
params: { serverId, owner, slug },
|
||||
};
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
import { useMemo } from "react";
|
||||
import { View, type Animated } from "react-native";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import { SettingsCard } from "@/components/settings";
|
||||
import { SkeletonPulse, useSkeletonPulse } from "@/components/ui/skeleton";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
|
||||
const ROWS = [0, 1, 2, 3];
|
||||
const LINES = [0, 1, 2];
|
||||
|
||||
function RowSkeleton({ pulse }: { pulse: Animated.Value }) {
|
||||
const rowStyle = useMemo(() => [settingsStyles.row, styles.row], []);
|
||||
return (
|
||||
<View style={rowStyle}>
|
||||
<SkeletonPulse pulse={pulse} style={styles.tile} />
|
||||
<View style={styles.text}>
|
||||
<SkeletonPulse pulse={pulse} style={styles.title} />
|
||||
<SkeletonPulse pulse={pulse} style={styles.line} />
|
||||
</View>
|
||||
<SkeletonPulse pulse={pulse} style={styles.control} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
/** A card of plugin rows while the list or the directory loads. */
|
||||
export function PluginRowsSkeleton({ testID }: { testID?: string }) {
|
||||
const pulse = useSkeletonPulse();
|
||||
return (
|
||||
<SettingsCard testID={testID}>
|
||||
{ROWS.map((row) => (
|
||||
<RowSkeleton key={row} pulse={pulse} />
|
||||
))}
|
||||
</SettingsCard>
|
||||
);
|
||||
}
|
||||
|
||||
/** Lines of text in a card, where the overview will be. */
|
||||
export function OverviewSkeleton() {
|
||||
const pulse = useSkeletonPulse();
|
||||
return (
|
||||
<SettingsCard>
|
||||
<View style={styles.overview}>
|
||||
{LINES.map((line) => (
|
||||
<SkeletonPulse key={line} pulse={pulse} style={line === 2 ? styles.short : styles.line} />
|
||||
))}
|
||||
</View>
|
||||
</SettingsCard>
|
||||
);
|
||||
}
|
||||
|
||||
/** The plugin page's header and description before anything about the plugin is known. */
|
||||
export function PluginPageSkeleton() {
|
||||
const pulse = useSkeletonPulse();
|
||||
return (
|
||||
<View testID="plugin-page-skeleton">
|
||||
<View style={styles.header}>
|
||||
<SkeletonPulse pulse={pulse} style={styles.tileLarge} />
|
||||
<View style={styles.text}>
|
||||
<SkeletonPulse pulse={pulse} style={styles.name} />
|
||||
<SkeletonPulse pulse={pulse} style={styles.title} />
|
||||
</View>
|
||||
<SkeletonPulse pulse={pulse} style={styles.control} />
|
||||
</View>
|
||||
<View style={styles.description}>
|
||||
<SkeletonPulse pulse={pulse} style={styles.line} />
|
||||
<SkeletonPulse pulse={pulse} style={styles.short} />
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
// The shapes take the size of what they stand for: a row's tile and text, the page's large tile and
|
||||
// name, and a button.
|
||||
const styles = StyleSheet.create((theme) => {
|
||||
const shape = { backgroundColor: theme.colors.surface2, borderRadius: theme.borderRadius.sm };
|
||||
return {
|
||||
row: { gap: theme.spacing[3] },
|
||||
header: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: theme.spacing[3],
|
||||
marginBottom: theme.spacing[4],
|
||||
},
|
||||
text: { flex: 1, minWidth: 0, gap: theme.spacing[2] },
|
||||
tile: {
|
||||
...shape,
|
||||
width: theme.spacing[8],
|
||||
height: theme.spacing[8],
|
||||
borderRadius: theme.borderRadius.lg,
|
||||
},
|
||||
tileLarge: {
|
||||
...shape,
|
||||
width: theme.spacing[12],
|
||||
height: theme.spacing[12],
|
||||
borderRadius: theme.borderRadius.xl,
|
||||
},
|
||||
name: { ...shape, width: 180, height: theme.fontSize.xl },
|
||||
title: { ...shape, width: 140, height: theme.fontSize.sm },
|
||||
line: { ...shape, width: "100%", maxWidth: 420, height: theme.fontSize.sm },
|
||||
short: { ...shape, width: "60%", maxWidth: 260, height: theme.fontSize.sm },
|
||||
control: { ...shape, width: 72, height: 28, borderRadius: theme.borderRadius.md },
|
||||
overview: { padding: theme.spacing[4], gap: theme.spacing[3] },
|
||||
description: { gap: theme.spacing[2], marginBottom: theme.spacing[6] },
|
||||
};
|
||||
});
|
||||
@@ -3,17 +3,13 @@ import { useFetchQuery } from "@/data/query";
|
||||
import { useHostFeature } from "@/runtime/host-features";
|
||||
import { useHostRuntimeClient, useHostRuntimeIsConnected } from "@/runtime/host-runtime";
|
||||
|
||||
export function pluginListQueryKey(serverId: string) {
|
||||
return ["plugins", serverId] as const;
|
||||
}
|
||||
|
||||
/** A host's configured plugins, as listed on Settings → Plugins. One cache entry per host. */
|
||||
export function usePluginList(serverId: string, options: { enabled?: boolean } = {}) {
|
||||
const client = useHostRuntimeClient(serverId);
|
||||
const connected = useHostRuntimeIsConnected(serverId);
|
||||
const supported = useHostFeature(serverId, "pluginManagement");
|
||||
return useFetchQuery({
|
||||
queryKey: pluginListQueryKey(serverId),
|
||||
queryKey: ["plugins", serverId] as const,
|
||||
queryFn: async () => {
|
||||
if (!client) throw new Error("Plugin host is offline");
|
||||
return client.listPlugins();
|
||||
|
||||
@@ -283,12 +283,6 @@ export function usePluginCatalogStatus(serverId: string): PluginCatalogStatus {
|
||||
);
|
||||
}
|
||||
|
||||
/** Why the app could not run the plugin's client bundle, updated when the host's catalog changes. */
|
||||
export function usePluginEvaluationError(serverId: string, pluginId: string): string | undefined {
|
||||
const read = () => pluginRegistry.getEvaluationError(serverId, pluginId);
|
||||
return useSyncExternalStore(pluginRegistry.subscribe, read, read);
|
||||
}
|
||||
|
||||
export function usePluginInstallations(pluginId: string): InstalledPlugin[] {
|
||||
const installed = useInstalledPlugins();
|
||||
return useMemo(() => installed.filter((plugin) => plugin.id === pluginId), [installed, pluginId]);
|
||||
|
||||
@@ -3,8 +3,10 @@ import { useTranslation } from "react-i18next";
|
||||
import { Platform, ScrollView, Text, View } from "react-native";
|
||||
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||
import { router } from "expo-router";
|
||||
import { ArrowLeft, Settings } from "lucide-react-native";
|
||||
import type { PluginHostProps } from "@getpaseo/plugin/client";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ToolbarButton, paneContentToolbarIconSize } from "@/components/ui/pane-content-toolbar";
|
||||
import { SegmentedControl, type SegmentedControlOption } from "@/components/ui/segmented-control";
|
||||
import { useIsCompactFormFactor } from "@/constants/layout";
|
||||
import { useHostFeature } from "@/runtime/host-features";
|
||||
@@ -16,6 +18,7 @@ import type { InstalledPlugin } from "../types";
|
||||
import { PluginInstallationProvider } from "../installation-provider";
|
||||
import { SurfaceErrorBoundary } from "../surface-error-boundary";
|
||||
import { toPluginTheme } from "../theme";
|
||||
import { buildPluginSettingsRoute } from "./routes";
|
||||
|
||||
interface SettingsIdentity {
|
||||
serverId: string;
|
||||
@@ -23,6 +26,32 @@ interface SettingsIdentity {
|
||||
screenId: string;
|
||||
}
|
||||
|
||||
const ThemedSettingsIcon = withUnistyles(Settings);
|
||||
const mutedIconMapping = (theme: Theme) => ({ color: theme.colors.foregroundMuted });
|
||||
|
||||
/** Opens the plugin's settings at its first screen. Renders nothing when it has none. */
|
||||
export function PluginSettingsButton({ serverId, pluginId }: Omit<SettingsIdentity, "screenId">) {
|
||||
const { t } = useTranslation();
|
||||
const plugin = useInstalledPlugin(serverId, pluginId);
|
||||
const supported = useHostFeature(serverId, "pluginSettings");
|
||||
const firstScreenId = plugin?.settingsScreens[0]?.id;
|
||||
const open = useCallback(() => {
|
||||
if (firstScreenId) router.push(buildPluginSettingsRoute(serverId, pluginId, firstScreenId));
|
||||
}, [serverId, pluginId, firstScreenId]);
|
||||
const compact = useIsCompactFormFactor();
|
||||
if (!supported || !firstScreenId) return null;
|
||||
return (
|
||||
<ToolbarButton
|
||||
label={t("settings.plugins.actions.settings")}
|
||||
compact={compact}
|
||||
onPress={open}
|
||||
testID={`plugin-settings-${pluginId}`}
|
||||
>
|
||||
<ThemedSettingsIcon size={paneContentToolbarIconSize(compact)} uniProps={mutedIconMapping} />
|
||||
</ToolbarButton>
|
||||
);
|
||||
}
|
||||
|
||||
function renderNoIcon() {
|
||||
return null;
|
||||
}
|
||||
@@ -143,12 +172,30 @@ function SettingsContent({
|
||||
const ThemedSettingsContent = withUnistyles(SettingsContent);
|
||||
// Settings routes carry no screen params.
|
||||
const themeMapping = (theme: Theme) => ({ theme: toPluginTheme(theme) });
|
||||
|
||||
/** One of the plugin's settings screens, with tabs to the others. Renders inside its plugin page. */
|
||||
export function PluginSettingsContent(identity: SettingsIdentity) {
|
||||
return <ThemedSettingsContent {...identity} uniProps={themeMapping} />;
|
||||
export function PluginSettingsContent({
|
||||
onBackToPlugins,
|
||||
showBackToPlugins,
|
||||
...identity
|
||||
}: SettingsIdentity & { onBackToPlugins: () => void; showBackToPlugins: boolean }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<View>
|
||||
{showBackToPlugins ? (
|
||||
<Button
|
||||
onPress={onBackToPlugins}
|
||||
variant="ghost"
|
||||
leftIcon={ArrowLeft}
|
||||
style={styles.backButton}
|
||||
>
|
||||
{t("settings.plugins.screens.backToPlugins")}
|
||||
</Button>
|
||||
) : null}
|
||||
<ThemedSettingsContent {...identity} uniProps={themeMapping} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
message: { color: theme.colors.foregroundMuted },
|
||||
tabs: { flexGrow: 0, marginBottom: theme.spacing[4] },
|
||||
backButton: { alignSelf: "flex-start", paddingHorizontal: 0, marginBottom: theme.spacing[4] },
|
||||
}));
|
||||
|
||||
@@ -108,12 +108,9 @@ import {
|
||||
HostWorkspacesPage,
|
||||
HostTerminalsPage,
|
||||
} from "@/screens/settings/host-page";
|
||||
import {
|
||||
PluginGalleryMenu,
|
||||
PluginGalleryPage,
|
||||
PluginPage,
|
||||
type PluginPageSubject,
|
||||
} from "@/plugins/gallery";
|
||||
import { PluginSettingsContent } from "@/plugins/settings";
|
||||
import { usePluginDisplayName } from "@/plugins/plugin-list";
|
||||
import { HostPluginsPage } from "@/screens/settings/plugins-page";
|
||||
import { MetadataGenerationPage } from "@/screens/settings/metadata-generation-page";
|
||||
import { HostVoicePage } from "@/screens/settings/voice/voice-page";
|
||||
import ProjectsScreen from "@/screens/projects-screen";
|
||||
@@ -283,7 +280,7 @@ function renderHostSettingsContent(
|
||||
case "terminals":
|
||||
return <HostTerminalsPage serverId={view.serverId} />;
|
||||
case "plugins":
|
||||
return <PluginGalleryPage serverId={view.serverId} />;
|
||||
return <HostPluginsPage serverId={view.serverId} />;
|
||||
case "host":
|
||||
return <HostSettingsPage serverId={view.serverId} onHostRemoved={onHostRemoved} />;
|
||||
}
|
||||
@@ -990,7 +987,7 @@ function SettingsSidebar({
|
||||
let selectedHostSection: HostSectionSlug | null = null;
|
||||
if (view.kind === "host") selectedHostSection = view.section;
|
||||
if (view.kind === "project") selectedHostSection = "projects";
|
||||
if (view.kind === "plugin" || view.kind === "pluginListing") selectedHostSection = "plugins";
|
||||
if (view.kind === "plugin") selectedHostSection = "plugins";
|
||||
|
||||
const sidebarBody = (
|
||||
<>
|
||||
@@ -1133,12 +1130,7 @@ export default function SettingsScreen({ view }: SettingsScreenProps) {
|
||||
// The host the four sections scope to: the host on the active view, otherwise
|
||||
// the picker choice, otherwise the connected local daemon, otherwise the first host.
|
||||
const activeHostServerId = useMemo(() => {
|
||||
if (
|
||||
view.kind === "host" ||
|
||||
view.kind === "project" ||
|
||||
view.kind === "plugin" ||
|
||||
view.kind === "pluginListing"
|
||||
)
|
||||
if (view.kind === "host" || view.kind === "project" || view.kind === "plugin")
|
||||
return view.serverId;
|
||||
return resolveActiveHostServerId({
|
||||
selectedServerId: selectedSettingsHostServerId,
|
||||
@@ -1271,20 +1263,10 @@ export default function SettingsScreen({ view }: SettingsScreenProps) {
|
||||
returnFromSettings({ kind: "root" });
|
||||
}, []);
|
||||
|
||||
// A plugin's page draws its own header; the compact back header names the plugin.
|
||||
const pluginPage = useMemo((): { serverId: string; subject: PluginPageSubject } | null => {
|
||||
if (view.kind === "plugin")
|
||||
return {
|
||||
serverId: view.serverId,
|
||||
subject: { kind: "installed", pluginId: view.pluginId, screenId: view.screenId },
|
||||
};
|
||||
if (view.kind === "pluginListing")
|
||||
return { serverId: view.serverId, subject: { kind: "listing", listingId: view.listingId } };
|
||||
return null;
|
||||
}, [view]);
|
||||
// The header names the plugin; its tabs name the open settings screen.
|
||||
const pluginDisplayName = usePluginDisplayName(view.kind === "plugin" ? view : null);
|
||||
const detailTitle = ((): string | undefined => {
|
||||
// The plugin page heads itself with the plugin's name and icon.
|
||||
if (pluginPage) return undefined;
|
||||
if (view.kind === "plugin") return pluginDisplayName;
|
||||
if (view.kind === "host") {
|
||||
const item = HOST_SECTION_ITEMS.find((s) => s.id === view.section);
|
||||
return item ? t(item.labelKey) : undefined;
|
||||
@@ -1299,23 +1281,15 @@ export default function SettingsScreen({ view }: SettingsScreenProps) {
|
||||
return undefined;
|
||||
})();
|
||||
|
||||
const pluginGalleryServerId =
|
||||
view.kind === "host" && view.section === "plugins" ? view.serverId : null;
|
||||
const detailActions = useMemo(
|
||||
() =>
|
||||
pluginGalleryServerId ? <PluginGalleryMenu serverId={pluginGalleryServerId} /> : undefined,
|
||||
[pluginGalleryServerId],
|
||||
);
|
||||
// The gallery and a plugin's page share one width, so opening a plugin keeps the page edges put.
|
||||
const detailWidth = pluginGalleryServerId || pluginPage ? "wide" : "default";
|
||||
|
||||
const content: ReactNode = (() => {
|
||||
if (pluginPage)
|
||||
if (view.kind === "plugin")
|
||||
return (
|
||||
<PluginPage
|
||||
serverId={pluginPage.serverId}
|
||||
subject={pluginPage.subject}
|
||||
onBack={handleBackFromDetail}
|
||||
<PluginSettingsContent
|
||||
serverId={view.serverId}
|
||||
pluginId={view.pluginId}
|
||||
screenId={view.screenId}
|
||||
onBackToPlugins={handleBackFromDetail}
|
||||
showBackToPlugins={!isCompactLayout}
|
||||
/>
|
||||
);
|
||||
if (view.kind === "host") {
|
||||
@@ -1399,12 +1373,7 @@ export default function SettingsScreen({ view }: SettingsScreenProps) {
|
||||
if (isCompactLayout) {
|
||||
return (
|
||||
<View style={styles.container} onLayout={onContentLayout}>
|
||||
<PageLayout
|
||||
title={detailTitle}
|
||||
onBack={handleBackFromDetail}
|
||||
actions={detailActions}
|
||||
width={detailWidth}
|
||||
>
|
||||
<PageLayout title={detailTitle} onBack={handleBackFromDetail}>
|
||||
{content}
|
||||
</PageLayout>
|
||||
</View>
|
||||
@@ -1433,8 +1402,6 @@ export default function SettingsScreen({ view }: SettingsScreenProps) {
|
||||
<View style={desktopStyles.contentPane} testID="settings-detail-pane">
|
||||
<PageLayout
|
||||
title={detailTitle}
|
||||
actions={detailActions}
|
||||
width={detailWidth}
|
||||
titleTestID="settings-detail-header-title"
|
||||
testID="settings-detail-scroll-body"
|
||||
>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { openPluginInstallForm } from "./plugin-install-form-model";
|
||||
|
||||
describe("plugin install form", () => {
|
||||
it("keeps the edited source in the submission until explicitly reset", () => {
|
||||
const model = openPluginInstallForm();
|
||||
|
||||
model.setSource("owner/review");
|
||||
|
||||
expect(model.getSubmission()).toEqual({ source: "owner/review" });
|
||||
|
||||
model.reset();
|
||||
expect(model.getState()).toEqual({
|
||||
source: "",
|
||||
canSubmit: false,
|
||||
resetKey: 1,
|
||||
});
|
||||
});
|
||||
|
||||
it("trims the submitted source", () => {
|
||||
const model = openPluginInstallForm();
|
||||
model.setSource(" /plugins/review ");
|
||||
expect(model.getSubmission()).toEqual({ source: "/plugins/review" });
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,53 @@
|
||||
export interface PluginInstallFormState {
|
||||
source: string;
|
||||
canSubmit: boolean;
|
||||
resetKey: number;
|
||||
}
|
||||
|
||||
export interface PluginInstallSubmission {
|
||||
source: string;
|
||||
}
|
||||
|
||||
export interface PluginInstallFormModel {
|
||||
getState(): PluginInstallFormState;
|
||||
subscribe(listener: () => void): () => void;
|
||||
close(): void;
|
||||
setSource(value: string): void;
|
||||
getSubmission(): PluginInstallSubmission;
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
export function openPluginInstallForm(): PluginInstallFormModel {
|
||||
const listeners = new Set<() => void>();
|
||||
let state: PluginInstallFormState = {
|
||||
source: "",
|
||||
canSubmit: false,
|
||||
resetKey: 0,
|
||||
};
|
||||
|
||||
const publish = (next: Pick<PluginInstallFormState, "source" | "resetKey">) => {
|
||||
state = { ...next, canSubmit: next.source.trim().length > 0 };
|
||||
for (const listener of listeners) listener();
|
||||
};
|
||||
|
||||
return {
|
||||
getState: () => state,
|
||||
subscribe(listener) {
|
||||
listeners.add(listener);
|
||||
return () => listeners.delete(listener);
|
||||
},
|
||||
close() {
|
||||
listeners.clear();
|
||||
},
|
||||
setSource(source) {
|
||||
publish({ ...state, source });
|
||||
},
|
||||
getSubmission() {
|
||||
const source = state.source.trim();
|
||||
return { source };
|
||||
},
|
||||
reset() {
|
||||
publish({ source: "", resetKey: state.resetKey + 1 });
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolvePluginPageState } from "./plugins-page-state";
|
||||
|
||||
describe("resolvePluginPageState", () => {
|
||||
it.each([
|
||||
["offline", false, false, false, false, 0],
|
||||
["unsupported", true, false, false, false, 0],
|
||||
["loading", true, true, true, false, 0],
|
||||
["error", true, true, false, true, 0],
|
||||
["empty", true, true, false, false, 0],
|
||||
["ready", true, true, false, false, 1],
|
||||
] as const)("resolves %s", (expected, connected, supported, loading, error, pluginCount) => {
|
||||
expect(resolvePluginPageState({ connected, supported, loading, error, pluginCount })).toBe(
|
||||
expected,
|
||||
);
|
||||
});
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user