mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-04 23:44:41 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a972b8c2e | ||
|
|
cc56b392de | ||
|
|
cb331532ad | ||
|
|
da994fb400 | ||
|
|
c4baf750f2 | ||
|
|
31a408d108 | ||
|
|
3be00f5105 | ||
|
|
6e704f803c | ||
|
|
949462f39b | ||
|
|
53d91d63da | ||
|
|
4709b49dc4 | ||
|
|
f938bf963d | ||
|
|
1131241b73 | ||
|
|
ce39ab6f09 | ||
|
|
c242f4d8db | ||
|
|
66aeff70d1 | ||
|
|
adf8badade | ||
|
|
1b45d92dac | ||
|
|
42ed0a8a99 | ||
|
|
d8fca6fdc6 | ||
|
|
77f97f82bc | ||
|
|
26b1e122ae | ||
|
|
7dfb63d0c4 | ||
|
|
5c81d08959 | ||
|
|
96b2bea130 | ||
|
|
33338be16e | ||
|
|
32230e24c5 | ||
|
|
d641cb5179 | ||
|
|
58094053dc | ||
|
|
3f75a11a49 | ||
|
|
f0807c5deb | ||
|
|
e0ff0959a1 | ||
|
|
591dd3bc92 | ||
|
|
8fb31cf8c0 | ||
|
|
b99d2a010d | ||
|
|
41011ddc60 | ||
|
|
e9d440259c | ||
|
|
0d697e6330 | ||
|
|
5413b8122c | ||
|
|
8960e76d19 | ||
|
|
218bcaaa6b | ||
|
|
30cc0a8c21 | ||
|
|
a362664f47 | ||
|
|
20ce734367 | ||
|
|
ca2bdd66eb | ||
|
|
1aaac5b231 | ||
|
|
b60b74384b | ||
|
|
034f639c88 | ||
|
|
55e8cff9f4 | ||
|
|
06be203c5c | ||
|
|
007a8e36ae | ||
|
|
eb6bed8447 | ||
|
|
bfbd4d5175 | ||
|
|
52b84b7835 | ||
|
|
d68271565a | ||
|
|
ce7b14a143 | ||
|
|
c7e137d4b4 | ||
|
|
d37262be56 | ||
|
|
0952ddbd4b | ||
|
|
67628b48fe | ||
|
|
eba5bdf810 | ||
|
|
66676d49e6 | ||
|
|
064243288b | ||
|
|
a880c9619d | ||
|
|
6740d41fab | ||
|
|
ca6b54fc2e | ||
|
|
4cd23a8f17 | ||
|
|
3084f32852 | ||
|
|
ce8196f6c5 | ||
|
|
40b95f70f4 | ||
|
|
93b9ac9ded | ||
|
|
eb8b5b8f94 | ||
|
|
51b9ad7695 | ||
|
|
1c4400194a | ||
|
|
1502b7f90f | ||
|
|
16f688b726 | ||
|
|
b507fc1986 | ||
|
|
e546497a21 | ||
|
|
b807c261ca | ||
|
|
85be2121b8 | ||
|
|
f4eeb8a538 | ||
|
|
e1b20384a1 | ||
|
|
fc710be1af | ||
|
|
66e1523f2f | ||
|
|
336e7d1b89 | ||
|
|
6f6712be62 | ||
|
|
a296bf3502 | ||
|
|
3857ed3365 | ||
|
|
736f7bf042 | ||
|
|
07a2e4accd | ||
|
|
1f64e68987 | ||
|
|
e06adf7a3e | ||
|
|
d2cc18b3a1 | ||
|
|
5062d5ee90 | ||
|
|
71dc9f44c9 | ||
|
|
7495c20f78 | ||
|
|
b92a34ab3d | ||
|
|
8018231a00 | ||
|
|
555818f5f7 | ||
|
|
27caf913f6 | ||
|
|
835bc49487 | ||
|
|
63302287fe | ||
|
|
3e3a707f5a | ||
|
|
d4ac64f335 | ||
|
|
70cb34927a | ||
|
|
b280ca5355 | ||
|
|
da8d58bfee | ||
|
|
7c2812dde6 | ||
|
|
b474beedce | ||
|
|
e2f0779379 | ||
|
|
a166a3317a | ||
|
|
efc64a5443 | ||
|
|
7efa14238d | ||
|
|
dbbcb103ba | ||
|
|
7f318bf7cf | ||
|
|
04fe4be40f | ||
|
|
2d75cc80b2 | ||
|
|
bfac132920 | ||
|
|
34f996b32a | ||
|
|
3e83f433da | ||
|
|
674530152e | ||
|
|
919e44b319 | ||
|
|
4fe44038e3 | ||
|
|
9b0542d127 | ||
|
|
8130147426 | ||
|
|
fa89738e3a |
@@ -135,32 +135,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# Backport electron-builder#10172 to the pinned build tool only.
|
|
||||||
# Remove this step when app-builder-lib is upgraded to a release containing it.
|
|
||||||
- name: Repair temporary keychain password in signing tool
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
node <<'KEYCHAIN_FIX'
|
|
||||||
const fs = require('node:fs');
|
|
||||||
const path = require('node:path');
|
|
||||||
const manifestPath = require.resolve('app-builder-lib/package.json');
|
|
||||||
if (JSON.parse(fs.readFileSync(manifestPath, 'utf8')).version !== '26.8.1') {
|
|
||||||
throw new Error('Reassess/remove the signing backport for the new app-builder-lib version');
|
|
||||||
}
|
|
||||||
const sourcePath = path.join(path.dirname(manifestPath), 'out/codeSign/macCodeSign.js');
|
|
||||||
let source = fs.readFileSync(sourcePath, 'utf8');
|
|
||||||
const replacements = [
|
|
||||||
['importCerts(keychainFile, certPaths, cscPasswords)', 'importCerts(keychainFile, certPaths, cscPasswords, keychainPassword)'],
|
|
||||||
['importCerts(keychainFile, paths, keyPasswords)', 'importCerts(keychainFile, paths, keyPasswords, keychainPassword)'],
|
|
||||||
['["set-key-partition-list", "-S", "apple-tool:,apple:", "-s", "-k", password, keychainFile]', '["set-key-partition-list", "-S", "apple-tool:,apple:", "-s", "-k", keychainPassword, keychainFile]'],
|
|
||||||
];
|
|
||||||
for (const [before, after] of replacements) {
|
|
||||||
if (source.split(before).length !== 2) throw new Error('Unexpected signing tool source; refusing to patch');
|
|
||||||
source = source.replace(before, after);
|
|
||||||
}
|
|
||||||
fs.writeFileSync(sourcePath, source);
|
|
||||||
KEYCHAIN_FIX
|
|
||||||
|
|
||||||
- name: Set desktop package version from tag
|
- name: Set desktop package version from tag
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -406,10 +406,7 @@
|
|||||||
{
|
{
|
||||||
"files": [
|
"files": [
|
||||||
"packages/app/src/app/_layout.tsx",
|
"packages/app/src/app/_layout.tsx",
|
||||||
"packages/app/src/app/pair-scan.tsx",
|
|
||||||
"packages/app/src/components/adaptive-modal-sheet.tsx",
|
"packages/app/src/components/adaptive-modal-sheet.tsx",
|
||||||
"packages/app/src/components/add-host-method-modal.tsx",
|
|
||||||
"packages/app/src/components/add-host-modal.tsx",
|
|
||||||
"packages/app/src/components/agent-list.tsx",
|
"packages/app/src/components/agent-list.tsx",
|
||||||
"packages/app/src/components/agent-status-dot.tsx",
|
"packages/app/src/components/agent-status-dot.tsx",
|
||||||
"packages/app/src/components/attachment-lightbox.tsx",
|
"packages/app/src/components/attachment-lightbox.tsx",
|
||||||
@@ -428,7 +425,6 @@
|
|||||||
"packages/app/src/components/hosts/host-picker.tsx",
|
"packages/app/src/components/hosts/host-picker.tsx",
|
||||||
"packages/app/src/components/icons/paseo-logo.tsx",
|
"packages/app/src/components/icons/paseo-logo.tsx",
|
||||||
"packages/app/src/components/left-sidebar.tsx",
|
"packages/app/src/components/left-sidebar.tsx",
|
||||||
"packages/app/src/components/pair-link-modal.tsx",
|
|
||||||
"packages/app/src/components/plan-card.tsx",
|
"packages/app/src/components/plan-card.tsx",
|
||||||
"packages/app/src/components/provider-diagnostic-sheet.tsx",
|
"packages/app/src/components/provider-diagnostic-sheet.tsx",
|
||||||
"packages/app/src/components/question-form-card.tsx",
|
"packages/app/src/components/question-form-card.tsx",
|
||||||
@@ -543,14 +539,10 @@
|
|||||||
"packages/app/src/agent-skills/selection-sheet.tsx",
|
"packages/app/src/agent-skills/selection-sheet.tsx",
|
||||||
"packages/app/src/agent-stream/chat-outline/rail.web.tsx",
|
"packages/app/src/agent-stream/chat-outline/rail.web.tsx",
|
||||||
"packages/app/src/agent-stream/view.tsx",
|
"packages/app/src/agent-stream/view.tsx",
|
||||||
"packages/app/src/app/pair-scan.tsx",
|
|
||||||
"packages/app/src/changelog/internal/changelog-sheet.tsx",
|
"packages/app/src/changelog/internal/changelog-sheet.tsx",
|
||||||
"packages/app/src/command-center/command-center.tsx",
|
"packages/app/src/command-center/command-center.tsx",
|
||||||
"packages/app/src/components/adaptive-modal-sheet.tsx",
|
"packages/app/src/components/adaptive-modal-sheet.tsx",
|
||||||
"packages/app/src/components/add-host-method-modal.tsx",
|
|
||||||
"packages/app/src/components/add-host-modal.tsx",
|
|
||||||
"packages/app/src/components/add-project-flow.tsx",
|
"packages/app/src/components/add-project-flow.tsx",
|
||||||
"packages/app/src/components/add-remote-ssh-host-modal.tsx",
|
|
||||||
"packages/app/src/components/agent-list.tsx",
|
"packages/app/src/components/agent-list.tsx",
|
||||||
"packages/app/src/components/app-diagnostic-sheet.tsx",
|
"packages/app/src/components/app-diagnostic-sheet.tsx",
|
||||||
"packages/app/src/components/attachment-lightbox.tsx",
|
"packages/app/src/components/attachment-lightbox.tsx",
|
||||||
|
|||||||
+5
-4
@@ -1,8 +1,8 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## 0.15.0-beta.1 - 2026-11-01
|
## 0.15.0 - 2026-11-03
|
||||||
|
|
||||||
Daemon restarts now keep terminal programs running and automatically resume interrupted agents in their existing conversations.
|
Daemon restarts now keep terminal programs running. Interrupted agents can resume in their existing conversations when you turn on agent recovery.
|
||||||
|
|
||||||
Mobile terminals have native rendering and draggable text-selection handles. Reconnecting restores up to 10,000 lines of terminal history.
|
Mobile terminals have native rendering and draggable text-selection handles. Reconnecting restores up to 10,000 lines of terminal history.
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ Worktree setup can copy ignored files and use plugin-defined locations before ag
|
|||||||
- Insert known agent commands from replies into the Composer draft ([#8371](https://github.com/getpaseo/paseo/pull/8371))
|
- Insert known agent commands from replies into the Composer draft ([#8371](https://github.com/getpaseo/paseo/pull/8371))
|
||||||
- Reuse running OpenCode v2 services ([#7435](https://github.com/getpaseo/paseo/pull/7435) by [@mcowger](https://github.com/mcowger))
|
- Reuse running OpenCode v2 services ([#7435](https://github.com/getpaseo/paseo/pull/7435) by [@mcowger](https://github.com/mcowger))
|
||||||
- Kept terminal programs running across daemon restarts, crashes and supported updates ([#7644](https://github.com/getpaseo/paseo/pull/7644), [#8155](https://github.com/getpaseo/paseo/pull/8155) by [@sebastianarena](https://github.com/sebastianarena))
|
- Kept terminal programs running across daemon restarts, crashes and supported updates ([#7644](https://github.com/getpaseo/paseo/pull/7644), [#8155](https://github.com/getpaseo/paseo/pull/8155) by [@sebastianarena](https://github.com/sebastianarena))
|
||||||
- Automatically resume interrupted agents in their existing conversations after a host restart ([#8127](https://github.com/getpaseo/paseo/pull/8127) by [@coolwindX](https://github.com/coolwindX), [@suntianc](https://github.com/suntianc))
|
- Added an opt-in setting to resume interrupted agents in their existing conversations after a host restart ([#8127](https://github.com/getpaseo/paseo/pull/8127), [#8619](https://github.com/getpaseo/paseo/pull/8619) by [@coolwindX](https://github.com/coolwindX), [@suntianc](https://github.com/suntianc))
|
||||||
- Added draggable terminal text-selection handles on iOS and Android ([#8348](https://github.com/getpaseo/paseo/pull/8348))
|
- Added draggable terminal text-selection handles on iOS and Android ([#8348](https://github.com/getpaseo/paseo/pull/8348))
|
||||||
- Let phones and tablets rotate with the system orientation setting ([#8256](https://github.com/getpaseo/paseo/pull/8256) by [@magiclaw](https://github.com/magiclaw), [@yzim](https://github.com/yzim))
|
- Let phones and tablets rotate with the system orientation setting ([#8256](https://github.com/getpaseo/paseo/pull/8256) by [@magiclaw](https://github.com/magiclaw), [@yzim](https://github.com/yzim))
|
||||||
- Copy ignored files selected by `.worktreeinclude` into new worktrees before setup and agents start ([#8100](https://github.com/getpaseo/paseo/pull/8100) by [@cprecioso](https://github.com/cprecioso))
|
- Copy ignored files selected by `.worktreeinclude` into new worktrees before setup and agents start ([#8100](https://github.com/getpaseo/paseo/pull/8100) by [@cprecioso](https://github.com/cprecioso))
|
||||||
@@ -64,6 +64,7 @@ Worktree setup can copy ignored files and use plugin-defined locations before ag
|
|||||||
- Fixed the MiniMax Code catalog command failing to select an executable ([#8201](https://github.com/getpaseo/paseo/pull/8201) by [@Peanut-HZM](https://github.com/Peanut-HZM))
|
- Fixed the MiniMax Code catalog command failing to select an executable ([#8201](https://github.com/getpaseo/paseo/pull/8201) by [@Peanut-HZM](https://github.com/Peanut-HZM))
|
||||||
- Fixed Android keeping the wrong layout after folding or unfolding while backgrounded ([#8285](https://github.com/getpaseo/paseo/pull/8285))
|
- Fixed Android keeping the wrong layout after folding or unfolding while backgrounded ([#8285](https://github.com/getpaseo/paseo/pull/8285))
|
||||||
- Fixed Android workspace layouts and header fades retaining their old size after rotation ([#8349](https://github.com/getpaseo/paseo/pull/8349), [#8377](https://github.com/getpaseo/paseo/pull/8377))
|
- Fixed Android workspace layouts and header fades retaining their old size after rotation ([#8349](https://github.com/getpaseo/paseo/pull/8349), [#8377](https://github.com/getpaseo/paseo/pull/8377))
|
||||||
|
- Fixed chat reconnecting and updating status being hidden behind the header on iOS and Android phones ([#8568](https://github.com/getpaseo/paseo/pull/8568))
|
||||||
- Fixed deleted agents leaving unclosable tabs in another window ([#8248](https://github.com/getpaseo/paseo/pull/8248) by [@loganmeyer](https://github.com/loganmeyer))
|
- Fixed deleted agents leaving unclosable tabs in another window ([#8248](https://github.com/getpaseo/paseo/pull/8248) by [@loganmeyer](https://github.com/loganmeyer))
|
||||||
- Fixed transcript text retaining old theme colors after the theme changes while the window is hidden ([#8199](https://github.com/getpaseo/paseo/pull/8199) by [@Nurshot](https://github.com/Nurshot), [@dansabin](https://github.com/dansabin))
|
- Fixed transcript text retaining old theme colors after the theme changes while the window is hidden ([#8199](https://github.com/getpaseo/paseo/pull/8199) by [@Nurshot](https://github.com/Nurshot), [@dansabin](https://github.com/dansabin))
|
||||||
- Fixed web menus snapping back to their loading size after content arrives ([#8180](https://github.com/getpaseo/paseo/pull/8180) by [@babo-jeonguk](https://github.com/babo-jeonguk))
|
- Fixed web menus snapping back to their loading size after content arrives ([#8180](https://github.com/getpaseo/paseo/pull/8180) by [@babo-jeonguk](https://github.com/babo-jeonguk))
|
||||||
@@ -74,7 +75,7 @@ Worktree setup can copy ignored files and use plugin-defined locations before ag
|
|||||||
### Notes
|
### Notes
|
||||||
|
|
||||||
- The first upgrade from 0.14.0 still closes terminals; terminal preservation starts once the new daemon is installed, and Windows desktop app upgrades still close them
|
- The first upgrade from 0.14.0 still closes terminals; terminal preservation starts once the new daemon is installed, and Windows desktop app upgrades still close them
|
||||||
- Automatic agent recovery is on by default and sends `Resume working.`; change the prompt or disable it in Host settings → Agents
|
- Agent recovery is off by default; turn on **Resume agents after restart** in Host settings → Agents to send `Resume working.` or your own prompt
|
||||||
- Before downgrading to 0.14.0, restore a backed-up `config.json` or remove the saved agent-resume and usage-check settings
|
- Before downgrading to 0.14.0, restore a backed-up `config.json` or remove the saved agent-resume and usage-check settings
|
||||||
|
|
||||||
## 0.14.0 - 2026-10-29
|
## 0.14.0 - 2026-10-29
|
||||||
|
|||||||
+5
-4
@@ -1,8 +1,8 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## 0.15.0-beta.1 - 2026-11-01
|
## 0.15.0 - 2026-11-03
|
||||||
|
|
||||||
daemon 重启后,终端中的程序继续运行,被中断的 Agent 会自动在原有会话中恢复工作。
|
daemon 重启后,终端中的程序继续运行。开启 Agent 恢复后,被中断的 Agent 会在原有会话中恢复工作。
|
||||||
|
|
||||||
移动端终端采用原生渲染,并提供可拖动的文本选择手柄。重新连接时最多恢复 10,000 行终端历史。
|
移动端终端采用原生渲染,并提供可拖动的文本选择手柄。重新连接时最多恢复 10,000 行终端历史。
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ worktree 初始化支持复制被忽略的文件,并在 Agent 启动前使用
|
|||||||
- 点击回复中的已知 Agent 命令,将其插入 Composer 草稿 ([#8371](https://github.com/getpaseo/paseo/pull/8371))
|
- 点击回复中的已知 Agent 命令,将其插入 Composer 草稿 ([#8371](https://github.com/getpaseo/paseo/pull/8371))
|
||||||
- 复用已运行的 OpenCode v2 服务 ([#7435](https://github.com/getpaseo/paseo/pull/7435),贡献者:[@mcowger](https://github.com/mcowger))
|
- 复用已运行的 OpenCode v2 服务 ([#7435](https://github.com/getpaseo/paseo/pull/7435),贡献者:[@mcowger](https://github.com/mcowger))
|
||||||
- 让终端中的程序在 daemon 重启、崩溃和支持的更新过程中继续运行 ([#7644](https://github.com/getpaseo/paseo/pull/7644), [#8155](https://github.com/getpaseo/paseo/pull/8155),贡献者:[@sebastianarena](https://github.com/sebastianarena))
|
- 让终端中的程序在 daemon 重启、崩溃和支持的更新过程中继续运行 ([#7644](https://github.com/getpaseo/paseo/pull/7644), [#8155](https://github.com/getpaseo/paseo/pull/8155),贡献者:[@sebastianarena](https://github.com/sebastianarena))
|
||||||
- 主机重启后,自动在原有会话中恢复被中断的 Agent ([#8127](https://github.com/getpaseo/paseo/pull/8127),贡献者:[@coolwindX](https://github.com/coolwindX), [@suntianc](https://github.com/suntianc))
|
- 新增可选设置,在主机重启后于原有会话中恢复被中断的 Agent ([#8127](https://github.com/getpaseo/paseo/pull/8127), [#8619](https://github.com/getpaseo/paseo/pull/8619),贡献者:[@coolwindX](https://github.com/coolwindX), [@suntianc](https://github.com/suntianc))
|
||||||
- 在 iOS 和 Android 终端中新增可拖动的文本选择手柄 ([#8348](https://github.com/getpaseo/paseo/pull/8348))
|
- 在 iOS 和 Android 终端中新增可拖动的文本选择手柄 ([#8348](https://github.com/getpaseo/paseo/pull/8348))
|
||||||
- 让手机和平板遵循系统屏幕旋转设置 ([#8256](https://github.com/getpaseo/paseo/pull/8256),贡献者:[@magiclaw](https://github.com/magiclaw), [@yzim](https://github.com/yzim))
|
- 让手机和平板遵循系统屏幕旋转设置 ([#8256](https://github.com/getpaseo/paseo/pull/8256),贡献者:[@magiclaw](https://github.com/magiclaw), [@yzim](https://github.com/yzim))
|
||||||
- 通过 `.worktreeinclude` 选择要复制到新 worktree 的被忽略文件,在初始化和 Agent 启动前完成复制 ([#8100](https://github.com/getpaseo/paseo/pull/8100),贡献者:[@cprecioso](https://github.com/cprecioso))
|
- 通过 `.worktreeinclude` 选择要复制到新 worktree 的被忽略文件,在初始化和 Agent 启动前完成复制 ([#8100](https://github.com/getpaseo/paseo/pull/8100),贡献者:[@cprecioso](https://github.com/cprecioso))
|
||||||
@@ -64,6 +64,7 @@ worktree 初始化支持复制被忽略的文件,并在 Agent 启动前使用
|
|||||||
- 修复了 MiniMax Code 目录命令无法选定可执行文件的问题 ([#8201](https://github.com/getpaseo/paseo/pull/8201),贡献者:[@Peanut-HZM](https://github.com/Peanut-HZM))
|
- 修复了 MiniMax Code 目录命令无法选定可执行文件的问题 ([#8201](https://github.com/getpaseo/paseo/pull/8201),贡献者:[@Peanut-HZM](https://github.com/Peanut-HZM))
|
||||||
- 修复了 Android 应用在后台折叠或展开后保留错误布局的问题 ([#8285](https://github.com/getpaseo/paseo/pull/8285))
|
- 修复了 Android 应用在后台折叠或展开后保留错误布局的问题 ([#8285](https://github.com/getpaseo/paseo/pull/8285))
|
||||||
- 修复了 Android 屏幕旋转后工作区布局和顶栏渐变保留旧尺寸的问题 ([#8349](https://github.com/getpaseo/paseo/pull/8349), [#8377](https://github.com/getpaseo/paseo/pull/8377))
|
- 修复了 Android 屏幕旋转后工作区布局和顶栏渐变保留旧尺寸的问题 ([#8349](https://github.com/getpaseo/paseo/pull/8349), [#8377](https://github.com/getpaseo/paseo/pull/8377))
|
||||||
|
- 修复了 iOS 和 Android 手机聊天中重新连接和更新状态被顶栏遮挡的问题 ([#8568](https://github.com/getpaseo/paseo/pull/8568))
|
||||||
- 修复了删除 Agent 后,另一个窗口留下无法关闭的标签页的问题 ([#8248](https://github.com/getpaseo/paseo/pull/8248),贡献者:[@loganmeyer](https://github.com/loganmeyer))
|
- 修复了删除 Agent 后,另一个窗口留下无法关闭的标签页的问题 ([#8248](https://github.com/getpaseo/paseo/pull/8248),贡献者:[@loganmeyer](https://github.com/loganmeyer))
|
||||||
- 修复了窗口隐藏期间切换主题后,聊天文本保留旧主题颜色的问题 ([#8199](https://github.com/getpaseo/paseo/pull/8199),贡献者:[@Nurshot](https://github.com/Nurshot), [@dansabin](https://github.com/dansabin))
|
- 修复了窗口隐藏期间切换主题后,聊天文本保留旧主题颜色的问题 ([#8199](https://github.com/getpaseo/paseo/pull/8199),贡献者:[@Nurshot](https://github.com/Nurshot), [@dansabin](https://github.com/dansabin))
|
||||||
- 修复了网页菜单加载内容后跳回加载时尺寸的问题 ([#8180](https://github.com/getpaseo/paseo/pull/8180),贡献者:[@babo-jeonguk](https://github.com/babo-jeonguk))
|
- 修复了网页菜单加载内容后跳回加载时尺寸的问题 ([#8180](https://github.com/getpaseo/paseo/pull/8180),贡献者:[@babo-jeonguk](https://github.com/babo-jeonguk))
|
||||||
@@ -74,7 +75,7 @@ worktree 初始化支持复制被忽略的文件,并在 Agent 启动前使用
|
|||||||
### 说明
|
### 说明
|
||||||
|
|
||||||
- 首次从 0.14.0 升级时仍会关闭终端;安装新 daemon 后才支持保留终端,Windows 桌面应用升级仍会关闭终端
|
- 首次从 0.14.0 升级时仍会关闭终端;安装新 daemon 后才支持保留终端,Windows 桌面应用升级仍会关闭终端
|
||||||
- Agent 自动恢复默认开启,并发送 `Resume working.`;可在主机设置 → Agent 中修改提示词或关闭此功能
|
- Agent 恢复默认关闭;在主机设置 → Agent 中开启 **重启后恢复智能体**,即可发送 `Resume working.` 或自定义提示词
|
||||||
- 降级到 0.14.0 前,请恢复备份的 `config.json`,或删除已保存的 Agent 恢复和用量查询设置
|
- 降级到 0.14.0 前,请恢复备份的 `config.json`,或删除已保存的 Agent 恢复和用量查询设置
|
||||||
|
|
||||||
## 0.14.0 - 2026-10-29
|
## 0.14.0 - 2026-10-29
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ At the start of non-trivial work, list `docs/` and skim anything relevant to the
|
|||||||
| [docs/hover.md](docs/hover.md) | Hover — the canonical pattern (plain View + onPointerEnter/Leave, separate inner Pressable) and the three ways agents break it |
|
| [docs/hover.md](docs/hover.md) | Hover — the canonical pattern (plain View + onPointerEnter/Leave, separate inner Pressable) and the three ways agents break it |
|
||||||
| [docs/unistyles.md](docs/unistyles.md) | Unistyles gotchas — `useUnistyles()` is forbidden, alternatives in order |
|
| [docs/unistyles.md](docs/unistyles.md) | Unistyles gotchas — `useUnistyles()` is forbidden, alternatives in order |
|
||||||
| [docs/floating-panels.md](docs/floating-panels.md) | Anchored popovers — Portal/Modal escape for Android, lifecycle gates, keyboard-shared-value, status-bar offset, the flash |
|
| [docs/floating-panels.md](docs/floating-panels.md) | Anchored popovers — Portal/Modal escape for Android, lifecycle gates, keyboard-shared-value, status-bar offset, the flash |
|
||||||
|
| [docs/keyboard-shortcuts.md](docs/keyboard-shortcuts.md) | The binding table, per-platform key sources, badges vs routing, iOS `UIKeyCommand` limits |
|
||||||
| [docs/menus.md](docs/menus.md) | The menu engine — popover vs sheet, submenu pages, hover intent, when a decision earns a submenu |
|
| [docs/menus.md](docs/menus.md) | The menu engine — popover vs sheet, submenu pages, hover intent, when a decision earns a submenu |
|
||||||
| [docs/expo-router.md](docs/expo-router.md) | Expo Router route ownership, startup restore, and native blank-screen gotchas |
|
| [docs/expo-router.md](docs/expo-router.md) | Expo Router route ownership, startup restore, and native blank-screen gotchas |
|
||||||
| [docs/notifications.md](docs/notifications.md) | Notification tap ownership, native replay and acknowledgement, startup handoff, and payload QA |
|
| [docs/notifications.md](docs/notifications.md) | Notification tap ownership, native replay and acknowledgement, startup handoff, and payload QA |
|
||||||
|
|||||||
+34
-14
@@ -14,9 +14,10 @@ Each live agent in `AgentManager` carries a `lastStatus` of `initializing`, `idl
|
|||||||
|
|
||||||
## Daemon restart recovery
|
## Daemon restart recovery
|
||||||
|
|
||||||
Hosts resume interrupted agents by default after graceful shutdown or a crash. The daemon
|
Restart recovery is off by default. Enable `agents.resumeOnStartup` in host config or
|
||||||
reopens the saved provider conversation and settings, then sends `Resume working.`. Change
|
Host settings → Agents to resume interrupted agents after graceful shutdown or a crash. The daemon
|
||||||
`agents.resumePrompt` or disable `agents.resumeOnStartup` in host config or Host settings → Agents.
|
reopens the saved provider conversation and settings, then sends `Resume working.`. Customize
|
||||||
|
the prompt with `agents.resumePrompt` or the same settings page.
|
||||||
Disabling recovery consumes pending intent; enabling it later does not revive old work.
|
Disabling recovery consumes pending intent; enabling it later does not revive old work.
|
||||||
|
|
||||||
Only agents recorded as running qualify. Idle and initializing agents stay inactive. Archived
|
Only agents recorded as running qualify. Idle and initializing agents stay inactive. Archived
|
||||||
@@ -182,23 +183,42 @@ Some providers can create their own child sessions inside one provider runtime.
|
|||||||
|
|
||||||
The provider still owns the underlying runtime. Paseo keeps an agent record so the child can be opened, tracked, archived, and cascaded with the parent, but prompts and history hydration route through the provider adapter for that native child handle.
|
The provider still owns the underlying runtime. Paseo keeps an agent record so the child can be opened, tracked, archived, and cascaded with the parent, but prompts and history hydration route through the provider adapter for that native child handle.
|
||||||
|
|
||||||
## Background workspaces
|
## Background visibility
|
||||||
|
|
||||||
`workspace.background` controls discovery only. Background workspaces contain ordinary durable
|
An agent is effectively background when it or its workspace is background:
|
||||||
agents and terminals: provider history, plugin hooks, parentage, archive, and restart recovery
|
`agent.background || workspace.background`. Background controls discovery only. Background agents
|
||||||
keep their normal behavior. Visibility is creation-only; selecting an existing workspace cannot
|
and the agents in background workspaces are ordinary durable agents: provider history, plugin
|
||||||
change it. New workspaces default to false, inherit the caller workspace's value when an agent
|
hooks, parentage, finish notifications to a caller, archive, and restart recovery keep their
|
||||||
creates one without an override, and accept explicit true or false.
|
normal behavior. Both flags are fixed at creation.
|
||||||
|
|
||||||
The daemon derives agent discovery from workspace ownership. Default workspace and agent lists,
|
- **Agent.** `create_agent_request.background` marks the agent. Use it for helpers the user does
|
||||||
including History requests, exclude background work; `filter.includeBackground` includes it.
|
not watch, such as a plugin's classifier in the user's open workspace. A background agent never
|
||||||
Exact-ID operations bypass discovery filtering. The app replicates both kinds and filters only
|
raises attention, adds nothing to its workspace's status bucket or Last prompt time, and stays
|
||||||
its sidebar with **Show background**, so direct navigation and restored tabs remain available.
|
out of tabs, the parent's subagent track and agent lists in the app. A tab opened by id still
|
||||||
|
works.
|
||||||
|
- **Workspace.** `workspace.background` hides the workspace from the sidebar unless **Show
|
||||||
|
background** is on.
|
||||||
|
- **Inheritance.** When `background` is omitted, an agent created by a caller agent takes the
|
||||||
|
caller's own `background`. A new workspace takes the caller's effective background. A request
|
||||||
|
that creates its workspace applies `background` to both the agent and the workspace. Explicit
|
||||||
|
true or false always wins.
|
||||||
|
|
||||||
|
`AgentDirectory` (`packages/server/src/server/agent/directory.ts`) owns visibility for lists.
|
||||||
|
Default workspace and agent lists, including History requests, exclude background work;
|
||||||
|
`includeBackground` includes it. Exact-ID operations bypass discovery filtering. The app
|
||||||
|
replicates inclusively and filters at each surface.
|
||||||
|
|
||||||
|
Sources without the `background_agents` hello capability get workspace-only visibility on
|
||||||
|
inclusive reads and subscriptions: agents in background workspaces, but no agent-level background
|
||||||
|
agents. Older apps replicate inclusively and auto-open a tab for every root agent, so a classifier
|
||||||
|
run would otherwise open a tab each turn. That visibility has its own directory sync generation.
|
||||||
|
|
||||||
Sequenced directories keep complete canonical collections. A filtered read must never replace
|
Sequenced directories keep complete canonical collections. A filtered read must never replace
|
||||||
those collections with its subset. Inclusive and default observations have distinct cursor
|
those collections with its subset. Inclusive and default observations have distinct cursor
|
||||||
scopes, so changing scope requires a fresh snapshot rather than reusing an incomplete cache.
|
scopes, so changing scope requires a fresh snapshot rather than reusing an incomplete cache.
|
||||||
Clients gate creation and inclusive discovery on `features.backgroundWorkspaces`.
|
Clients gate background workspaces and inclusive discovery on `features.backgroundWorkspaces`.
|
||||||
|
They gate a background agent placed in an existing workspace or under a caller on
|
||||||
|
`features.backgroundAgents`.
|
||||||
|
|
||||||
### Private daemon helpers
|
### Private daemon helpers
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -174,7 +174,7 @@ REACT_NATIVE_PACKAGER_HOSTNAME=localhost \
|
|||||||
|
|
||||||
This is the Android counterpart of the iOS local-simulator flow in [development.md](development.md): on iOS the simulator shares the Mac's loopback so `localhost:<port>` works directly; on Android you need `10.0.2.2` or `adb reverse`.
|
This is the Android counterpart of the iOS local-simulator flow in [development.md](development.md): on iOS the simulator shares the Mac's loopback so `localhost:<port>` works directly; on Android you need `10.0.2.2` or `adb reverse`.
|
||||||
|
|
||||||
## Inverted timeline selection
|
## Inverted timeline input
|
||||||
|
|
||||||
Android focus and selection visibility requests must not reposition inverted timelines. The
|
Android focus and selection visibility requests must not reposition inverted timelines. The
|
||||||
`modules/paseo-scroll` package keeps React Native's scroll manager interface and returns zero for
|
`modules/paseo-scroll` package keeps React Native's scroll manager interface and returns zero for
|
||||||
@@ -183,6 +183,10 @@ Native's Android list uses `scale: -1`, which decomposes into a 180-degree rotat
|
|||||||
`scaleY`; checking the scale property alone misses it. Dragging and explicit scroll
|
`scaleY`; checking the scale property alone misses it. Dragging and explicit scroll
|
||||||
commands still work; non-inverted scroll views keep Android's default behavior.
|
commands still work; non-inverted scroll views keep Android's default behavior.
|
||||||
|
|
||||||
|
Mouse wheel axes also bypass the inversion transform. The same module reverses the vertical
|
||||||
|
wheel axis for inverted scroll views before delegating to Android, preserving native scroll
|
||||||
|
bounds and React Native's scroll events and disabled-scroll behavior.
|
||||||
|
|
||||||
Register this package before React Native's core package through its Expo config plugin. Normal
|
Register this package before React Native's core package through its Expo config plugin. Normal
|
||||||
Android builds use the prebuilt `react-android` library, so patching Java under `node_modules` does
|
Android builds use the prebuilt `react-android` library, so patching Java under `node_modules` does
|
||||||
not change the shipped scroll view. Keep this behavior in the app's compiled native module.
|
not change the shipped scroll view. Keep this behavior in the app's compiled native module.
|
||||||
|
|||||||
@@ -74,7 +74,10 @@ registrations remain inspectable; a changed destination requires explicit identi
|
|||||||
|
|
||||||
Both daemons advertise `connectedHosts`; the shared link additionally requires `hostMultiplexing`.
|
Both daemons advertise `connectedHosts`; the shared link additionally requires `hostMultiplexing`.
|
||||||
A completes capability and pinned-identity checks on each physical recovery before admitting channels. There is no local fallback. An older daemon continues to serve existing local
|
A completes capability and pinned-identity checks on each physical recovery before admitting channels. There is no local fallback. An older daemon continues to serve existing local
|
||||||
operations; requesting this feature gives update guidance.
|
operations; requesting this feature gives update guidance. The registry retries an older destination
|
||||||
|
with capped backoff, so it comes online once updated. Self, duplicate, changed-identity, and
|
||||||
|
authentication failures stay in `error` until an update changes the connection, `enabled`, or
|
||||||
|
`replaceIdentity`, or A restarts.
|
||||||
|
|
||||||
Disposing a routed API releases its observations and session. It does not remove the saved host or
|
Disposing a routed API releases its observations and session. It does not remove the saved host or
|
||||||
affect sibling API scopes. Disposing the origin cascades to its derived scopes. Observations restore
|
affect sibling API scopes. Disposing the origin cascades to its derived scopes. Observations restore
|
||||||
|
|||||||
@@ -777,6 +777,8 @@ The built-in `claude` provider appends concrete model IDs from `~/.claude/settin
|
|||||||
|
|
||||||
This lets users who already configured Claude Code for Bedrock, OpenRouter, ollama, Z.AI, or another Anthropic-compatible gateway select the exact model ID in Paseo. Explicit model IDs are passed unchanged to Claude Code, even when the same string is a compatibility alias for a built-in model. When `agents.providers.claude.models` is set it **replaces** both the hardcoded first-party Claude list and any settings.json-discovered entries; use `agents.providers.claude.additionalModels` to keep the first-party list and append curated entries on top.
|
This lets users who already configured Claude Code for Bedrock, OpenRouter, ollama, Z.AI, or another Anthropic-compatible gateway select the exact model ID in Paseo. Explicit model IDs are passed unchanged to Claude Code, even when the same string is a compatibility alias for a built-in model. When `agents.providers.claude.models` is set it **replaces** both the hardcoded first-party Claude list and any settings.json-discovered entries; use `agents.providers.claude.additionalModels` to keep the first-party list and append curated entries on top.
|
||||||
|
|
||||||
|
Paseo's effort selector does not inherit `effortLevel` from Claude's settings.json. Select an effort in Paseo to choose a specific value.
|
||||||
|
|
||||||
### Gotcha: `extends: "claude"` with third-party endpoints
|
### Gotcha: `extends: "claude"` with third-party endpoints
|
||||||
|
|
||||||
When a custom provider extends `"claude"` but points `ANTHROPIC_BASE_URL` at a non-Anthropic API (Z.AI, Alibaba/Qwen, proxies), the Claude Agent SDK may try to use Anthropic-only server-side tools like `WebSearch`. Third-party APIs don't support these tools, causing errors.
|
When a custom provider extends `"claude"` but points `ANTHROPIC_BASE_URL` at a non-Anthropic API (Z.AI, Alibaba/Qwen, proxies), the Claude Agent SDK may try to use Anthropic-only server-side tools like `WebSearch`. Third-party APIs don't support these tools, causing errors.
|
||||||
|
|||||||
+12
-12
@@ -20,7 +20,7 @@ A semantic element used in three or more places is a primitive. One of a kind is
|
|||||||
|
|
||||||
Primitives live in `packages/app/src/components/ui/` and `packages/app/src/components/headers/`. Card and row layout live in `packages/app/src/styles/settings.ts`. Section structure lives in `packages/app/src/screens/settings/settings-section.tsx`.
|
Primitives live in `packages/app/src/components/ui/` and `packages/app/src/components/headers/`. Card and row layout live in `packages/app/src/styles/settings.ts`. Section structure lives in `packages/app/src/screens/settings/settings-section.tsx`.
|
||||||
|
|
||||||
A pressable styled to look like a button is wrong; the button is `<Button>` (`packages/app/src/components/ui/button.tsx`). A pressable wrapping an icon is wrong; the icon action is `<ToolbarButton>` (`packages/app/src/components/ui/pane-content-toolbar.tsx`), which owns the hitbox, the rounded `interactionHighlight` fill on hover and press, the compact size, and the tooltip. Rows on a menu surface are `<MenuItem>`, or `<ComposerTrackRow>` in a track panel; other rows are `<PressHighlight>` (`packages/app/src/components/ui/press-highlight.tsx`), which flashes on native the moment a finger lands. A bare `<Text>` styled to look like a section header is wrong; the section header is `<SettingsSection>` (`packages/app/src/screens/settings/settings-section.tsx`). A custom `Modal` for a confirmation is wrong; the confirmation is `confirmDialog` (`packages/app/src/utils/confirm-dialog.ts`). A hand-rolled overflow menu is wrong; the menu is `<DropdownMenu>` (`packages/app/src/components/ui/dropdown-menu.tsx`). A hand-rolled status pill is wrong; the pill is `<StatusBadge>` (`packages/app/src/components/ui/status-badge.tsx`). A circle pinned over a scrolling surface is wrong; the floating action is `<FloatingActionButton>` (`packages/app/src/components/ui/floating-action-button.tsx`), one per surface, and the surface reserves `FLOATING_ACTION_BUTTON_CLEARANCE` below its content so the button never traps the last row.
|
A pressable styled to look like a button is wrong; the button is `<Button>` (`packages/app/src/components/ui/button.tsx`). A pressable wrapping an icon is wrong; the icon action is `<ToolbarButton>` (`packages/app/src/components/ui/pane-content-toolbar.tsx`), which owns the hitbox, the rounded `interactionHighlight` fill on hover and press, the compact size, and the tooltip. Rows on a menu surface are `<MenuItem>`, or `<ComposerTrackRow>` in a track panel; other rows are `<PressHighlight>` (`packages/app/src/components/ui/press-highlight.tsx`), which flashes on native the moment a finger lands. A bare `<Text>` styled to look like a section header is wrong; the section header is `<SettingsSection>` (`packages/app/src/components/settings/headings/settings-section.tsx`). A docs link in its header is its `link` prop, which renders `Label ↗` on the title's rail; a ghost button with an arrow is wrong. A custom `Modal` for a confirmation is wrong; the confirmation is `confirmDialog` (`packages/app/src/utils/confirm-dialog.ts`). A hand-rolled overflow menu is wrong; the menu is `<DropdownMenu>` (`packages/app/src/components/ui/dropdown-menu.tsx`). A hand-rolled status pill is wrong; the pill is `<StatusBadge>` (`packages/app/src/components/ui/status-badge.tsx`). A circle pinned over a scrolling surface is wrong; the floating action is `<FloatingActionButton>` (`packages/app/src/components/ui/floating-action-button.tsx`), one per surface, and the surface reserves `FLOATING_ACTION_BUTTON_CLEARANCE` below its content so the button never traps the last row.
|
||||||
|
|
||||||
Before adding a new component, read `components/ui/`. The primitive usually exists.
|
Before adding a new component, read `components/ui/`. The primitive usually exists.
|
||||||
|
|
||||||
@@ -35,8 +35,8 @@ The authored interface ramp uses a 14px base. New native installs default to 15p
|
|||||||
Weight has three tiers, applied by role:
|
Weight has three tiers, applied by role:
|
||||||
|
|
||||||
- **Screen titles** — the title in app chrome — use `<ScreenTitle>` (`packages/app/src/components/headers/screen-title.tsx`), which renders `fontSize.base` at weight `400` on compact and `300` on desktop. The New workspace hero is the only larger product title; it uses `fontSize["2xl"]` (`packages/app/src/screens/new-workspace-screen.tsx`).
|
- **Screen titles** — the title in app chrome — use `<ScreenTitle>` (`packages/app/src/components/headers/screen-title.tsx`), which renders `fontSize.base` at weight `400` on compact and `300` on desktop. The New workspace hero is the only larger product title; it uses `fontSize["2xl"]` (`packages/app/src/screens/new-workspace-screen.tsx`).
|
||||||
- **Structural labels** use `fontWeight.medium`. This applies to section labels above a stack of rows (`packages/app/src/components/agent-list.tsx:519-523`, `packages/app/src/components/keyboard-shortcuts-dialog.tsx:63-67`), form field labels above an input inside a modal (`packages/app/src/components/add-host-modal.tsx:19-23`, `packages/app/src/components/pair-link-modal.tsx:24-28`), the title at the top of a modal/sheet/dialog (`packages/app/src/components/adaptive-modal-sheet.tsx:90-94`, `packages/app/src/components/ui/combobox.tsx:1607-1611`, `packages/app/src/components/welcome-screen.tsx:48-53`), action button labels in tight components such as the sidebar callout actions (`packages/app/src/components/sidebar-callout.tsx:218-221`), and inline data emphasis on dense metadata rows (`packages/app/src/components/git-diff-pane.tsx:2322-2327`, `packages/app/src/components/file-explorer-pane.tsx:1115-1122`).
|
- **Structural labels** use `fontWeight.medium`. This applies to section labels above a stack of rows (`packages/app/src/components/agent-list.tsx:519-523`, `packages/app/src/components/keyboard-shortcuts-dialog.tsx:63-67`), form field labels above an input inside a modal (`packages/app/src/hosts/add-host/internal/add-host-modal.tsx:19-23`, `packages/app/src/hosts/add-host/internal/pair-link-modal.tsx:24-28`), the title at the top of a modal/sheet/dialog (`packages/app/src/components/adaptive-modal-sheet.tsx:90-94`, `packages/app/src/components/ui/combobox.tsx:1607-1611`, `packages/app/src/components/welcome-screen.tsx:48-53`), action button labels in tight components such as the sidebar callout actions (`packages/app/src/components/sidebar-callout.tsx:218-221`), and inline data emphasis on dense metadata rows (`packages/app/src/components/git-diff-pane.tsx:2322-2327`, `packages/app/src/components/file-explorer-pane.tsx:1115-1122`).
|
||||||
- **Content** uses `fontWeight.normal`. This applies to settings rows (`packages/app/src/styles/settings.ts`), sidebar primary list-item titles (`packages/app/src/components/sidebar-workspace-list.tsx:2680-2686`, `packages/app/src/components/agent-list.tsx:572-578`), `<Button>` text (`packages/app/src/components/ui/button.tsx:80-84`), `<StatusBadge>` text (`packages/app/src/components/ui/status-badge.tsx:56-60`), and `<SidebarCallout>` titles (`packages/app/src/components/sidebar-callout.tsx:175-180`).
|
- **Content** uses `fontWeight.normal`. This applies to settings rows (`packages/app/src/styles/settings.ts`), sidebar primary list-item titles (`packages/app/src/components/sidebar-workspace-list.tsx:2680-2686`, `packages/app/src/components/agent-list.tsx:572-578`), `<StatusBadge>` text (`packages/app/src/components/ui/status-badge.tsx:56-60`), and `<SidebarCallout>` titles (`packages/app/src/components/sidebar-callout.tsx:175-180`).
|
||||||
|
|
||||||
The rule, condensed: text that _names_ a surface or a group is `medium`. Text that lives _inside_ a surface or a group is `normal`. Top-of-screen titles are `<ScreenTitle>`, which is lighter still.
|
The rule, condensed: text that _names_ a surface or a group is `medium`. Text that lives _inside_ a surface or a group is `normal`. Top-of-screen titles are `<ScreenTitle>`, which is lighter still.
|
||||||
|
|
||||||
@@ -68,9 +68,9 @@ the sidebar. Apply it as `backgroundColor`; setting `opacity` on the control als
|
|||||||
|
|
||||||
`destructive` is filled with `destructive`. It only appears inside a confirm. The button on the page is `outline`; the destructive button is the confirm button inside the dialog.
|
`destructive` is filled with `destructive`. It only appears inside a confirm. The button on the page is `outline`; the destructive button is the confirm button inside the dialog.
|
||||||
|
|
||||||
Sizes: `xs` for ultra-tight inline triggers. `sm` for any button sitting in a row. `md` is the page default. `lg` is reserved for large standalone CTAs.
|
Controls come in two sizes, defined once in `control-geometry.ts`. The default is the right size almost everywhere — pages, dialogs, forms, settings rows, the setup flow — so don't pass a size. It is 32px tall where a pointer drives it and 44px in the compact layout, so every phone control is a full touch target; the breakpoint, not the caller, makes that choice. `sm` is 28px with `fontSize.sm` labels and is for tight chrome only: toolbars, nested settings rows, dense inline row actions. A `size="sm"` on an ordinary page or dialog is wrong, and so is choosing a size from `useIsCompactFormFactor()`.
|
||||||
|
|
||||||
Sizes are a shared contract across control kinds, defined once in `control-geometry.ts`: `xs` = 28px tall with `fontSize.sm` labels, `sm` = 32px with `fontSize.base`, `md`/`lg` = 44px with `fontSize.base`. `<SegmentedControl>` (`packages/app/src/components/ui/segmented-control.tsx`) takes the same `xs`/`sm`/`md` sizes — a segmented control next to a `<Button>` of the same size always matches in height, label size, and corner radius. Its segments run one padding step tighter than a button, because the gap between segments already reads as padding. The selected segment is a `surface3` fill with `foreground` text, not an inverted one — inverting it inside thin chrome puts a white slab in the toolbar. Text fields take `xs`, `sm` and `md`. Thin chrome such as the file toolbar uses `xs`. A settings row sizes the controls in its trailing slot itself, `sm` in a card and `xs` when nested (`packages/app/src/components/ui/control-size.tsx`), so don't pass a size to a button, dropdown or field placed in a row. Never shrink a control's font or padding locally to fit a context — if the context needs a smaller control, the size tier is missing or the wrong one is in use.
|
Buttons are pills (`borderRadius.full`) with medium-weight labels; an icon-only button is a circle. `<Switch>` follows the same two sizes: a 34×20 track by default and in `sm`, 44×26 in the compact layout, and it reserves its size's control height so a row holding one lines up with a row holding a button. Buttons, text fields, dropdown triggers, and `<SegmentedControl>` (`packages/app/src/components/ui/segmented-control.tsx`) share the size contract — the same size name means the same height and label size on every control kind, so controls in one row line up. Segments run tighter than a button, because the gap between segments already reads as padding. The selected segment is a `surface3` fill with `foreground` text, not an inverted one — inverting it inside thin chrome puts a white slab in the toolbar. A settings row sizes the controls in its trailing slot itself, default in a card and `sm` when nested (`packages/app/src/components/ui/control-size.tsx`), so don't pass a size to a button, dropdown or field placed in a row. Code that computes with a control's height outside a stylesheet uses `controlHeightForLayout`. Never shrink a control's font or padding locally to fit a context — if the context needs a smaller control, the size tier is missing or the wrong one is in use.
|
||||||
|
|
||||||
A `<Pressable>` wrapping a `<Text>` is a sixth variant. It is wrong. `<Button>` accepts `style`, `textStyle`, `leftIcon`, `disabled`, `size`, and `variant`.
|
A `<Pressable>` wrapping a `<Text>` is a sixth variant. It is wrong. `<Button>` accepts `style`, `textStyle`, `leftIcon`, `disabled`, `size`, and `variant`.
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ Five primitives. The pick is determined by option count, the need to search, and
|
|||||||
|
|
||||||
`<ContextMenu>` is for right-click and long-press on a target. The row is the trigger; there is no visible affordance. Used for incidental actions on workspace rows in the sidebar (`packages/app/src/components/sidebar-workspace-list.tsx`).
|
`<ContextMenu>` is for right-click and long-press on a target. The row is the trigger; there is no visible affordance. Used for incidental actions on workspace rows in the sidebar (`packages/app/src/components/sidebar-workspace-list.tsx`).
|
||||||
|
|
||||||
`<AdaptiveModalSheet>` is for a focused task. Multi-field forms (`packages/app/src/components/add-host-modal.tsx`, `packages/app/src/components/pair-link-modal.tsx`, `packages/app/src/components/project-picker-modal.tsx`), confirmations with detail, anything that earns a backdrop. Bottom sheet on compact, centered card on desktop. Raw `Modal` is wrong for any of these.
|
`<AdaptiveModalSheet>` is for a focused task. Multi-field forms (`packages/app/src/hosts/add-host/internal/add-host-modal.tsx`, `packages/app/src/hosts/add-host/internal/pair-link-modal.tsx`, `packages/app/src/components/project-picker-modal.tsx`), confirmations with detail, anything that earns a backdrop. Bottom sheet on compact, centered card on desktop. Both sit on `surface0`, the same base as a screen, so settings cards and inputs inside a modal read the way they do on the Settings screen. Raw `Modal` is wrong for any of these.
|
||||||
|
|
||||||
`<AdaptiveModalSheet>` owns the presentation. Its content inset — the gutter that puts sheet content on the same rails as the sheet header — and compact bottom safe-area padding are the sheet's, not the caller's. A caller declares layout intent through `contentStyle` and never branches on form factor to add its own margins. If a sheet's first snap point is shorter than its header, content, and safe-area clearance, raise that snap point rather than moving the sheet container.
|
`<AdaptiveModalSheet>` owns the presentation. Its content inset — the gutter that puts sheet content on the same rails as the sheet header — and compact bottom safe-area padding are the sheet's, not the caller's. A caller declares layout intent through `contentStyle` and never branches on form factor to add its own margins. If a sheet's first snap point is shorter than its header, content, and safe-area clearance, raise that snap point rather than moving the sheet container.
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ Three themes is `DropdownMenu`. Thirty hosts is `Combobox`. A label and a value
|
|||||||
|
|
||||||
## 7. Density and rhythm
|
## 7. Density and rhythm
|
||||||
|
|
||||||
Settings detail pages, the projects detail page, and any list+detail content sit inside a centered, max-width 720 column (`packages/app/src/screens/settings-screen.tsx`, `packages/app/src/screens/projects-screen.tsx`). Lines stay readable, the eye does not have to track wide horizontal distances. Form modals carry their own narrower content frame (`packages/app/src/components/add-host-modal.tsx`).
|
Settings detail pages, the projects detail page, and any list+detail content sit inside a centered, max-width 720 column (`packages/app/src/screens/settings-screen.tsx`, `packages/app/src/screens/projects-screen.tsx`). Lines stay readable, the eye does not have to track wide horizontal distances. Form modals carry their own narrower content frame (`packages/app/src/hosts/add-host/internal/add-host-modal.tsx`).
|
||||||
|
|
||||||
Workspace and chat surfaces use the full width — these are working surfaces, not reading surfaces. The composer carries `MAX_CONTENT_WIDTH` from `packages/app/src/constants/layout.ts` to keep lines readable while letting the workspace pane fill the rest.
|
Workspace and chat surfaces use the full width — these are working surfaces, not reading surfaces. The composer carries `MAX_CONTENT_WIDTH` from `packages/app/src/constants/layout.ts` to keep lines readable while letting the workspace pane fill the rest.
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ Cards inside a section sit closer than sections. Rows inside a card touch — on
|
|||||||
|
|
||||||
Rows have generous vertical padding: roughly 16px of content plus 16px of vertical padding for settings rows, 8–12px for sidebar list items where many rows must fit. Compressing rows below the established density to fit more on the screen is wrong. Too many rows means more cards or more sections, not smaller rows.
|
Rows have generous vertical padding: roughly 16px of content plus 16px of vertical padding for settings rows, 8–12px for sidebar list items where many rows must fit. Compressing rows below the established density to fit more on the screen is wrong. Too many rows means more cards or more sections, not smaller rows.
|
||||||
|
|
||||||
Rows revealed under a `<SettingsCollapsibleRow>` are nested rows, one step smaller than card rows: 8px of vertical padding, `fontSize.sm` text, `xs` controls, and one fixed height so rows with and without a trailing button line up. The collapsible row sets this for everything under it (`packages/app/src/components/settings/row-density.tsx`). Never pass a density to a row, and never pad or resize a nested row by hand.
|
Rows revealed under a `<SettingsCollapsibleRow>` are nested rows, one step smaller than card rows: 8px of vertical padding, `fontSize.sm` text, `sm` controls, and one fixed height so rows with and without a trailing button line up. The collapsible row sets this for everything under it (`packages/app/src/components/settings/row-density.tsx`). Never pass a density to a row, and never pad or resize a nested row by hand.
|
||||||
|
|
||||||
The whitespace is the design.
|
The whitespace is the design.
|
||||||
|
|
||||||
@@ -197,11 +197,11 @@ Terminology:
|
|||||||
|
|
||||||
Loading is inline by default. `<LoadingSpinner size={14} color={foregroundMuted} />` sits next to the thing it relates to (`packages/app/src/screens/settings/providers-section.tsx:227-231`). Page-level loading is a centered `<LoadingSpinner size="large">` (`packages/app/src/screens/sessions-screen.tsx:69-72`). Card-level loading is a single short line, not a spinner. In-row dropdown items use `<DropdownMenuItem status="pending" pendingLabel="Removing...">`; the menu item handles its own pending state.
|
Loading is inline by default. `<LoadingSpinner size={14} color={foregroundMuted} />` sits next to the thing it relates to (`packages/app/src/screens/settings/providers-section.tsx:227-231`). Page-level loading is a centered `<LoadingSpinner size="large">` (`packages/app/src/screens/sessions-screen.tsx:69-72`). Card-level loading is a single short line, not a spinner. In-row dropdown items use `<DropdownMenuItem status="pending" pendingLabel="Removing...">`; the menu item handles its own pending state.
|
||||||
|
|
||||||
Screen-level empty states use a centered, muted noun phrase and at most one ghost button (`packages/app/src/screens/sessions-screen.tsx`). Sidebar list empty states use a quiet bordered card with a left-aligned `sm` title, a muted `sm` description, and `xs` `<Button>` actions. Use `secondary` for the primary action and `outline` for a secondary action (`packages/app/src/components/sidebar/empty-states.tsx`). Keep both forms short and free of illustrations.
|
Screen-level empty states use a centered, muted noun phrase and at most one ghost button (`packages/app/src/screens/sessions-screen.tsx`). Sidebar list empty states use a quiet bordered card with a left-aligned `sm` title, a muted `sm` description, and `sm` `<Button>` actions. Use `secondary` for the primary action and `outline` for a secondary action (`packages/app/src/components/sidebar/empty-states.tsx`). Keep both forms short and free of illustrations.
|
||||||
|
|
||||||
Inline errors are a single sentence in `palette.red[300]` `xs`, sitting under the field or inside the card it relates to (`packages/app/src/screens/settings/providers-section.tsx:115-119`).
|
Inline errors are a single sentence in `palette.red[300]` `xs`, sitting under the field or inside the card it relates to (`packages/app/src/screens/settings/providers-section.tsx:115-119`).
|
||||||
|
|
||||||
Page-level alerts — informational notices, success confirmations, warnings, or recoverable errors that need a small visible block on the page — use `<Alert>` (`packages/app/src/components/ui/alert.tsx`). Variants: `default`, `info`, `success`, `warning`, `error`. The chrome is quiet by design: a 1px tinted border, transparent background, a small variant-tinted icon, the title in the variant accent, the description in `foregroundMuted`. Actions go in the `children` slot as `<Button variant="outline" size="sm">` — recovery actions are low-frequency and outline keeps them quiet alongside the alert's accent (`packages/app/src/screens/project-settings-screen.tsx`). One `<Alert>` at a time per region.
|
Page-level alerts — informational notices, success confirmations, warnings, or recoverable errors that need a small visible block on the page — use `<Alert>` (`packages/app/src/components/ui/alert.tsx`). Variants: `default`, `info`, `success`, `warning`, `error`. The chrome is quiet by design: a 1px tinted border, transparent background, a small variant-tinted icon, the title in the variant accent, the description in `foregroundMuted`. Actions go in the `children` slot as `<Button variant="outline">` — recovery actions are low-frequency and outline keeps them quiet alongside the alert's accent (`packages/app/src/screens/project-settings-screen.tsx`). One `<Alert>` at a time per region.
|
||||||
|
|
||||||
Sidebar callouts — cross-cutting alerts that apply across the whole app, like worktree setup, Rosetta install, and desktop update available — register through `useSidebarCallouts()` and render in the left sidebar via `<SidebarCallout>` (`packages/app/src/components/sidebar-callout.tsx`). The chrome (top-border-only, full-width action buttons) is tuned for that ~280px column. Canonical sources: `packages/app/src/components/worktree-setup-callout-source.tsx`, `packages/app/src/desktop/updates/rosetta-callout-source.tsx`, `packages/app/src/desktop/updates/update-callout-source.tsx`. Never import `<SidebarCallout>` into a page — that's what `<Alert>` is for.
|
Sidebar callouts — cross-cutting alerts that apply across the whole app, like worktree setup, Rosetta install, and desktop update available — register through `useSidebarCallouts()` and render in the left sidebar via `<SidebarCallout>` (`packages/app/src/components/sidebar-callout.tsx`). The chrome (top-border-only, full-width action buttons) is tuned for that ~280px column. Canonical sources: `packages/app/src/components/worktree-setup-callout-source.tsx`, `packages/app/src/desktop/updates/rosetta-callout-source.tsx`, `packages/app/src/desktop/updates/update-callout-source.tsx`. Never import `<SidebarCallout>` into a page — that's what `<Alert>` is for.
|
||||||
|
|
||||||
@@ -251,7 +251,7 @@ New status pills use `<StatusBadge>`. Identity, shortcut, and interactive link b
|
|||||||
|
|
||||||
## 14. Forbidden
|
## 14. Forbidden
|
||||||
|
|
||||||
- `fontWeight.medium` on row titles, body text, button labels, badge text, or `<SidebarCallout>` titles. Medium is reserved for the structural-label tier described in §3 — section labels, modal/sheet titles, dense metadata emphasis, and tight action labels. Anything else is `normal`. `<ScreenTitle>` is responsive `400/300` and is never overridden.
|
- `fontWeight.medium` on row titles, body text, badge text, or `<SidebarCallout>` titles. Medium is reserved for the structural-label tier described in §3 — section labels, modal/sheet titles, dense metadata emphasis, and tight action labels. Anything else is `normal`. `<ScreenTitle>` is responsive `400/300` and is never overridden.
|
||||||
- `<Pressable>` wrapping `<Text>` to make a button. `<Button>` exists.
|
- `<Pressable>` wrapping `<Text>` to make a button. `<Button>` exists.
|
||||||
- Importing `Pressable` or a `Touchable*` outside `components/ui/`. A raw pressable has no standard press or hover feedback, so every one drifts. `paseo/no-raw-pressable` reports it; the files on its burn-down list in `.oxlintrc.json` may only leave it.
|
- Importing `Pressable` or a `Touchable*` outside `components/ui/`. A raw pressable has no standard press or hover feedback, so every one drifts. `paseo/no-raw-pressable` reports it; the files on its burn-down list in `.oxlintrc.json` may only leave it.
|
||||||
- Bare `<Text>` for a section header inside settings. `<SettingsSection>` exists.
|
- Bare `<Text>` for a section header inside settings. `<SettingsSection>` exists.
|
||||||
@@ -278,7 +278,7 @@ New status pills use `<StatusBadge>`. Identity, shortcut, and interactive link b
|
|||||||
| List+detail (compact stack, desktop sidebar+pane) | `packages/app/src/screens/settings-screen.tsx`, `packages/app/src/screens/projects-screen.tsx` |
|
| List+detail (compact stack, desktop sidebar+pane) | `packages/app/src/screens/settings-screen.tsx`, `packages/app/src/screens/projects-screen.tsx` |
|
||||||
| Detail card+row | `packages/app/src/screens/settings/host-page.tsx`, `packages/app/src/screens/settings/providers-section.tsx` |
|
| Detail card+row | `packages/app/src/screens/settings/host-page.tsx`, `packages/app/src/screens/settings/providers-section.tsx` |
|
||||||
| Section grouping inside a card list | `packages/app/src/screens/settings/settings-section.tsx` |
|
| Section grouping inside a card list | `packages/app/src/screens/settings/settings-section.tsx` |
|
||||||
| Form modal (label + input fields, primary + cancel) | `packages/app/src/components/add-host-modal.tsx`, `packages/app/src/components/pair-link-modal.tsx`, `packages/app/src/components/project-picker-modal.tsx` |
|
| Form modal (label + input fields, primary + cancel) | `packages/app/src/hosts/add-host/internal/add-host-modal.tsx`, `packages/app/src/hosts/add-host/internal/pair-link-modal.tsx`, `packages/app/src/components/project-picker-modal.tsx` |
|
||||||
| Destructive confirmation | `confirmDialog` invoked from `packages/app/src/screens/settings/host-page.tsx:541-547` |
|
| Destructive confirmation | `confirmDialog` invoked from `packages/app/src/screens/settings/host-page.tsx:541-547` |
|
||||||
| Centered hero / first-run | `packages/app/src/components/welcome-screen.tsx` |
|
| Centered hero / first-run | `packages/app/src/components/welcome-screen.tsx` |
|
||||||
| Sidebar list (workspaces, hosts) | `packages/app/src/components/sidebar-workspace-list.tsx`, `packages/app/src/components/left-sidebar.tsx` |
|
| Sidebar list (workspaces, hosts) | `packages/app/src/components/sidebar-workspace-list.tsx`, `packages/app/src/components/left-sidebar.tsx` |
|
||||||
|
|||||||
+2
-1
@@ -593,7 +593,8 @@ rerun passes only by landing elsewhere.
|
|||||||
|
|
||||||
To confirm, fetch the URL from several runners and compare `content-length`, the `cf-ray` colo
|
To confirm, fetch the URL from several runners and compare `content-length`, the `cf-ray` colo
|
||||||
suffix, and the number of `attestations` entries (#7730 has the probe). To fix, remove or
|
suffix, and the number of `attestations` entries (#7730 has the probe). To fix, remove or
|
||||||
replace that version in the lockfile and report the URL to npm so they purge it.
|
replace that version in the lockfile. If the dependent’s range cannot be changed, pin a clean
|
||||||
|
version in root `overrides` and regenerate the lockfile. Report the URL to npm so they purge it.
|
||||||
|
|
||||||
## ACP provider catalog versions
|
## ACP provider catalog versions
|
||||||
|
|
||||||
|
|||||||
+8
-1
@@ -58,6 +58,12 @@ restore the same workspace and could repeat the crash.
|
|||||||
|
|
||||||
## App-Wide Route Hops
|
## App-Wide Route Hops
|
||||||
|
|
||||||
|
Keep Add host in `hosts/add-host`, opened through `useAddHost()`. It is an in-place
|
||||||
|
flow; callers choose what happens after success. Settings opts into the new host’s
|
||||||
|
Overview. Do not send callers to Settings with an `addHost` query parameter: a
|
||||||
|
retained route replays that request when appearance changes remount its content.
|
||||||
|
The flow provider and sheet host stay outside appearance keys so open drafts survive.
|
||||||
|
|
||||||
When app-wide routes such as `/new`, `/settings`, or `/sessions` navigate back
|
When app-wide routes such as `/new`, `/settings`, or `/sessions` navigate back
|
||||||
into a host workspace, use `navigateToWorkspace()`. Do not make the caller
|
into a host workspace, use `navigateToWorkspace()`. Do not make the caller
|
||||||
branch on its current route.
|
branch on its current route.
|
||||||
@@ -90,7 +96,8 @@ hidden workspace can overwrite the remembered workspace before Settings or
|
|||||||
History returns.
|
History returns.
|
||||||
|
|
||||||
Plugin settings use the distinct `settings/hosts/[serverId]/plugins/[pluginId]/[screenId]` leaf;
|
Plugin settings use the distinct `settings/hosts/[serverId]/plugins/[pluginId]/[screenId]` leaf;
|
||||||
Back returns to that host's Plugins page.
|
Back returns to that host's Plugins page. Its screen tabs change `screenId` with `router.setParams`,
|
||||||
|
so switching tabs adds no stack entries.
|
||||||
|
|
||||||
Settings detail routes are separate siblings on purpose. Keep
|
Settings detail routes are separate siblings on purpose. Keep
|
||||||
`settings/[section]`, the host routes, the projects index, and project detail as
|
`settings/[section]`, the host routes, the projects index, and project detail as
|
||||||
|
|||||||
+16
-13
@@ -97,19 +97,15 @@ Register the adapter in `defaultForgeRegistry` with:
|
|||||||
- `matchesHost` from manifest `cloudHosts`
|
- `matchesHost` from manifest `cloudHosts`
|
||||||
- `probeHost` when self-hosted/Enterprise detection is supported
|
- `probeHost` when self-hosted/Enterprise detection is supported
|
||||||
|
|
||||||
Current change-request lookup uses two identities deliberately:
|
Current change-request lookup matches the branch and repository for both open and
|
||||||
|
terminal requests. Prefer an open request, then a terminal request at the local
|
||||||
|
HEAD, then the most recently updated terminal request. A reused branch can show
|
||||||
|
its previous request until a new one opens. Auto-archive separately requires an
|
||||||
|
observed open-to-merged transition and a fresh exact match between checkout HEAD
|
||||||
|
and the PR head, along with the existing workspace safety checks.
|
||||||
|
|
||||||
- An open PR/MR belongs to the checkout when its head branch and head repository
|
Keep checkout HEAD in adapter cache and poll identities so checkout changes
|
||||||
match. Its remote head SHA may differ because the checkout can be ahead,
|
refresh the facts used by archive eligibility.
|
||||||
behind, or contain commits that have not been pushed yet.
|
|
||||||
- A merged or closed PR/MR belongs to the checkout only when its recorded head
|
|
||||||
SHA exactly matches the checkout's current `HEAD`. Branch names are reusable;
|
|
||||||
selecting the newest terminal request by branch alone can silently attach an
|
|
||||||
old promotion or feature request to new work.
|
|
||||||
|
|
||||||
Thread the checkout head SHA through adapter cache and poll identities as well
|
|
||||||
as the lookup itself. Otherwise a commit made on the same branch can inherit the
|
|
||||||
previous commit's cached terminal status until the cache expires.
|
|
||||||
|
|
||||||
Cloud hosts in the manifest are a bounded public-host list, not a self-host
|
Cloud hosts in the manifest are a bounded public-host list, not a self-host
|
||||||
allowlist. Self-hosted detection is a trust gate: Paseo only talks to a forge
|
allowlist. Self-hosted detection is a trust gate: Paseo only talks to a forge
|
||||||
@@ -125,7 +121,8 @@ rendering stack:
|
|||||||
`acme.ts` exports a `ClientForgeLogicModule`:
|
`acme.ts` exports a `ClientForgeLogicModule`:
|
||||||
|
|
||||||
- `id`
|
- `id`
|
||||||
- optional `urlGrammar` (including `referencePaths` for composer auto-attachment)
|
- optional `urlGrammar` (including `referencePaths` for composer auto-attachment
|
||||||
|
and Markdown shorthand references)
|
||||||
- optional `facts` registration (schema, merge-capability, native-check fallbacks)
|
- optional `facts` registration (schema, merge-capability, native-check fallbacks)
|
||||||
|
|
||||||
`acme.view.tsx` exports a `ClientForgeViewModule`:
|
`acme.view.tsx` exports a `ClientForgeViewModule`:
|
||||||
@@ -212,6 +209,12 @@ are stale, run `npm run build:server`.
|
|||||||
neutral extractor matches the pasted host and full repository path against
|
neutral extractor matches the pasted host and full repository path against
|
||||||
the current remote before it invokes cwd-routed forge search. Do not add a
|
the current remote before it invokes cwd-routed forge search. Do not add a
|
||||||
central forge switch or guess a self-hosted Gitea-family brand from URL shape.
|
central forge switch or guess a self-hosted Gitea-family brand from URL shape.
|
||||||
|
- Shorthand references in rendered Markdown (`#12`, GitLab and Gitea `!12`,
|
||||||
|
cross-repository `owner/repo#12`) come from the `sigil` on each
|
||||||
|
`referencePaths` entry. Leave `sigil` off a kind the forge does not link in
|
||||||
|
prose: GitHub has no `!`, and its `#` targets `/issues/`, which GitHub
|
||||||
|
redirects to the pull request. `packages/app/src/git/forge-shorthand` builds
|
||||||
|
the recognition pattern from the workspace descriptor's forge and remote.
|
||||||
- GitLab pipeline status constants belong to the GitLab adapter/client module,
|
- GitLab pipeline status constants belong to the GitLab adapter/client module,
|
||||||
not protocol.
|
not protocol.
|
||||||
- GitLab `manual` jobs need `allow_failure` to distinguish optional gray jobs
|
- GitLab `manual` jobs need `allow_failure` to distinguish optional gray jobs
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ Authoritative terminology. UI label wins. Don't invent synonyms; use what's here
|
|||||||
- **Workspace-owned state** — Per-workspace state that never leaks to a same-`cwd` sibling: tabs, agents, terminals, panes, title, plus review drafts, diff-mode overrides, composer attachments, and file-explorer open/expand state. Keyed by `workspaceId` (`cwd` only as a fallback for old payloads). See [architecture.md](architecture.md#right-sidebar-boundary-directory-backed-vs-workspace-owned).
|
- **Workspace-owned state** — Per-workspace state that never leaks to a same-`cwd` sibling: tabs, agents, terminals, panes, title, plus review drafts, diff-mode overrides, composer attachments, and file-explorer open/expand state. Keyed by `workspaceId` (`cwd` only as a fallback for old payloads). See [architecture.md](architecture.md#right-sidebar-boundary-directory-backed-vs-workspace-owned).
|
||||||
- **Last prompt** — Sidebar workspace sort by the most recent human prompt recorded by an agent in that workspace, including archived agents. Agent output, agent-to-agent messages, scheduled prompts, and opening a workspace do not count. A workspace without a human prompt uses its creation time.
|
- **Last prompt** — Sidebar workspace sort by the most recent human prompt recorded by an agent in that workspace, including archived agents. Agent output, agent-to-agent messages, scheduled prompts, and opening a workspace do not count. A workspace without a human prompt uses its creation time.
|
||||||
- **Workspace status bucket** — Aggregate activity signal for a workspace row. Same-`cwd` workspaces intentionally share agent and terminal status buckets, while tab, agent, and terminal visibility remains scoped by `workspaceId`.
|
- **Workspace status bucket** — Aggregate activity signal for a workspace row. Same-`cwd` workspaces intentionally share agent and terminal status buckets, while tab, agent, and terminal visibility remains scoped by `workspaceId`.
|
||||||
|
- **Background agent** — An agent hidden from default discovery and from app surfaces that announce agents: tabs, the subagent track, agent lists, workspace status and attention. It is otherwise an ordinary durable agent, addressable by id. An agent is effectively background when it or its workspace is background. Fixed at creation. Code: `background` on `AgentSnapshotPayload` and `create_agent_request`. See [agent-lifecycle.md](agent-lifecycle.md#background-visibility). Don't confuse with background work (provider shells and monitors) or the daemon's private internal helpers, which are never public ([agent-lifecycle.md](agent-lifecycle.md#private-daemon-helpers)).
|
||||||
- **Agent session** — One running instance of an agent inside a workspace (one provider, one model, one cwd, one timeline). The conceptual unit; in the UI this opens as a tab. Moving toward this as the canonical term over "Agent". Code: `AgentSnapshotPayload` (`packages/protocol/src/messages.ts:608`).
|
- **Agent session** — One running instance of an agent inside a workspace (one provider, one model, one cwd, one timeline). The conceptual unit; in the UI this opens as a tab. Moving toward this as the canonical term over "Agent". Code: `AgentSnapshotPayload` (`packages/protocol/src/messages.ts:608`).
|
||||||
- **Session** — Two senses: (a) per-client connection to a daemon, internal; (b) user-facing agent session, see **Agent session**. Code: `Session` (`packages/server/src/server/session.ts`) for (a). Don't confuse with: provider-side agent session log.
|
- **Session** — Two senses: (a) per-client connection to a daemon, internal; (b) user-facing agent session, see **Agent session**. Code: `Session` (`packages/server/src/server/session.ts`) for (a). Don't confuse with: provider-side agent session log.
|
||||||
- **Profile** — Internal name for the persisted shape of a host. Code: `HostProfile` (`packages/app/src/types/host-connection.ts:37`). Never user-facing. Three other things are called "profile" in this codebase, so always qualify: **Agent profile**, **Terminal profile**, and the provider aliases in [custom-providers.md](custom-providers.md). Bare "profile" is forbidden in UI copy.
|
- **Profile** — Internal name for the persisted shape of a host. Code: `HostProfile` (`packages/app/src/types/host-connection.ts:37`). Never user-facing. Three other things are called "profile" in this codebase, so always qualify: **Agent profile**, **Terminal profile**, and the provider aliases in [custom-providers.md](custom-providers.md). Bare "profile" is forbidden in UI copy.
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
# Keyboard shortcuts
|
||||||
|
|
||||||
|
Define shortcuts in [the shared binding table](../packages/app/src/keyboard/keyboard-shortcuts.ts). Platforms contribute key sources, not separate action maps, so matching and user rebinds stay consistent across runtimes. Add a shortcut through a binding; add platform support through a key source.
|
||||||
|
|
||||||
|
## Badges and routing
|
||||||
|
|
||||||
|
Routing runs whenever the app mounts its key sources, independently of layout.
|
||||||
|
Use `useHardwareKeyboardPresent()` for hints and the Shortcuts settings section.
|
||||||
|
iOS reads `GCKeyboard.coalesced` and connection notifications. Android watches input
|
||||||
|
devices and hardware keyboard configuration. Web starts with a fine hover pointer and recognizes the first modified
|
||||||
|
keydown, including on touch devices. Compact Electron keeps its bindings.
|
||||||
|
|
||||||
|
Keyboard navigation needs the sidebar's filtered workspace model even when its visual
|
||||||
|
panel is hidden. Retain that model while keyboard navigation is active; gating it on
|
||||||
|
panel visibility leaves number shortcuts with no targets after a compact startup.
|
||||||
|
|
||||||
|
Composer send-key customization remains a separate capability. Native retains its
|
||||||
|
existing Return submission path; advertising its web-only customization would expose
|
||||||
|
settings the native composer does not implement.
|
||||||
|
|
||||||
|
## Native sources
|
||||||
|
|
||||||
|
Use the iOS window press stream for hardware keys. `UIKeyCommand` only takes keys
|
||||||
|
that must bypass the focused text control: composer Return and the top overlay's
|
||||||
|
Enter and arrows. Keep the stream as the sole shortcut emitter: a command-owned
|
||||||
|
press is still observed by the window.
|
||||||
|
|
||||||
|
The source spike used an iPad Pro 11-inch (M4) simulator on iOS 18.6 with a
|
||||||
|
`UITextView` first responder. Both `UIWindow.sendEvent` and the root controller's
|
||||||
|
`pressesBegan` received Cmd+B, Cmd+P and Escape. With Escape registered as a
|
||||||
|
`UIKeyCommand`, the window observed it and the command handler also ran.
|
||||||
|
|
||||||
|
Simulator reserves Cmd+K for Toggle Software Keyboard. Injecting it produced
|
||||||
|
HID 184 with empty characters rather than K; plain K, Cmd+B and Cmd+P arrived
|
||||||
|
normally. Keep Simulator input capture off: Send Keyboard Input to Device
|
||||||
|
prevented synthetic AppleScript input from arriving, including plain text.
|
||||||
|
For simulator QA, use Cmd+B/P to check delivery and rebind the command center to
|
||||||
|
Cmd+J to check toggle and rebind behavior. Cmd+K delivery needs a physical iPad.
|
||||||
|
Simulator also reserves Cmd+1…4, Cmd+Shift+A and Cmd+comma. Exercise those actions
|
||||||
|
through rebinds. For numeric injection, use AppleScript physical key codes (for example
|
||||||
|
25 for 9); `keystroke "9"` did not deliver a digit in the QA session.
|
||||||
|
Simulator exposes a virtual `GCKeyboard` even with Connect Hardware Keyboard off.
|
||||||
|
Verify the iOS absence case on a physical iPhone.
|
||||||
|
|
||||||
|
Never register Backspace: it would take deletion away from text fields. Changes
|
||||||
|
to the native module require a native rebuild; an over-the-air JavaScript update
|
||||||
|
cannot deliver them.
|
||||||
|
|
||||||
|
## Overlay ownership
|
||||||
|
|
||||||
|
Register keyboard handling with `useOverlayRegistration` from `@/keyboard`.
|
||||||
|
Pass the surface's open state, layer, handled keys and `onKeyDown`. The highest
|
||||||
|
layer gets first refusal; the latest registration wins a tie. Native registration
|
||||||
|
does not need a DOM ref. Web adds focus trapping and restoration through its adapter.
|
||||||
|
|
||||||
|
Capture a global overlay’s layer in state for its opening lifetime. Memo caches can
|
||||||
|
be discarded or removed by React Compiler; recomputing against the registry lets an
|
||||||
|
open modal rise above its own children and creates competing focus traps.
|
||||||
|
|
||||||
|
Declare Enter and arrow keys only while the surface owns them. Native sources
|
||||||
|
use the top overlay's declarations to take those keys before text controls edit.
|
||||||
|
Backspace stays with the focused input. Composition confirmation must not select
|
||||||
|
an overlay row or submit the composer.
|
||||||
|
|
||||||
|
Android modals have their own windows. Observe them through React Native's
|
||||||
|
`ExtraWindowEventListener` as well as the activity window. The dev client bypasses
|
||||||
|
Expo's root-container handler, so an activity root-view wrapper misses presses.
|
||||||
|
A modal can forward an unhandled event into the activity window. Observe the event
|
||||||
|
once across that nested delivery without retaining recycled Android `KeyEvent`s.
|
||||||
|
Keep an overlay-owned press consumed through key-up, even if its key-down closes
|
||||||
|
the overlay; otherwise the modal's default Escape handler can close a second layer.
|
||||||
|
|
||||||
|
iOS scene startup installs the observing window after Expo creates its root view.
|
||||||
|
Keep that integration in the hardware keyboard module's config plugin. Its window
|
||||||
|
owns both the press stream and the text-control key commands, including above modals.
|
||||||
|
|
||||||
|
## Focus scopes
|
||||||
|
|
||||||
|
The composer and terminal declare focus with `useKeyboardFocusSurface`. Native
|
||||||
|
scope derives from those declarations and command-center state. Releasing an old
|
||||||
|
surface must not clear a newer owner's declaration during a tab switch. Web keeps
|
||||||
|
its DOM-derived scope.
|
||||||
|
|
||||||
|
Escape interrupts an agent only in the message input or an unclaimed surface.
|
||||||
|
A focused terminal excludes that binding. The source leaves terminal Escape alone;
|
||||||
|
terminal Escape/Ctrl forwarding is a separate feature.
|
||||||
@@ -10,9 +10,9 @@ Every block is separated by one gap, `density.blockGap`: 12 on compact layouts,
|
|||||||
|
|
||||||
## Links and images
|
## Links and images
|
||||||
|
|
||||||
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.
|
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).
|
||||||
|
|
||||||
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.
|
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
|
## Engine constraints
|
||||||
|
|
||||||
|
|||||||
+21
-3
@@ -357,9 +357,27 @@ keys are stored under a `param.` prefix; plugins never see it and may use any ke
|
|||||||
`openScreen` validates its input once (`parsePluginOpenScreenInput`); code past it trusts the
|
`openScreen` validates its input once (`parsePluginOpenScreenInput`); code past it trusts the
|
||||||
params.
|
params.
|
||||||
|
|
||||||
RPC contracts validate inputs and outputs in both the app and plugin subprocess. `useRpc` returns a
|
RPC and subscription contracts validate inputs, outputs, and events in both the app and plugin
|
||||||
typed async function. Use the host-provided `@tanstack/react-query` for request state and caching;
|
subprocess. `useRpc` returns a typed async function. Use the host-provided `@tanstack/react-query`
|
||||||
Paseo gives each plugin installation its own query client.
|
for request state and caching; Paseo gives each plugin installation its own query client.
|
||||||
|
|
||||||
|
A subscription is a session-owned observation (`plugin-rpc` delivery family): the session that
|
||||||
|
subscribed owns its lifetime, so release, disconnect, plugin stop, and reload need no plugin code.
|
||||||
|
Each subscriber gets its own handler call in the subprocess; there is no fan-out or replay. The
|
||||||
|
runtime buffers pushes until the session has sent `plugin.rpc.subscribe.response`, so a client
|
||||||
|
never sees an event for an unknown subscription. The app installation's lifetime aborts every
|
||||||
|
subscription its surfaces left open, and a reload replaces the installation, which resubscribes
|
||||||
|
mounted hooks.
|
||||||
|
|
||||||
|
The byte rule (a top-level `Uint8Array` is binary, a nested one is a validation error) is checked
|
||||||
|
once per hop by `assertPluginWireValue`. Bytes ride plugin binary frames, opcodes `0x20`-`0x2f`
|
||||||
|
(`packages/protocol/src/binary-frames/plugin.ts`); nothing on the path copies or re-encodes them,
|
||||||
|
and `plugin-subscriptions.perf.e2e.test.ts` locks that. Keep it that way: never stringify a plugin
|
||||||
|
payload for a log, and the client's bootstrap buffer holds bytes only until the first observer
|
||||||
|
attaches. Binary outputs reach only clients that send `pluginBinaryPayloads`. A binary input
|
||||||
|
frame (`0x22`) becomes a synthetic `plugin.rpc.invoke.request` and runs through the normal message
|
||||||
|
path, so it is authorized like any other invoke. The author contract, including the native upload
|
||||||
|
limit, is in [stream events from the daemon](../public-docs/plugins/reference.md#subscriptions).
|
||||||
|
|
||||||
`usePaseo()` and the handler's `{ paseo }` context expose the same `PaseoApi`: projects,
|
`usePaseo()` and the handler's `{ paseo }` context expose the same `PaseoApi`: projects,
|
||||||
workspaces, agents, terminals, providers, and daemon config. They do not expose connection lifecycle.
|
workspaces, agents, terminals, providers, and daemon config. They do not expose connection lifecycle.
|
||||||
|
|||||||
+47
-3
@@ -30,6 +30,50 @@ at session startup. See [provider configuration](custom-providers.md#provider-op
|
|||||||
for defaults and merge rules, and the [SDK guide](../public-docs/sdk/provider-options.md)
|
for defaults and merge rules, and the [SDK guide](../public-docs/sdk/provider-options.md)
|
||||||
for native keys and examples.
|
for native keys and examples.
|
||||||
|
|
||||||
|
### Options flow
|
||||||
|
|
||||||
|
`options` on the agent snapshot is the only option state. Controls describe how to draw an
|
||||||
|
option and read `options`; they hold no value of their own. Any option can be read and set with
|
||||||
|
or without a control.
|
||||||
|
|
||||||
|
- **Create and resume.** The provider opens with the options it is given and emits nothing about
|
||||||
|
them while opening. `openOptionsPatch` carries every option the session ended up with that
|
||||||
|
differs from what it was given, including a setting nobody asked for (a native default such as
|
||||||
|
Cursor opening with Fast on). It is set before `createSession`/`resumeSession` resolves and the
|
||||||
|
daemon stores it before the agent is published. A reopened agent resumes that state, so a
|
||||||
|
native default the provider later changes does not follow. `options` on the snapshot is what
|
||||||
|
the session opened with, and afterwards it moves only through an apply or an `options_changed`.
|
||||||
|
Editing a provider default in `config.json` affects agents the next time they open.
|
||||||
|
- **Live apply.** `applyOptions` receives the keys the patch touches, resolved against the
|
||||||
|
`config.json` defaults. A removal arrives as the default the key falls back to, or `null` when
|
||||||
|
there is none; the provider returns the setting to its own default if it can, or throws to
|
||||||
|
reject. A key the running session cannot apply (one the provider reads only when it opens) is
|
||||||
|
rejected too, so a stored option always describes what runs. Claude reads most options when it
|
||||||
|
starts its query, and replacing a started query would end its background work, so after the
|
||||||
|
first prompt only Fast can change. Codex fixes its approval policy and sandbox when the thread
|
||||||
|
starts, so it applies only `service_tier` and `plan_mode` live. A session with no
|
||||||
|
`applyOptions` rejects every patch; the daemon enforces this. The provider returns the options
|
||||||
|
it ended up with when they differ from the request. The daemon
|
||||||
|
stores the patch and that result in one step after the call resolves, onto the agent's options
|
||||||
|
as they are at that moment, so the last write wins. Throwing rejects the whole patch and
|
||||||
|
none of it is stored. Emit nothing from inside the call. If the provider's own state moved
|
||||||
|
before it refused, it reports the moved values once as `options_changed` after the call has
|
||||||
|
ended, because the stored options must match what runs.
|
||||||
|
- **Old data converts in the agent manager.** Codex used to take `fast_mode`; it takes
|
||||||
|
`service_tier` now. `AgentManager` runs `convertLegacyOptions` (`option-controls.ts`) on an
|
||||||
|
agent's own options when it creates, resumes, imports, reloads or applies to it, and on draft
|
||||||
|
controls, before defaults merge and before anything is stored (`true` is `"fast"`, `false` is
|
||||||
|
`"default"`, and a `service_tier` in the same input wins). The manager converts for the adapter
|
||||||
|
behind the provider id, following `derivedFromProviderId`, so a custom provider with
|
||||||
|
`extends: "codex"` is converted too. Configured defaults convert in the provider registry. A
|
||||||
|
stored record keeps `fast_mode` until the agent is next opened or applied to, and is stored
|
||||||
|
converted from then on. Nothing past the manager sees `fast_mode` for Codex. Codex resolves
|
||||||
|
`"fast"` to the model's Fast tier and reports the id it runs through `openOptionsPatch` or the
|
||||||
|
`applyOptions` result like any other value. The `featureValues` to `options` fold is separate
|
||||||
|
and provider-agnostic; it stays at the protocol and legacy edges.
|
||||||
|
- **Provider-initiated changes.** A setting the provider changes on its own is an
|
||||||
|
`options_changed` event. The daemon stores and forwards it and does not push the old value back.
|
||||||
|
|
||||||
Exact MCP preapproval is a separate daemon-owned contract. A new provider must fail
|
Exact MCP preapproval is a separate daemon-owned contract. A new provider must fail
|
||||||
closed for Hub unattended execution until it can approve one exact injected MCP
|
closed for Hub unattended execution until it can approve one exact injected MCP
|
||||||
server and tool identity without approving native tools.
|
server and tool identity without approving native tools.
|
||||||
@@ -115,7 +159,7 @@ Submitted user-message wire items carry the same Paseo ID in `messageId` and `cl
|
|||||||
|
|
||||||
Provider adapters must terminalize every transient timeline row before emitting the turn's terminal event. Codex may omit the completed `contextCompaction` item when a turn ends during compaction, so its adapter closes any pending root compaction before forwarding `turn_completed`, `turn_failed`, or `turn_canceled`. A terminal turn must never leave the client showing an operation as still loading.
|
Provider adapters must terminalize every transient timeline row before emitting the turn's terminal event. Codex may omit the completed `contextCompaction` item when a turn ends during compaction, so its adapter closes any pending root compaction before forwarding `turn_completed`, `turn_failed`, or `turn_canceled`. A terminal turn must never leave the client showing an operation as still loading.
|
||||||
|
|
||||||
Draft metadata lookups should avoid creating provider sessions when the upstream provider has top-level APIs for that metadata. Prefer `AgentClient.fetchCatalog`, `listCommands`, or `listFeatures` over creating a scratch `AgentSession`; scratch sessions can show up as empty native sessions in provider import/history UIs. `fetchCatalog` is the single discovery API for models and modes — provider implementations may use one process, separate upstream calls, or static data internally, but callers outside the provider do not get separate runtime model/mode probes. Draft command listing and scratch-session feature listing require an explicit draft model. Do not resolve a default model through catalog discovery. A client-level `listFeatures` implementation may return features from an incomplete, model-less draft and owns which features are valid in that state.
|
Draft metadata lookups should avoid creating provider sessions when the upstream provider has top-level APIs for that metadata. Prefer `AgentClient.fetchCatalog`, `listCommands`, or `listControls` over creating a scratch `AgentSession`; scratch sessions can show up as empty native sessions in provider import/history UIs. `fetchCatalog` is the single discovery API for models and modes — provider implementations may use one process, separate upstream calls, or static data internally, but callers outside the provider do not get separate runtime model/mode probes. Draft command listing and scratch-session control listing require an explicit draft model. Do not resolve a default model through catalog discovery. A client-level `listControls` implementation may return controls from an incomplete, model-less draft and owns which features are valid in that state.
|
||||||
|
|
||||||
Provider session import has its own contract. The picker calls `listImportableSessions` and receives rows only: provider handle, cwd, title, prompt previews, and last activity. Import calls `importSession({ providerHandleId, cwd })` for the selected row and must not call listing again. The provider returns the resumed session, storage config, persistence handle, and hydrated timeline for that one native session; `AgentManager.importProviderSession` seeds the daemon timeline and publishes the Paseo agent only after it is ready.
|
Provider session import has its own contract. The picker calls `listImportableSessions` and receives rows only: provider handle, cwd, title, prompt previews, and last activity. Import calls `importSession({ providerHandleId, cwd })` for the selected row and must not call listing again. The provider returns the resumed session, storage config, persistence handle, and hydrated timeline for that one native session; `AgentManager.importProviderSession` seeds the daemon timeline and publishes the Paseo agent only after it is ready.
|
||||||
|
|
||||||
@@ -478,7 +522,7 @@ interface AgentSession {
|
|||||||
readonly provider: AgentProvider;
|
readonly provider: AgentProvider;
|
||||||
readonly id: string | null;
|
readonly id: string | null;
|
||||||
readonly capabilities: AgentCapabilityFlags;
|
readonly capabilities: AgentCapabilityFlags;
|
||||||
readonly features?: AgentFeature[];
|
readonly controls?: AgentOptionControl[];
|
||||||
run(prompt: AgentPromptInput, options?: AgentRunOptions): Promise<AgentRunResult>;
|
run(prompt: AgentPromptInput, options?: AgentRunOptions): Promise<AgentRunResult>;
|
||||||
startTurn(prompt: AgentPromptInput, options?: AgentRunOptions): Promise<{ turnId: string }>;
|
startTurn(prompt: AgentPromptInput, options?: AgentRunOptions): Promise<{ turnId: string }>;
|
||||||
steerActiveTurn?(prompt: AgentPromptInput, options: SteerActiveTurnOptions): Promise<SteerResult>;
|
steerActiveTurn?(prompt: AgentPromptInput, options: SteerActiveTurnOptions): Promise<SteerResult>;
|
||||||
@@ -500,7 +544,7 @@ interface AgentSession {
|
|||||||
listCommands?(): Promise<AgentSlashCommand[]>;
|
listCommands?(): Promise<AgentSlashCommand[]>;
|
||||||
setModel?(modelId: string | null): Promise<void>;
|
setModel?(modelId: string | null): Promise<void>;
|
||||||
setThinkingOption?(thinkingOptionId: string | null): Promise<void | AgentProviderNotice>;
|
setThinkingOption?(thinkingOptionId: string | null): Promise<void | AgentProviderNotice>;
|
||||||
setFeature?(featureId: string, value: unknown): Promise<void>;
|
applyOptions?(options: ProviderOptions): Promise<void>;
|
||||||
tryHandleOutOfBand?(prompt: AgentPromptInput): {
|
tryHandleOutOfBand?(prompt: AgentPromptInput): {
|
||||||
run(ctx: { emit: (event: AgentStreamEvent) => void }): Promise<void>;
|
run(ctx: { emit: (event: AgentStreamEvent) => void }): Promise<void>;
|
||||||
} | null;
|
} | null;
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
Daemon restarts now keep terminal programs running. Interrupted agents can resume in their existing conversations when you turn on agent recovery.
|
||||||
|
|
||||||
|
Mobile terminals have native rendering and draggable text-selection handles. Reconnecting restores up to 10,000 lines of terminal history.
|
||||||
|
|
||||||
|
Worktree setup can copy ignored files and use plugin-defined locations before agents start.
|
||||||
|
|
||||||
|
Added
|
||||||
|
- Insert known agent commands from replies into the Composer draft
|
||||||
|
|
||||||
|
Full notes: https://paseo.sh/changelog
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
Daemon restarts now keep terminal programs running. Interrupted agents can resume in their existing conversations when you turn on agent recovery.
|
||||||
|
|
||||||
|
Mobile terminals have native rendering and draggable text-selection handles. Reconnecting restores up to 10,000 lines of terminal history.
|
||||||
|
|
||||||
|
Worktree setup can copy ignored files and use plugin-defined locations before agents start.
|
||||||
|
|
||||||
|
Added
|
||||||
|
- Insert known agent commands from replies into the Composer draft
|
||||||
|
|
||||||
|
Full notes: https://paseo.sh/changelog
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
Daemon restarts now keep terminal programs running. Interrupted agents can resume in their existing conversations when you turn on agent recovery.
|
||||||
|
|
||||||
|
Mobile terminals have native rendering and draggable text-selection handles. Reconnecting restores up to 10,000 lines of terminal history.
|
||||||
|
|
||||||
|
Worktree setup can copy ignored files and use plugin-defined locations before agents start.
|
||||||
|
|
||||||
|
Added
|
||||||
|
- Insert known agent commands from replies into the Composer draft
|
||||||
|
|
||||||
|
Full notes: https://paseo.sh/changelog
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
Daemon restarts now keep terminal programs running. Interrupted agents can resume in their existing conversations when you turn on agent recovery.
|
||||||
|
|
||||||
|
Mobile terminals have native rendering and draggable text-selection handles. Reconnecting restores up to 10,000 lines of terminal history.
|
||||||
|
|
||||||
|
Worktree setup can copy ignored files and use plugin-defined locations before agents start.
|
||||||
|
|
||||||
|
Added
|
||||||
|
- Insert known agent commands from replies into the Composer draft
|
||||||
|
|
||||||
|
Full notes: https://paseo.sh/changelog
|
||||||
@@ -127,7 +127,7 @@ buildNpmPackage {
|
|||||||
# The Nix output is not a distributable DMG, so leave it unsigned and
|
# The Nix output is not a distributable DMG, so leave it unsigned and
|
||||||
# disable the hardened runtime that requires a matching signature.
|
# disable the hardened runtime that requires a matching signature.
|
||||||
CSC_IDENTITY_AUTO_DISCOVERY=false \
|
CSC_IDENTITY_AUTO_DISCOVERY=false \
|
||||||
../../node_modules/.bin/electron-builder \
|
npm exec --offline -- electron-builder \
|
||||||
--config electron-builder.yml \
|
--config electron-builder.yml \
|
||||||
--dir \
|
--dir \
|
||||||
--mac \
|
--mac \
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
sha256-CeT2PtYIAFwvBC9LIku8VkTl0pvKxYzSCn0QW2ManfU=
|
sha256-p97CaALgkY+x9XVvS4/ILqmbwYSX0fSbVUgQl35BjiU=
|
||||||
|
|||||||
Generated
+698
-876
File diff suppressed because it is too large
Load Diff
+3
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "paseo",
|
"name": "paseo",
|
||||||
"version": "0.15.0-beta.1",
|
"version": "0.15.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Paseo: voice-controlled development environment for local AI coding agents",
|
"description": "Paseo: voice-controlled development environment for local AI coding agents",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@@ -131,6 +131,7 @@
|
|||||||
"concurrently": "^9.2.1",
|
"concurrently": "^9.2.1",
|
||||||
"cross-env": "^10.1.0",
|
"cross-env": "^10.1.0",
|
||||||
"electron": "44.2.0",
|
"electron": "44.2.0",
|
||||||
|
"electron-builder": "26.18.0",
|
||||||
"expo-module-scripts": "^5.0.8",
|
"expo-module-scripts": "^5.0.8",
|
||||||
"get-port-cli": "^3.0.0",
|
"get-port-cli": "^3.0.0",
|
||||||
"js-yaml": "^4.1.1",
|
"js-yaml": "^4.1.1",
|
||||||
@@ -151,6 +152,7 @@
|
|||||||
"expo": "~57.0.30",
|
"expo": "~57.0.30",
|
||||||
"expo-router": "~57.0.28",
|
"expo-router": "~57.0.28",
|
||||||
"lightningcss": "1.30.1",
|
"lightningcss": "1.30.1",
|
||||||
|
"pkijs": "3.4.2",
|
||||||
"react": "19.2.3",
|
"react": "19.2.3",
|
||||||
"react-dom": "19.2.3",
|
"react-dom": "19.2.3",
|
||||||
"react-native": "0.86.3",
|
"react-native": "0.86.3",
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ export default {
|
|||||||
searchPaths: ["../../node_modules", "./node_modules"],
|
searchPaths: ["../../node_modules", "./node_modules"],
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
"./modules/paseo-hardware-keyboard/app.plugin",
|
||||||
"expo-router",
|
"expo-router",
|
||||||
withPasteInput,
|
withPasteInput,
|
||||||
withAndroidScroll,
|
withAndroidScroll,
|
||||||
|
|||||||
@@ -94,3 +94,21 @@ it("allows all orientations on iPhone and iPad", async () => {
|
|||||||
await rm(root, { recursive: true, force: true });
|
await rm(root, { recursive: true, force: true });
|
||||||
}
|
}
|
||||||
}, 30_000);
|
}, 30_000);
|
||||||
|
|
||||||
|
// Scene startup is the integration boundary for the iOS keyboard window.
|
||||||
|
describe("hardware keyboard scene integration", () => {
|
||||||
|
it("installs observation after Expo creates the scene window and is idempotent", () => {
|
||||||
|
const {
|
||||||
|
configureHardwareKeyboardAppDelegate,
|
||||||
|
} = require("./modules/paseo-hardware-keyboard/app.plugin.js");
|
||||||
|
const source =
|
||||||
|
"import Expo\nclass Scene {\n super.scene(scene, willConnectTo: session, options: connectionOptions)\n}\n";
|
||||||
|
const configured = configureHardwareKeyboardAppDelegate(source);
|
||||||
|
expect(configured).toContain("import PaseoHardwareKeyboard");
|
||||||
|
expect(configured).toContain("PaseoHardwareKeyboardWindow.observing(window)");
|
||||||
|
expect(configured.indexOf("super.scene")).toBeLessThan(
|
||||||
|
configured.indexOf(".observing(window)"),
|
||||||
|
);
|
||||||
|
expect(configureHardwareKeyboardAppDelegate(configured)).toBe(configured);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import path from "node:path";
|
|||||||
import { test, expect } from "../support/fixtures";
|
import { test, expect } from "../support/fixtures";
|
||||||
import {
|
import {
|
||||||
addProjectFlow,
|
addProjectFlow,
|
||||||
|
chooseAddHostFromProjectFlow,
|
||||||
addProjectFlowBack,
|
addProjectFlowBack,
|
||||||
addProjectFlowHost,
|
addProjectFlowHost,
|
||||||
addProjectFlowInput,
|
addProjectFlowInput,
|
||||||
@@ -14,11 +15,14 @@ import {
|
|||||||
expectNewWorkspaceForAddedProject,
|
expectNewWorkspaceForAddedProject,
|
||||||
expectAddProjectResultVisible,
|
expectAddProjectResultVisible,
|
||||||
navigateAddProjectResults,
|
navigateAddProjectResults,
|
||||||
|
navigateAndDismissAddProject,
|
||||||
|
watchAddProjectRenderWarnings,
|
||||||
openAddProjectFlow,
|
openAddProjectFlow,
|
||||||
openAddProjectHostSelection,
|
openAddProjectHostSelection,
|
||||||
} from "../support/helpers/add-project-flow";
|
} from "../support/helpers/add-project-flow";
|
||||||
import { gotoAppShell } from "../support/helpers/app";
|
import { gotoAppShell } from "../support/helpers/app";
|
||||||
import {
|
import {
|
||||||
|
disconnectAllHostsAndReload,
|
||||||
addConnectedHostAndReload,
|
addConnectedHostAndReload,
|
||||||
addConnectedHostsAndReload,
|
addConnectedHostsAndReload,
|
||||||
addOfflineHostAndReload,
|
addOfflineHostAndReload,
|
||||||
@@ -69,6 +73,19 @@ async function expectProjectHasNoWorkspaces(projectId: string): Promise<void> {
|
|||||||
test.describe("Add Project command-center flow", () => {
|
test.describe("Add Project command-center flow", () => {
|
||||||
test.describe.configure({ timeout: 180_000 });
|
test.describe.configure({ timeout: 180_000 });
|
||||||
|
|
||||||
|
test("Add host replaces the project dialog when no hosts are connected", async ({ page }) => {
|
||||||
|
await gotoAppShell(page);
|
||||||
|
await disconnectAllHostsAndReload(page);
|
||||||
|
await openAddProjectHostSelection(page);
|
||||||
|
const originalUrl = page.url();
|
||||||
|
await chooseAddHostFromProjectFlow(page);
|
||||||
|
await expect(addProjectFlow(page)).toBeHidden();
|
||||||
|
await expect(
|
||||||
|
page.getByRole("button", { name: "Direct connection", exact: true }),
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(page).toHaveURL(originalUrl);
|
||||||
|
});
|
||||||
|
|
||||||
test("method selection shows the daemon's available project sources without search", async ({
|
test("method selection shows the daemon's available project sources without search", async ({
|
||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
@@ -131,6 +148,7 @@ test.describe("Add Project command-center flow", () => {
|
|||||||
test("Escape and Back restore searchable page input before closing at the root", async ({
|
test("Escape and Back restore searchable page input before closing at the root", async ({
|
||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
|
const renderWarnings = watchAddProjectRenderWarnings(page);
|
||||||
await gotoAppShell(page);
|
await gotoAppShell(page);
|
||||||
await addConnectedHostAndReload(page, {
|
await addConnectedHostAndReload(page, {
|
||||||
serverId: secondaryHost.serverId,
|
serverId: secondaryHost.serverId,
|
||||||
@@ -168,8 +186,9 @@ test.describe("Add Project command-center flow", () => {
|
|||||||
|
|
||||||
await page.keyboard.press("Escape");
|
await page.keyboard.press("Escape");
|
||||||
await expectAddProjectPage(page, "host");
|
await expectAddProjectPage(page, "host");
|
||||||
await page.keyboard.press("Escape");
|
await navigateAndDismissAddProject(page);
|
||||||
await expect(addProjectFlow(page)).not.toBeVisible();
|
await expect(addProjectFlow(page)).not.toBeVisible();
|
||||||
|
expect(renderWarnings).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("New directory creates a Project on the selected remote host", async ({ page }) => {
|
test("New directory creates a Project on the selected remote host", async ({ page }) => {
|
||||||
|
|||||||
@@ -9,9 +9,11 @@ test("shows Pure black in the appearance picker", async ({ page }, testInfo) =>
|
|||||||
await expect(page.getByTestId("settings-sidebar")).toBeVisible();
|
await expect(page.getByTestId("settings-sidebar")).toBeVisible();
|
||||||
await openSettingsSection(page, "appearance");
|
await openSettingsSection(page, "appearance");
|
||||||
|
|
||||||
const themeTrigger = page.getByLabel("Theme: System", { exact: true });
|
await expect(page.getByRole("radio", { name: "System", exact: true })).toBeChecked();
|
||||||
await themeTrigger.click();
|
await expect(
|
||||||
await expect(page.getByText("Pure black", { exact: true })).toBeVisible();
|
page.getByRole("radiogroup", { name: "Theme" }).getByRole("radio").first(),
|
||||||
|
).toHaveAccessibleName("System");
|
||||||
|
await expect(page.getByRole("radio", { name: "Pure black", exact: true })).toBeVisible();
|
||||||
await page.screenshot({
|
await page.screenshot({
|
||||||
path: testInfo.outputPath("appearance-theme-picker.png"),
|
path: testInfo.outputPath("appearance-theme-picker.png"),
|
||||||
fullPage: true,
|
fullPage: true,
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
import { test } from "../support/fixtures";
|
||||||
|
import {
|
||||||
|
expectWorkspaceShownIdle,
|
||||||
|
finishAndArchiveAgent,
|
||||||
|
startBackgroundAgent,
|
||||||
|
} from "../support/helpers/background-agents";
|
||||||
|
import { openAgentRoute } from "../support/helpers/mock-agent";
|
||||||
|
import { seedWorkspace, type SeededWorkspace } from "../support/helpers/seed-client";
|
||||||
|
import {
|
||||||
|
expectSubagentRowGone,
|
||||||
|
expectSubagentRowVisible,
|
||||||
|
openSubagentsTrack,
|
||||||
|
seedParentWithSubagent,
|
||||||
|
seedSubagent,
|
||||||
|
} from "../support/helpers/subagents";
|
||||||
|
import { expectOnlyWorkspaceAgentTabsVisible } from "../support/helpers/workspace-tabs";
|
||||||
|
|
||||||
|
test.describe("Background agents", () => {
|
||||||
|
let workspace: SeededWorkspace;
|
||||||
|
|
||||||
|
test.beforeAll(async () => {
|
||||||
|
workspace = await seedWorkspace({
|
||||||
|
repoPrefix: "background-agents-",
|
||||||
|
title: "Classifier workspace",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
await workspace?.cleanup();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("a background agent runs in an open workspace without announcing itself", async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
const agents = await seedParentWithSubagent(workspace, {
|
||||||
|
parentTitle: "Feature agent",
|
||||||
|
childTitle: "Visible helper",
|
||||||
|
});
|
||||||
|
await openAgentRoute(page, { workspaceId: agents.workspaceId, agentId: agents.parent.id });
|
||||||
|
await openSubagentsTrack(page);
|
||||||
|
await expectSubagentRowVisible(page, agents.child.id);
|
||||||
|
|
||||||
|
const classifier = await test.step("a plugin starts a background agent", () =>
|
||||||
|
startBackgroundAgent(workspace, { parentId: agents.parent.id, title: "Classifier" }));
|
||||||
|
// A visible child created after the classifier reaches the app on the same stream, so once
|
||||||
|
// its row shows, the app has processed the classifier too.
|
||||||
|
const marker = await seedSubagent(workspace, {
|
||||||
|
parentId: agents.parent.id,
|
||||||
|
title: "Ordering marker",
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step("it stays out of the track, the tabs and the sidebar status", async () => {
|
||||||
|
await expectSubagentRowVisible(page, marker.id);
|
||||||
|
await expectSubagentRowGone(page, classifier.id);
|
||||||
|
await expectOnlyWorkspaceAgentTabsVisible(page, [agents.parent.id]);
|
||||||
|
await expectWorkspaceShownIdle(page, "Classifier workspace");
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step("the plugin reads its finish and archives it", async () => {
|
||||||
|
await finishAndArchiveAgent(workspace, classifier.id);
|
||||||
|
await expectOnlyWorkspaceAgentTabsVisible(page, [agents.parent.id]);
|
||||||
|
await expectSubagentRowGone(page, classifier.id);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { execFileSync } from "node:child_process";
|
import { execFileSync } from "node:child_process";
|
||||||
import { mkdtemp, writeFile } from "node:fs/promises";
|
import { mkdtemp, writeFile } from "node:fs/promises";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
import type { Locator } from "@playwright/test";
|
||||||
import { test, expect, type Page } from "../support/fixtures";
|
import { test, expect, type Page } from "../support/fixtures";
|
||||||
import { getServerId } from "../support/helpers/server-id";
|
import { getServerId } from "../support/helpers/server-id";
|
||||||
import { connectSeedClient } from "../support/helpers/seed-client";
|
import { connectSeedClient } from "../support/helpers/seed-client";
|
||||||
@@ -59,6 +60,14 @@ async function openCompactActionsMenu(page: Page, workspaceId: string) {
|
|||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function expectActionsInOrder(menu: Locator, labels: readonly string[]) {
|
||||||
|
const items = menu.getByRole("menuitem");
|
||||||
|
await expect(items).toHaveCount(labels.length);
|
||||||
|
for (const [index, label] of labels.entries()) {
|
||||||
|
await expect(items.nth(index).getByText(label, { exact: true })).toBeVisible();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
test("compact git actions menu lists a promoted Pull once", async ({ page }) => {
|
test("compact git actions menu lists a promoted Pull once", async ({ page }) => {
|
||||||
const repoPath = await createRemoteRepo("compact-menu-pull-");
|
const repoPath = await createRemoteRepo("compact-menu-pull-");
|
||||||
cleanupTasks.push(async () => {
|
cleanupTasks.push(async () => {
|
||||||
@@ -83,12 +92,7 @@ test("compact git actions menu lists a promoted Pull once", async ({ page }) =>
|
|||||||
const menu = await openCompactActionsMenu(page, workspaceId);
|
const menu = await openCompactActionsMenu(page, workspaceId);
|
||||||
|
|
||||||
await expect(menu.getByTestId("changes-menu-pull")).toHaveCount(1);
|
await expect(menu.getByTestId("changes-menu-pull")).toHaveCount(1);
|
||||||
await expect(menu.getByRole("menuitem")).toHaveText([
|
await expectActionsInOrder(menu, ["Pull", "Push", "Pull and push", "Archive workspace"]);
|
||||||
"Pull",
|
|
||||||
"Push",
|
|
||||||
"Pull and push",
|
|
||||||
"Archive workspace",
|
|
||||||
]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("compact git actions menu lists a promoted Push once", async ({ page }) => {
|
test("compact git actions menu lists a promoted Push once", async ({ page }) => {
|
||||||
@@ -106,10 +110,5 @@ test("compact git actions menu lists a promoted Push once", async ({ page }) =>
|
|||||||
const menu = await openCompactActionsMenu(page, workspaceId);
|
const menu = await openCompactActionsMenu(page, workspaceId);
|
||||||
|
|
||||||
await expect(menu.getByTestId("changes-menu-push")).toHaveCount(1);
|
await expect(menu.getByTestId("changes-menu-push")).toHaveCount(1);
|
||||||
await expect(menu.getByRole("menuitem")).toHaveText([
|
await expectActionsInOrder(menu, ["Push", "Pull", "Pull and push", "Archive workspace"]);
|
||||||
"Push",
|
|
||||||
"Pull",
|
|
||||||
"Pull and push",
|
|
||||||
"Archive workspace",
|
|
||||||
]);
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
composerLocator,
|
composerLocator,
|
||||||
expectComposerDraft,
|
expectComposerDraft,
|
||||||
expectComposerVisible,
|
expectComposerVisible,
|
||||||
submitMessage,
|
fillComposerDraft,
|
||||||
typeIntoFocusedComposer,
|
typeIntoFocusedComposer,
|
||||||
} from "../support/helpers/composer";
|
} from "../support/helpers/composer";
|
||||||
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
|
import { openAgentRoute, seedMockAgentWorkspace } from "../support/helpers/mock-agent";
|
||||||
@@ -12,8 +12,14 @@ function userMessages(page: Page) {
|
|||||||
return page.getByTestId("user-message");
|
return page.getByTestId("user-message");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function sendDraftWhenReady(page: Page) {
|
||||||
|
await expect(page.getByRole("button", { name: "Send message", exact: true })).toBeEnabled();
|
||||||
|
await pressInComposer(page, "Enter");
|
||||||
|
}
|
||||||
|
|
||||||
async function sendAndWaitForMessage(page: Page, text: string, expectedCount: number) {
|
async function sendAndWaitForMessage(page: Page, text: string, expectedCount: number) {
|
||||||
await submitMessage(page, text);
|
await fillComposerDraft(page, text);
|
||||||
|
await sendDraftWhenReady(page);
|
||||||
await expect(userMessages(page)).toHaveCount(expectedCount, { timeout: 30_000 });
|
await expect(userMessages(page)).toHaveCount(expectedCount, { timeout: 30_000 });
|
||||||
await expectComposerDraft(page, "");
|
await expectComposerDraft(page, "");
|
||||||
}
|
}
|
||||||
@@ -49,7 +55,7 @@ test.describe("Composer recall", () => {
|
|||||||
await pressInComposer(page, "ArrowUp");
|
await pressInComposer(page, "ArrowUp");
|
||||||
await expectComposerDraft(page, "add tests for login");
|
await expectComposerDraft(page, "add tests for login");
|
||||||
|
|
||||||
await pressInComposer(page, "Enter");
|
await sendDraftWhenReady(page);
|
||||||
await expect(userMessages(page)).toHaveCount(3, { timeout: 30_000 });
|
await expect(userMessages(page)).toHaveCount(3, { timeout: 30_000 });
|
||||||
await expect(userMessages(page).last()).toContainText("add tests for login");
|
await expect(userMessages(page).last()).toContainText("add tests for login");
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -429,6 +429,32 @@ test("context details support keyboard entry and dismiss when the viewport moves
|
|||||||
await expect(details).toHaveCount(0);
|
await expect(details).toHaveCount(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("context details stay open while the chat streams", async ({ page }) => {
|
||||||
|
test.setTimeout(120_000);
|
||||||
|
await page.setViewportSize(DESKTOP);
|
||||||
|
const session = await seedMockAgentWorkspace({
|
||||||
|
repoPrefix: "context-window-streaming-",
|
||||||
|
title: "Context details while streaming",
|
||||||
|
model: "ten-second-stream",
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
await openAgentRoute(page, session);
|
||||||
|
await expectComposerVisible(page);
|
||||||
|
await submitMessageWithButton(page, "Stream while the context details are open.");
|
||||||
|
const stop = page.getByRole("button", { name: /stop|cancel/i }).first();
|
||||||
|
await expect(stop).toBeVisible();
|
||||||
|
const details = await pressContextWindowMeter(page, /^Context window/);
|
||||||
|
await expect(stop).toBeVisible();
|
||||||
|
await qaScreenshot(page, "context-details-while-streaming");
|
||||||
|
|
||||||
|
await expect(stop).toHaveCount(0, { timeout: 30_000 });
|
||||||
|
await expect(details).toBeVisible();
|
||||||
|
await qaScreenshot(page, "context-details-after-streaming");
|
||||||
|
} finally {
|
||||||
|
await session.cleanup();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test("pointer hovering context details preserves composer focus", async ({ page, agent }) => {
|
test("pointer hovering context details preserves composer focus", async ({ page, agent }) => {
|
||||||
const usage = await scriptAgentUsage(page);
|
const usage = await scriptAgentUsage(page);
|
||||||
await page.setViewportSize(DESKTOP);
|
await page.setViewportSize(DESKTOP);
|
||||||
|
|||||||
@@ -63,6 +63,24 @@ function htmlPreview(page: Page) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function followHtmlPreviewLink(page: Page, name: string): Promise<void> {
|
||||||
|
await htmlPreview(page).document.getByRole("link", { name, exact: true }).click();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function expectPageHandlesFragment(
|
||||||
|
page: Page,
|
||||||
|
handler: "Document" | "Window",
|
||||||
|
): Promise<void> {
|
||||||
|
const preview = htmlPreview(page);
|
||||||
|
await followHtmlPreviewLink(page, `${handler} handled jump`);
|
||||||
|
await expect(preview.document.getByRole("status")).toHaveText(`${handler} handled click`);
|
||||||
|
await expect(
|
||||||
|
preview.document.getByRole("heading", { name: "Target section" }),
|
||||||
|
).not.toBeInViewport();
|
||||||
|
expect(await preview.document.locator("body").evaluate(() => location.hash)).toBe("");
|
||||||
|
expect(await preview.document.locator("body").evaluate(() => window.scrollY)).toBe(0);
|
||||||
|
}
|
||||||
|
|
||||||
async function selectFileView(page: Page, view: "Preview" | "Source"): Promise<void> {
|
async function selectFileView(page: Page, view: "Preview" | "Source"): Promise<void> {
|
||||||
const option = page.getByTestId("file-panel-bar").getByRole("button", {
|
const option = page.getByTestId("file-panel-bar").getByRole("button", {
|
||||||
name: view,
|
name: view,
|
||||||
@@ -826,6 +844,192 @@ test.describe("CodeMirror workspace file editing", () => {
|
|||||||
await expect(preview.host).toBeVisible();
|
await expect(preview.host).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("keeps HTML fragment links in the preview and scrolls to the target", async ({
|
||||||
|
page,
|
||||||
|
withWorkspace,
|
||||||
|
}) => {
|
||||||
|
const workspace = await withWorkspace({ prefix: "html-fragments-" });
|
||||||
|
await writeFile(
|
||||||
|
path.join(workspace.repoPath, "fragments.html"),
|
||||||
|
`<!doctype html><html><body>
|
||||||
|
<a href="#section">Jump to section</a>
|
||||||
|
<div style="height: 1200px"></div>
|
||||||
|
<h2 id="section">Target section</h2>
|
||||||
|
</body></html>`,
|
||||||
|
"utf8",
|
||||||
|
);
|
||||||
|
await workspace.navigateTo();
|
||||||
|
await openWorkspaceFile(page, "fragments.html");
|
||||||
|
|
||||||
|
const preview = htmlPreview(page);
|
||||||
|
await expect(preview.document.getByRole("link", { name: "Jump to section" })).toBeVisible();
|
||||||
|
await page.screenshot({ path: test.info().outputPath("fragment-before-click.png") });
|
||||||
|
await preview.document.getByRole("link", { name: "Jump to section" }).click();
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
preview.document.getByRole("heading", { name: "Target section" }),
|
||||||
|
).toBeInViewport();
|
||||||
|
expect(await preview.document.locator("body").evaluate(() => location.hash)).toBe("#section");
|
||||||
|
expect(await preview.document.locator("body").evaluate(() => window.scrollY)).toBeGreaterThan(
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
await page.screenshot({ path: test.info().outputPath("fragment-after-click.png") });
|
||||||
|
});
|
||||||
|
|
||||||
|
test("lets an HTML page prevent fragment navigation", async ({ page, withWorkspace }) => {
|
||||||
|
const workspace = await withWorkspace({ prefix: "html-fragment-handler-" });
|
||||||
|
await writeFile(
|
||||||
|
path.join(workspace.repoPath, "handled.html"),
|
||||||
|
`<!doctype html><html><body>
|
||||||
|
<a href="#section" onclick="event.preventDefault(); document.querySelector('output').textContent = 'Page handled click'">Handled jump</a>
|
||||||
|
<output>Waiting for click</output>
|
||||||
|
<div style="height: 1200px"></div><h2 id="section">Target section</h2>
|
||||||
|
</body></html>`,
|
||||||
|
"utf8",
|
||||||
|
);
|
||||||
|
await workspace.navigateTo();
|
||||||
|
await openWorkspaceFile(page, "handled.html");
|
||||||
|
|
||||||
|
const preview = htmlPreview(page);
|
||||||
|
await preview.document.getByRole("link", { name: "Handled jump" }).click();
|
||||||
|
await expect(preview.document.locator("output")).toHaveText("Page handled click");
|
||||||
|
await expect(
|
||||||
|
preview.document.getByRole("heading", { name: "Target section" }),
|
||||||
|
).not.toBeInViewport();
|
||||||
|
expect(await preview.document.locator("body").evaluate(() => location.hash)).toBe("");
|
||||||
|
expect(await preview.document.locator("body").evaluate(() => window.scrollY)).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("respects delegated HTML fragment handlers and normal URL parsing", async ({
|
||||||
|
page,
|
||||||
|
withWorkspace,
|
||||||
|
}) => {
|
||||||
|
const workspace = await withWorkspace({ prefix: "html-fragment-defaults-" });
|
||||||
|
await writeFile(
|
||||||
|
path.join(workspace.repoPath, "defaults.html"),
|
||||||
|
`<!doctype html><html><body>
|
||||||
|
<nav style="position: fixed; top: 0; background: white">
|
||||||
|
<a href="#section" id="document-handler">Document handled jump</a>
|
||||||
|
<a href="#section" id="window-handler">Window handled jump</a>
|
||||||
|
<a href=" \t#section\n">Whitespace jump</a>
|
||||||
|
<a href="#100%">Percent jump</a>
|
||||||
|
<output>Waiting for click</output>
|
||||||
|
</nav>
|
||||||
|
<div style="height: 1200px"></div><h2 id="section">Target section</h2>
|
||||||
|
<div style="height: 1200px"></div><h2 id="100%">Percent target</h2>
|
||||||
|
<div style="height: 1200px"></div>
|
||||||
|
<script>
|
||||||
|
document.addEventListener('click', function(event) {
|
||||||
|
if (event.target.id === 'document-handler') {
|
||||||
|
event.preventDefault(); document.querySelector('output').textContent = 'Document handled click';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
window.addEventListener('click', function(event) {
|
||||||
|
if (event.target.id === 'window-handler') {
|
||||||
|
event.preventDefault(); document.querySelector('output').textContent = 'Window handled click';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script></body></html>`,
|
||||||
|
"utf8",
|
||||||
|
);
|
||||||
|
await workspace.navigateTo();
|
||||||
|
await openWorkspaceFile(page, "defaults.html");
|
||||||
|
|
||||||
|
const preview = htmlPreview(page);
|
||||||
|
await expectPageHandlesFragment(page, "Document");
|
||||||
|
await expectPageHandlesFragment(page, "Window");
|
||||||
|
|
||||||
|
await followHtmlPreviewLink(page, "Whitespace jump");
|
||||||
|
await expect(
|
||||||
|
preview.document.getByRole("heading", { name: "Target section" }),
|
||||||
|
).toBeInViewport();
|
||||||
|
await followHtmlPreviewLink(page, "Percent jump");
|
||||||
|
await expect(
|
||||||
|
preview.document.getByRole("heading", { name: "Percent target" }),
|
||||||
|
).toBeInViewport();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("handles HTML fragment targets, empty and missing fragments, and modified clicks", async ({
|
||||||
|
page,
|
||||||
|
withWorkspace,
|
||||||
|
}) => {
|
||||||
|
const workspace = await withWorkspace({ prefix: "html-fragment-targets-" });
|
||||||
|
await writeFile(
|
||||||
|
path.join(workspace.repoPath, "targets.html"),
|
||||||
|
`<!doctype html><html><head><style>:target { color: rgb(255, 0, 0); }</style></head><body>
|
||||||
|
<nav style="position: fixed; top: 0; background: white">
|
||||||
|
<a href="#section"><span>Nested jump</span></a>
|
||||||
|
<a href="#legacy">Named jump</a>
|
||||||
|
<a href="#encoded%20section">Encoded jump</a>
|
||||||
|
<a href="#missing">Missing jump</a>
|
||||||
|
<a href="#">Empty jump</a>
|
||||||
|
<output>Waiting for hashchange</output><output id="modified">Waiting for modified click</output>
|
||||||
|
</nav>
|
||||||
|
<div style="height: 1200px"></div><h2 id="section">Target section</h2>
|
||||||
|
<div style="height: 1200px"></div><a name="legacy">Named target</a>
|
||||||
|
<div style="height: 1200px"></div><h2 id="encoded section">Encoded target</h2>
|
||||||
|
<div style="height: 1200px"></div>
|
||||||
|
<script>
|
||||||
|
window.addEventListener('hashchange', function () { document.querySelector('output').textContent = location.hash || '(empty)'; });
|
||||||
|
function modifiedClick(event) {
|
||||||
|
if (event.button === 1 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) {
|
||||||
|
document.getElementById('modified').textContent = String(event.defaultPrevented);
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.addEventListener('click', modifiedClick);
|
||||||
|
window.addEventListener('auxclick', modifiedClick);
|
||||||
|
window.addEventListener('contextmenu', modifiedClick);
|
||||||
|
</script></body></html>`,
|
||||||
|
"utf8",
|
||||||
|
);
|
||||||
|
await workspace.navigateTo();
|
||||||
|
await openWorkspaceFile(page, "targets.html");
|
||||||
|
|
||||||
|
const preview = htmlPreview(page);
|
||||||
|
const body = preview.document.locator("body");
|
||||||
|
const nested = preview.document.getByText("Nested jump", { exact: true });
|
||||||
|
await nested.click();
|
||||||
|
await expect(preview.document.locator("output").first()).toHaveText("#section");
|
||||||
|
await expect(
|
||||||
|
preview.document.getByRole("heading", { name: "Target section" }),
|
||||||
|
).toBeInViewport();
|
||||||
|
await expect(preview.document.locator("#section")).toHaveCSS("color", "rgb(255, 0, 0)");
|
||||||
|
|
||||||
|
await body.evaluate(() => window.scrollTo(0, 0));
|
||||||
|
await nested.click();
|
||||||
|
await expect(
|
||||||
|
preview.document.getByRole("heading", { name: "Target section" }),
|
||||||
|
).toBeInViewport();
|
||||||
|
|
||||||
|
await preview.document.getByRole("link", { name: "Named jump" }).click();
|
||||||
|
await expect(preview.document.getByText("Named target", { exact: true })).toBeInViewport();
|
||||||
|
await expect(preview.document.locator("output").first()).toHaveText("#legacy");
|
||||||
|
|
||||||
|
await preview.document.getByRole("link", { name: "Encoded jump" }).click();
|
||||||
|
await expect(
|
||||||
|
preview.document.getByRole("heading", { name: "Encoded target" }),
|
||||||
|
).toBeInViewport();
|
||||||
|
await expect(preview.document.locator("output").first()).toHaveText("#encoded%20section");
|
||||||
|
const scrollY = await body.evaluate(() => window.scrollY);
|
||||||
|
await preview.document.getByRole("link", { name: "Missing jump" }).click();
|
||||||
|
expect(await body.evaluate(() => location.hash)).toBe("#missing");
|
||||||
|
expect(await body.evaluate(() => window.scrollY)).toBe(scrollY);
|
||||||
|
|
||||||
|
await preview.document.getByRole("link", { name: "Empty jump" }).click();
|
||||||
|
await expect(preview.document.locator("output").first()).toHaveText("(empty)");
|
||||||
|
expect(await body.evaluate(() => window.scrollY)).toBe(0);
|
||||||
|
|
||||||
|
for (const modifier of ["Control", "Meta", "Shift", "Alt"] as const) {
|
||||||
|
await nested.click({ modifiers: [modifier] });
|
||||||
|
await expect(preview.document.locator("#modified")).toHaveText("false");
|
||||||
|
}
|
||||||
|
await nested.click({ button: "middle" });
|
||||||
|
await expect(preview.document.locator("#modified")).toHaveText("false");
|
||||||
|
expect(await body.evaluate(() => location.hash)).toBe("");
|
||||||
|
expect(await body.evaluate(() => window.scrollY)).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
test("runs inline scripts without allowing fetch egress", async ({ page, withWorkspace }) => {
|
test("runs inline scripts without allowing fetch egress", async ({ page, withWorkspace }) => {
|
||||||
test.setTimeout(90_000);
|
test.setTimeout(90_000);
|
||||||
const workspace = await withWorkspace({ prefix: "file-editing-html-csp-" });
|
const workspace = await withWorkspace({ prefix: "file-editing-html-csp-" });
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { test } from "../support/fixtures";
|
import { writeFile } from "node:fs/promises";
|
||||||
|
import path from "node:path";
|
||||||
|
import { expect, test } from "../support/fixtures";
|
||||||
import {
|
import {
|
||||||
collapseFolder,
|
collapseFolder,
|
||||||
expandFolder,
|
expandFolder,
|
||||||
@@ -8,6 +10,7 @@ import {
|
|||||||
openFileExplorer,
|
openFileExplorer,
|
||||||
openFileFromExplorer,
|
openFileFromExplorer,
|
||||||
} from "../support/helpers/file-explorer";
|
} from "../support/helpers/file-explorer";
|
||||||
|
import { delayDirectoryListingResponse } from "../support/helpers/directory-listing-gate";
|
||||||
import { gotoWorkspace } from "../support/helpers/launcher";
|
import { gotoWorkspace } from "../support/helpers/launcher";
|
||||||
import { seedWorkspace, type SeededWorkspace } from "../support/helpers/seed-client";
|
import { seedWorkspace, type SeededWorkspace } from "../support/helpers/seed-client";
|
||||||
|
|
||||||
@@ -49,3 +52,66 @@ test.describe("File explorer collapse", () => {
|
|||||||
await expectExplorerEntryVisible(page, "guide.md");
|
await expectExplorerEntryVisible(page, "guide.md");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Files Refresh reveals new files when a cached collapsed folder is reopened", async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
await gotoWorkspace(page, workspace.workspaceId);
|
||||||
|
await openFileExplorer(page);
|
||||||
|
await expandFolder(page, "docs");
|
||||||
|
await expectExplorerEntryVisible(page, "guide.md");
|
||||||
|
await collapseFolder(page, "docs");
|
||||||
|
await expectExplorerEntryHidden(page, "guide.md");
|
||||||
|
await createFileOutsidePaseo("docs/NEW.md");
|
||||||
|
await refreshFiles(page);
|
||||||
|
await expandFolder(page, "docs");
|
||||||
|
await expectExplorerEntryVisible(page, "guide.md");
|
||||||
|
await expectExplorerEntryVisible(page, "NEW.md");
|
||||||
|
|
||||||
|
await createFileOutsidePaseo("docs/NEXT.md");
|
||||||
|
await refreshFiles(page);
|
||||||
|
await expectExplorerEntryVisible(page, "NEXT.md");
|
||||||
|
});
|
||||||
|
|
||||||
|
async function refreshFiles(page: import("@playwright/test").Page): Promise<void> {
|
||||||
|
const refresh = page.getByRole("button", { name: "Refresh files", exact: true });
|
||||||
|
await refresh.click();
|
||||||
|
await expect(refresh).toBeEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createFileOutsidePaseo(filePath: string): Promise<void> {
|
||||||
|
await writeFile(path.join(workspace.repoPath, filePath), "# New output\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
test("Files Refresh ignores an old reply for a folder collapsed while loading", async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
const reply = await delayDirectoryListingResponse(page, "docs");
|
||||||
|
await gotoWorkspace(page, workspace.workspaceId);
|
||||||
|
await openFileExplorer(page);
|
||||||
|
await expandFolder(page, "docs");
|
||||||
|
await reply.waitUntilHeld();
|
||||||
|
await collapseFolder(page, "docs");
|
||||||
|
await createFileOutsidePaseo("docs/DELAYED.md");
|
||||||
|
await refreshFiles(page);
|
||||||
|
await reply.release();
|
||||||
|
await expandFolder(page, "docs");
|
||||||
|
await expectExplorerEntryVisible(page, "DELAYED.md");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Files Refresh preserves expanded folders while their saved view is restoring", async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
await gotoWorkspace(page, workspace.workspaceId);
|
||||||
|
await openFileExplorer(page);
|
||||||
|
await expandFolder(page, "docs");
|
||||||
|
await expectExplorerEntryVisible(page, "guide.md");
|
||||||
|
const reply = await delayDirectoryListingResponse(page, "docs");
|
||||||
|
await page.reload();
|
||||||
|
await openFileExplorer(page);
|
||||||
|
await reply.waitUntilHeld();
|
||||||
|
await refreshFiles(page);
|
||||||
|
await expectExplorerEntryVisible(page, "guide.md");
|
||||||
|
await reply.release();
|
||||||
|
await expectExplorerEntryVisible(page, "guide.md");
|
||||||
|
});
|
||||||
|
|||||||
@@ -294,10 +294,17 @@ test("creates, renames, copies, and deletes entries through the file explorer",
|
|||||||
|
|
||||||
await entry("renamed.txt").click({ button: "right" });
|
await entry("renamed.txt").click({ button: "right" });
|
||||||
const deleteAction = page.getByTestId(/file-explorer-row-\d+-delete$/);
|
const deleteAction = page.getByTestId(/file-explorer-row-\d+-delete$/);
|
||||||
const deleteLabelColor = await deleteAction
|
await expect
|
||||||
.getByText("Delete", { exact: true })
|
.poll(async () => {
|
||||||
.evaluate((element) => getComputedStyle(element).color);
|
const labelColor = await deleteAction
|
||||||
await expect(deleteAction.locator("svg")).toHaveCSS("stroke", deleteLabelColor);
|
.getByText("Delete", { exact: true })
|
||||||
|
.evaluate((element) => getComputedStyle(element).color);
|
||||||
|
const iconColor = await deleteAction
|
||||||
|
.locator("svg")
|
||||||
|
.evaluate((element) => getComputedStyle(element).stroke);
|
||||||
|
return labelColor !== "" && iconColor === labelColor;
|
||||||
|
})
|
||||||
|
.toBe(true);
|
||||||
const cancelledConfirmation = new Promise<string>((resolve) => {
|
const cancelledConfirmation = new Promise<string>((resolve) => {
|
||||||
page.once("dialog", async (dialog) => {
|
page.once("dialog", async (dialog) => {
|
||||||
const message = dialog.message();
|
const message = dialog.message();
|
||||||
|
|||||||
@@ -122,10 +122,14 @@ test.describe("New workspace entry points", () => {
|
|||||||
});
|
});
|
||||||
const hostTrigger = page.getByTestId("host-picker-trigger");
|
const hostTrigger = page.getByTestId("host-picker-trigger");
|
||||||
await expect(hostTrigger).toContainText("localhost", { timeout: 30_000 });
|
await expect(hostTrigger).toContainText("localhost", { timeout: 30_000 });
|
||||||
|
const originalUrl = page.url();
|
||||||
await hostTrigger.click();
|
await hostTrigger.click();
|
||||||
await expect(page.getByTestId("new-workspace-host-picker-add-host")).toBeVisible();
|
await expect(page.getByTestId("new-workspace-host-picker-add-host")).toBeVisible();
|
||||||
await page.getByTestId("new-workspace-host-picker-add-host").click();
|
await page.getByTestId("new-workspace-host-picker-add-host").click();
|
||||||
await expect(page).toHaveURL(/\/settings\/general\?addHost=/);
|
await expect(
|
||||||
|
page.getByRole("button", { name: "Direct connection", exact: true }),
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(page).toHaveURL(originalUrl);
|
||||||
} finally {
|
} finally {
|
||||||
await seeded.cleanup();
|
await seeded.cleanup();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,311 @@
|
|||||||
|
import { execFileSync } from "node:child_process";
|
||||||
|
import { mkdir, rm } from "node:fs/promises";
|
||||||
|
import path from "node:path";
|
||||||
|
import { expect, metroTest as test } from "../support/fixtures";
|
||||||
|
import {
|
||||||
|
addProjectFromSetup,
|
||||||
|
continueSetup,
|
||||||
|
expectSetupStep,
|
||||||
|
finishSetup,
|
||||||
|
goToSetupStep,
|
||||||
|
hostGivesAgentsPaseoTools,
|
||||||
|
openAppAsNewUser,
|
||||||
|
openRelayPairingFromSetup,
|
||||||
|
closeRelayPairing,
|
||||||
|
openTailscaleDocsFromSetup,
|
||||||
|
paseoToolsSwitch,
|
||||||
|
pickTheme,
|
||||||
|
projectSuggestion,
|
||||||
|
projectSuggestionRow,
|
||||||
|
setupModal,
|
||||||
|
setupPrimaryButton,
|
||||||
|
showSetupAgainFromSettings,
|
||||||
|
skipSetup,
|
||||||
|
startSetupHost,
|
||||||
|
} from "../support/helpers/onboarding";
|
||||||
|
import {
|
||||||
|
chooseCustomSkills,
|
||||||
|
openSkillSelection,
|
||||||
|
saveSkillSelection,
|
||||||
|
} from "../support/helpers/agent-skills";
|
||||||
|
import { installDaemonWebSocketGate } from "../support/helpers/daemon-websocket-gate";
|
||||||
|
import { enableRelayAndExpectOffer } from "../support/helpers/pair-device";
|
||||||
|
import { seedWorkspace } from "../support/helpers/seed-client";
|
||||||
|
import { openSettingsHostSection } from "../support/helpers/settings";
|
||||||
|
import { createTempDirectory, createTempGitRepo } from "../support/helpers/workspace";
|
||||||
|
|
||||||
|
// Midnight's muted foreground (#9a9db0), which the step description is drawn in.
|
||||||
|
const MIDNIGHT_MUTED_FOREGROUND = "rgb(154, 157, 176)";
|
||||||
|
|
||||||
|
test("a new user is walked through setup once", async ({ page }, testInfo) => {
|
||||||
|
const host = await startSetupHost("fresh");
|
||||||
|
const repo = await createTempGitRepo("onboarding-folder-");
|
||||||
|
|
||||||
|
try {
|
||||||
|
await openAppAsNewUser(page, host);
|
||||||
|
|
||||||
|
await test.step("setup opens on Appearance and a theme applies at once", async () => {
|
||||||
|
await expectSetupStep(page, "Welcome to Paseo");
|
||||||
|
await pickTheme(page, "Midnight");
|
||||||
|
await expect(
|
||||||
|
setupModal(page).getByText("Let's start by picking a look", { exact: true }),
|
||||||
|
).toHaveCSS("color", MIDNIGHT_MUTED_FOREGROUND);
|
||||||
|
await page.screenshot({ path: testInfo.outputPath("1-appearance.png") });
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step("Providers shows the same provider list as Settings", async () => {
|
||||||
|
await continueSetup(page);
|
||||||
|
await expectSetupStep(page, "Your agents");
|
||||||
|
await expect(setupModal(page).getByTestId("host-page-providers-card")).toBeVisible();
|
||||||
|
await page.screenshot({ path: testInfo.outputPath("2-providers.png") });
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step("with no agent history, Add project opens the regular flow and the folder shows as added", async () => {
|
||||||
|
await continueSetup(page);
|
||||||
|
await expectSetupStep(page, "Add your projects");
|
||||||
|
await expect(
|
||||||
|
setupModal(page).getByText("No recent projects found", { exact: true }),
|
||||||
|
).toBeVisible({ timeout: 60_000 });
|
||||||
|
await addProjectFromSetup(page, repo.path);
|
||||||
|
await expectSetupStep(page, "Add your projects");
|
||||||
|
await expect(setupModal(page).getByText(repo.path, { exact: true })).toBeVisible();
|
||||||
|
await expect(setupModal(page).getByText("Added", { exact: true })).toBeVisible();
|
||||||
|
await page.screenshot({ path: testInfo.outputPath("3-projects.png") });
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step("Orchestration starts with its switches on", async () => {
|
||||||
|
await continueSetup(page);
|
||||||
|
await expectSetupStep(page, "Let agents use Paseo");
|
||||||
|
await expect(paseoToolsSwitch(setupModal(page))).toBeChecked();
|
||||||
|
await expect(
|
||||||
|
setupModal(page).getByRole("switch", { name: "Orchestration skills", exact: true }),
|
||||||
|
).toBeChecked();
|
||||||
|
await page.screenshot({ path: testInfo.outputPath("4-orchestration.png") });
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step("Skip setup closes it for good", async () => {
|
||||||
|
await skipSetup(page);
|
||||||
|
await page.reload();
|
||||||
|
await expect(
|
||||||
|
page.locator('[data-testid^="sidebar-project-row-"]').filter({
|
||||||
|
hasText: path.basename(repo.path),
|
||||||
|
}),
|
||||||
|
).toBeVisible({ timeout: 60_000 });
|
||||||
|
await expect(setupModal(page)).toHaveCount(0);
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
await host.close();
|
||||||
|
await repo.cleanup();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test("setup suggests the repos the user already ran agents in", async ({ page }, testInfo) => {
|
||||||
|
const repo = await createTempGitRepo("onboarding-history-");
|
||||||
|
const repoName = path.basename(repo.path);
|
||||||
|
const subdirectory = path.join(repo.path, "packages", "web");
|
||||||
|
await mkdir(subdirectory, { recursive: true });
|
||||||
|
const worktree = `${repo.path}-fix`;
|
||||||
|
execFileSync("git", ["worktree", "add", "-b", "fix", worktree], { cwd: repo.path });
|
||||||
|
const scratch = await createTempDirectory("onboarding-scratch-");
|
||||||
|
const scratchName = path.basename(scratch.path);
|
||||||
|
const host = await startSetupHost("history", {
|
||||||
|
claudeSessionsIn: [repo.path, subdirectory, worktree, scratch.path, scratch.path, scratch.path],
|
||||||
|
withBrokenProvider: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
await openAppAsNewUser(page, host);
|
||||||
|
await expectSetupStep(page, "Welcome to Paseo");
|
||||||
|
await goToSetupStep(page, "Projects");
|
||||||
|
await expectSetupStep(page, "Add your projects");
|
||||||
|
|
||||||
|
await test.step("the repo, its subfolder and its worktree become one checked row", async () => {
|
||||||
|
await expect(projectSuggestion(page, repoName)).toBeChecked({ timeout: 60_000 });
|
||||||
|
await expect(projectSuggestion(page, scratchName)).toBeChecked();
|
||||||
|
await expect(setupModal(page).getByTestId("project-suggestion")).toHaveCount(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step("a provider that cannot read its history adds nothing and shows no error", async () => {
|
||||||
|
await expect(setupModal(page).getByTestId("project-suggestions-skeleton")).toHaveCount(0, {
|
||||||
|
timeout: 60_000,
|
||||||
|
});
|
||||||
|
await expect(setupModal(page).getByText(/Broken ACP/)).toHaveCount(0);
|
||||||
|
await expect(setupModal(page).getByTestId("project-suggestion")).toHaveCount(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step("the footer adds what is checked; the Add project flow is separate", async () => {
|
||||||
|
await expect(setupPrimaryButton(page, "Add 2 projects")).toBeVisible();
|
||||||
|
await expect(setupModal(page).getByRole("button", { name: "Continue" })).toHaveCount(0);
|
||||||
|
await expect(
|
||||||
|
setupModal(page).getByRole("button", { name: "Add project", exact: true }),
|
||||||
|
).toBeVisible();
|
||||||
|
await page.screenshot({ path: testInfo.outputPath("8-project-suggestions.png") });
|
||||||
|
await projectSuggestion(page, repoName).click();
|
||||||
|
await projectSuggestion(page, scratchName).click();
|
||||||
|
await expect(setupPrimaryButton(page, "Continue")).toBeVisible();
|
||||||
|
await projectSuggestion(page, repoName).click();
|
||||||
|
await projectSuggestion(page, scratchName).click();
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step("a folder that cannot be added keeps the user on the step", async () => {
|
||||||
|
await scratch.cleanup();
|
||||||
|
await setupPrimaryButton(page, "Add 2 projects").click();
|
||||||
|
await expect(setupPrimaryButton(page, "Add 1 project")).toBeVisible({ timeout: 30_000 });
|
||||||
|
await expectSetupStep(page, "Add your projects");
|
||||||
|
await expect(projectSuggestion(page, scratchName)).toBeChecked();
|
||||||
|
await expect(projectSuggestionRow(page, scratchName)).toContainText("Directory not found");
|
||||||
|
await expect(projectSuggestion(page, repoName)).toHaveCount(0);
|
||||||
|
await page.screenshot({ path: testInfo.outputPath("9-project-suggestion-failed.png") });
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step("with nothing checked, Continue moves on without adding", async () => {
|
||||||
|
await projectSuggestion(page, scratchName).click();
|
||||||
|
await setupPrimaryButton(page, "Continue").click();
|
||||||
|
await expectSetupStep(page, "Let agents use Paseo");
|
||||||
|
await expect(
|
||||||
|
page.locator('[data-testid^="sidebar-project-row-"]').filter({ hasText: repoName }),
|
||||||
|
).toBeVisible({ timeout: 60_000 });
|
||||||
|
await expect(
|
||||||
|
page.locator('[data-testid^="sidebar-project-row-"]').filter({ hasText: scratchName }),
|
||||||
|
).toHaveCount(0);
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
await host.close();
|
||||||
|
await rm(worktree, { recursive: true, force: true });
|
||||||
|
await repo.cleanup();
|
||||||
|
await scratch.cleanup();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test("an existing user only sees setup when they ask for it", async ({ page }) => {
|
||||||
|
const host = await startSetupHost("existing");
|
||||||
|
const workspace = await seedWorkspace({ repoPrefix: "onboarding-existing-", port: host.port });
|
||||||
|
|
||||||
|
try {
|
||||||
|
await openAppAsNewUser(page, host);
|
||||||
|
await expect(
|
||||||
|
page.getByTestId(`sidebar-workspace-row-${host.serverId}:${workspace.workspaceId}`),
|
||||||
|
).toBeVisible({ timeout: 60_000 });
|
||||||
|
await expect(setupModal(page)).toHaveCount(0);
|
||||||
|
|
||||||
|
await showSetupAgainFromSettings(page);
|
||||||
|
await expectSetupStep(page, "Welcome to Paseo");
|
||||||
|
await expect(setupModal(page).getByRole("tab", { name: "Appearance" })).toHaveAttribute(
|
||||||
|
"aria-selected",
|
||||||
|
"true",
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
await workspace.cleanup();
|
||||||
|
await host.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test("setup choices carry over to Settings and the phone step pairs over relay", async ({
|
||||||
|
page,
|
||||||
|
}, testInfo) => {
|
||||||
|
const host = await startSetupHost("phone", { mutableRelay: { enabled: false } });
|
||||||
|
|
||||||
|
try {
|
||||||
|
await openAppAsNewUser(page, host);
|
||||||
|
await expectSetupStep(page, "Welcome to Paseo");
|
||||||
|
|
||||||
|
await test.step("Paseo tools start on in setup and Continue turns them on", async () => {
|
||||||
|
await goToSetupStep(page, "Orchestration");
|
||||||
|
await expectSetupStep(page, "Let agents use Paseo");
|
||||||
|
await expect(paseoToolsSwitch(setupModal(page))).toBeChecked();
|
||||||
|
await continueSetup(page);
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step("Phone offers Tailscale docs and pairs over relay in its own modal", async () => {
|
||||||
|
await expectSetupStep(page, "Take your agents with you");
|
||||||
|
await page.screenshot({ path: testInfo.outputPath("5-phone.png") });
|
||||||
|
expect(await openTailscaleDocsFromSetup(page)).toBe(
|
||||||
|
"https://paseo.sh/docs/connectivity#tailscale",
|
||||||
|
);
|
||||||
|
const pairing = await openRelayPairingFromSetup(page);
|
||||||
|
await expect(pairing.getByText("Enable relay?", { exact: true })).toBeVisible();
|
||||||
|
await enableRelayAndExpectOffer(page);
|
||||||
|
await page.screenshot({ path: testInfo.outputPath("6-phone-qr.png") });
|
||||||
|
await closeRelayPairing(pairing);
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step("Finish closes setup and Settings shows the same Paseo tools value", async () => {
|
||||||
|
await finishSetup(page);
|
||||||
|
await page.locator('[data-testid="sidebar-settings"]:visible').first().click();
|
||||||
|
await openSettingsHostSection(page, host.serverId, "agents");
|
||||||
|
await expect(paseoToolsSwitch(page)).toBeChecked();
|
||||||
|
await page.screenshot({ path: testInfo.outputPath("7-settings-agents.png") });
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
await host.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test("with no skills picked, skills read as off and Continue moves on", async ({ page }) => {
|
||||||
|
const host = await startSetupHost("no-skills");
|
||||||
|
|
||||||
|
try {
|
||||||
|
await openAppAsNewUser(page, host);
|
||||||
|
await expectSetupStep(page, "Welcome to Paseo");
|
||||||
|
await goToSetupStep(page, "Orchestration");
|
||||||
|
await expectSetupStep(page, "Let agents use Paseo");
|
||||||
|
|
||||||
|
await openSkillSelection(page);
|
||||||
|
await chooseCustomSkills(page, []);
|
||||||
|
await saveSkillSelection(page);
|
||||||
|
const skillsSwitch = setupModal(page).getByRole("switch", {
|
||||||
|
name: "Orchestration skills",
|
||||||
|
exact: true,
|
||||||
|
});
|
||||||
|
await expect(skillsSwitch).not.toBeChecked();
|
||||||
|
|
||||||
|
await continueSetup(page);
|
||||||
|
await expectSetupStep(page, "Take your agents with you");
|
||||||
|
} finally {
|
||||||
|
await host.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test("in the compact layout, Finish on Orchestration applies its switches", async ({ page }) => {
|
||||||
|
await page.setViewportSize({ width: 390, height: 844 });
|
||||||
|
const host = await startSetupHost("compact");
|
||||||
|
const gate = await installDaemonWebSocketGate(page, { port: host.port });
|
||||||
|
// The compact sheet is the only surface on screen, and Orchestration is its last step.
|
||||||
|
const step = (title: string) =>
|
||||||
|
expect(page.getByRole("heading", { name: title, exact: true })).toBeVisible({
|
||||||
|
timeout: 60_000,
|
||||||
|
});
|
||||||
|
const primary = (label: string) => page.getByRole("button", { name: label, exact: true });
|
||||||
|
|
||||||
|
try {
|
||||||
|
await openAppAsNewUser(page, host);
|
||||||
|
await step("Welcome to Paseo");
|
||||||
|
await primary("Continue").click();
|
||||||
|
await step("Your agents");
|
||||||
|
await primary("Continue").click();
|
||||||
|
await step("Add your projects");
|
||||||
|
await primary("Continue").click();
|
||||||
|
|
||||||
|
// The setup host starts with Paseo tools off; the switch starts on.
|
||||||
|
expect(await hostGivesAgentsPaseoTools(host)).toBe(false);
|
||||||
|
await step("Let agents use Paseo");
|
||||||
|
await expect(paseoToolsSwitch(page)).toBeChecked();
|
||||||
|
// Skills are not installed, so leaving them off has nothing to apply.
|
||||||
|
const skillsSwitch = page.getByRole("switch", { name: "Orchestration skills", exact: true });
|
||||||
|
await skillsSwitch.click();
|
||||||
|
await expect(skillsSwitch).not.toBeChecked();
|
||||||
|
gate.holdNextClientRequest("set_daemon_config_request");
|
||||||
|
await primary("Finish").click();
|
||||||
|
|
||||||
|
// While the choices apply, none of them can change.
|
||||||
|
await gate.waitForHeldClientRequest();
|
||||||
|
await expect(paseoToolsSwitch(page)).toBeDisabled();
|
||||||
|
await expect(skillsSwitch).toBeDisabled();
|
||||||
|
gate.releaseHeldClientRequest();
|
||||||
|
|
||||||
|
await expect.poll(() => hostGivesAgentsPaseoTools(host), { timeout: 30_000 }).toBe(true);
|
||||||
|
await expect(page.getByRole("heading", { name: "Let agents use Paseo" })).toHaveCount(0);
|
||||||
|
} finally {
|
||||||
|
await host.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -10,6 +10,7 @@ test("plugin header and composer buttons share actions, menus, content, and upda
|
|||||||
await buttons.verifyObservationLifetime();
|
await buttons.verifyObservationLifetime();
|
||||||
await buttons.openWideMenusAndPopovers();
|
await buttons.openWideMenusAndPopovers();
|
||||||
await buttons.runAndUpdateActions();
|
await buttons.runAndUpdateActions();
|
||||||
|
await buttons.keepTrackSpaceWithoutPills();
|
||||||
await buttons.openCompactSheets();
|
await buttons.openCompactSheets();
|
||||||
await buttons.useCompactWorkspaceMenu();
|
await buttons.useCompactWorkspaceMenu();
|
||||||
await buttons.hideAndUnloadOpenButtons();
|
await buttons.hideAndUnloadOpenButtons();
|
||||||
|
|||||||
@@ -16,6 +16,14 @@ import {
|
|||||||
returnAndReopenSettings,
|
returnAndReopenSettings,
|
||||||
returnToPluginsPage,
|
returnToPluginsPage,
|
||||||
expectSettingsUnavailable,
|
expectSettingsUnavailable,
|
||||||
|
openPluginsPage,
|
||||||
|
expectActionsMenuWithoutSettings,
|
||||||
|
expectNoSettingsCogWithoutScreens,
|
||||||
|
openTabbedSettings,
|
||||||
|
selectSettingsTab,
|
||||||
|
openTabbedSettingsLink,
|
||||||
|
expectSettingsTooltip,
|
||||||
|
expectNamedPluginRow,
|
||||||
} from "../support/helpers/plugin-settings";
|
} from "../support/helpers/plugin-settings";
|
||||||
|
|
||||||
test("display preferences survive a reload", async ({ page }) => {
|
test("display preferences survive a reload", async ({ page }) => {
|
||||||
@@ -49,6 +57,32 @@ test("Back to plugins returns from a plugin settings screen", async ({ page }) =
|
|||||||
await returnToPluginsPage(page);
|
await returnToPluginsPage(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 cog explains itself", async () => {
|
||||||
|
await expectSettingsTooltip(page);
|
||||||
|
});
|
||||||
|
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("a plugin without settings screens shows no cog", async () => {
|
||||||
|
await expectNoSettingsCogWithoutScreens(page);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("a settings screen link opens its tab", async ({ page }) => {
|
||||||
|
await openTabbedSettingsLink(page, "Advanced");
|
||||||
|
});
|
||||||
|
|
||||||
test.describe("compact plugin settings", () => {
|
test.describe("compact plugin settings", () => {
|
||||||
test.use({ viewport: { width: 390, height: 844 } });
|
test.use({ viewport: { width: 390, height: 844 } });
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import path from "node:path";
|
|||||||
import type { Locator, Page } from "@playwright/test";
|
import type { Locator, Page } from "@playwright/test";
|
||||||
import { expect, test } from "../support/fixtures";
|
import { expect, test } from "../support/fixtures";
|
||||||
import { gotoWorkspace } from "../support/helpers/launcher";
|
import { gotoWorkspace } from "../support/helpers/launcher";
|
||||||
|
import { gotoAppShell } from "../support/helpers/app";
|
||||||
import {
|
import {
|
||||||
BOTS_PLUGIN_ID,
|
BOTS_PLUGIN_ID,
|
||||||
COMPACT,
|
COMPACT,
|
||||||
@@ -27,6 +28,7 @@ import { seedWorkspace } from "../support/helpers/seed-client";
|
|||||||
import { getServerId } from "../support/helpers/server-id";
|
import { getServerId } from "../support/helpers/server-id";
|
||||||
import { installUsageReportsFixture } from "../support/helpers/usage-reports";
|
import { installUsageReportsFixture } from "../support/helpers/usage-reports";
|
||||||
import { claudeAndCodexReports } from "../support/helpers/usage-sidebar-item";
|
import { claudeAndCodexReports } from "../support/helpers/usage-sidebar-item";
|
||||||
|
import { daemonWsRoutePattern } from "../support/helpers/daemon-port";
|
||||||
|
|
||||||
const APP_SETTINGS_KEY = "@paseo:app-settings";
|
const APP_SETTINGS_KEY = "@paseo:app-settings";
|
||||||
|
|
||||||
@@ -133,6 +135,30 @@ function sidebarFooter(page: Page): Locator {
|
|||||||
return visibleTestId(page, "sidebar-add-project").locator("xpath=..");
|
return visibleTestId(page, "sidebar-add-project").locator("xpath=..");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isPluginCatalogResponse(message: string | Buffer): boolean {
|
||||||
|
if (typeof message !== "string") return false;
|
||||||
|
const frame = JSON.parse(message);
|
||||||
|
return frame.type === "session" && frame.message?.type === "plugin.catalog.get.response";
|
||||||
|
}
|
||||||
|
|
||||||
|
async function holdNextPluginCatalogResponse(page: Page) {
|
||||||
|
const response = Promise.withResolvers<() => void>();
|
||||||
|
let holdCatalog = true;
|
||||||
|
await page.routeWebSocket(daemonWsRoutePattern(), (socket) => {
|
||||||
|
const server = socket.connectToServer();
|
||||||
|
socket.onMessage((message) => server.send(message));
|
||||||
|
server.onMessage((message) => {
|
||||||
|
if (holdCatalog && isPluginCatalogResponse(message)) {
|
||||||
|
holdCatalog = false;
|
||||||
|
response.resolve(() => socket.send(message));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
socket.send(message);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return { response: response.promise };
|
||||||
|
}
|
||||||
|
|
||||||
test.describe("Plugin sidebar items", () => {
|
test.describe("Plugin sidebar items", () => {
|
||||||
let workspaceId: string;
|
let workspaceId: string;
|
||||||
let cleanup: () => Promise<void>;
|
let cleanup: () => Promise<void>;
|
||||||
@@ -151,6 +177,69 @@ test.describe("Plugin sidebar items", () => {
|
|||||||
await cleanup();
|
await cleanup();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("a short compact sidebar keeps workspaces usable while navigation scrolls", async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
await page.setViewportSize({ width: 390, height: 600 });
|
||||||
|
await gotoAppShell(page);
|
||||||
|
await page.getByRole("button", { name: "Open menu", exact: true }).first().click();
|
||||||
|
await expect(botRow(page, "status")).toBeAttached();
|
||||||
|
const workspace = visibleTestId(page, `sidebar-workspace-row-${getServerId()}:${workspaceId}`);
|
||||||
|
await expect(workspace).toBeInViewport({ ratio: 1 });
|
||||||
|
|
||||||
|
await test.step("scrolling navigation reaches its last row without moving workspaces", async () => {
|
||||||
|
const before = await boxOf(workspace);
|
||||||
|
await visibleTestId(page, "sidebar-global-new-workspace").hover();
|
||||||
|
await page.mouse.wheel(0, 800);
|
||||||
|
await expect(botRow(page, "status")).toBeInViewport({ ratio: 1 });
|
||||||
|
await expect(workspace).toBeInViewport({ ratio: 1 });
|
||||||
|
expect((await boxOf(workspace)).y).toBe(before.y);
|
||||||
|
await botRow(page, "status").click();
|
||||||
|
await expect(page.getByText("Bot status details", { exact: true })).toBeVisible();
|
||||||
|
await page.getByRole("button", { name: "Close bot status", exact: true }).click();
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step("the workspace still opens and closes the sidebar", async () => {
|
||||||
|
await workspace.click();
|
||||||
|
await expect(
|
||||||
|
page.getByRole("button", { name: "Open menu", exact: true }).first(),
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(workspace).not.toBeInViewport();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("a restored plugin screen waits for its catalog before rendering", async ({ page }) => {
|
||||||
|
await page.setViewportSize(WIDE);
|
||||||
|
await gotoWorkspace(page, workspaceId);
|
||||||
|
const row = headerRow(page, SHOWCASE_PLUGIN_ID, "deploys");
|
||||||
|
await expect(row).toBeVisible({ timeout: 30_000 });
|
||||||
|
await row.click();
|
||||||
|
const body = page.getByText("Deploys screen body", { exact: true });
|
||||||
|
await expect(body).toBeVisible();
|
||||||
|
const screenUrl = page.url();
|
||||||
|
const catalog = await holdNextPluginCatalogResponse(page);
|
||||||
|
|
||||||
|
await page.reload();
|
||||||
|
const releaseCatalog = await catalog.response;
|
||||||
|
try {
|
||||||
|
await expect(
|
||||||
|
page.getByRole("progressbar", { name: "Loading plugin", exact: true }),
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.getByText("This plugin surface is unavailable.", { exact: true }),
|
||||||
|
).toHaveCount(0);
|
||||||
|
await expect(body).toHaveCount(0);
|
||||||
|
} finally {
|
||||||
|
releaseCatalog();
|
||||||
|
}
|
||||||
|
|
||||||
|
await expect(body).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.getByRole("progressbar", { name: "Loading plugin", exact: true }),
|
||||||
|
).toHaveCount(0);
|
||||||
|
await expect(page).toHaveURL(screenUrl);
|
||||||
|
});
|
||||||
|
|
||||||
test("a plugin's screen, header row, footer popover and command work together", async ({
|
test("a plugin's screen, header row, footer popover and command work together", async ({
|
||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
import { writeFile } from "node:fs/promises";
|
||||||
|
import path from "node:path";
|
||||||
|
import { expect, test, type Page } from "../support/fixtures";
|
||||||
|
import { gotoAppShell } from "../support/helpers/app";
|
||||||
|
import { openCommandCenter } from "../support/helpers/command-center";
|
||||||
|
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
|
||||||
|
import { copyPluginExample } from "../support/helpers/plugin-fixture";
|
||||||
|
import { seedWorkspace, type SeededWorkspace } from "../support/helpers/seed-client";
|
||||||
|
import { getServerId } from "../support/helpers/server-id";
|
||||||
|
import {
|
||||||
|
switchWorkspaceViaSidebar,
|
||||||
|
waitForWorkspaceInSidebar,
|
||||||
|
} from "../support/helpers/workspace-ui";
|
||||||
|
|
||||||
|
async function runCommand(page: Page, title: string): Promise<void> {
|
||||||
|
const panel = await openCommandCenter(page);
|
||||||
|
await panel.getByTestId("command-center-input").fill(title);
|
||||||
|
await panel.getByRole("button", { name: title, exact: true }).click();
|
||||||
|
await expect(panel).not.toBeVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Installs a plugin example, opens a seeded workspace, and runs `exercise` against them. */
|
||||||
|
async function withExample(
|
||||||
|
page: Page,
|
||||||
|
example: { name: string; id: string },
|
||||||
|
exercise: (workspace: SeededWorkspace) => Promise<void>,
|
||||||
|
): Promise<void> {
|
||||||
|
const client = await connectNewWorkspaceDaemonClient({ ownProjects: false });
|
||||||
|
const previous = await client.getDaemonConfig();
|
||||||
|
const copy = await copyPluginExample(example.name);
|
||||||
|
const workspace = await seedWorkspace({ repoPrefix: `${example.name}-` });
|
||||||
|
try {
|
||||||
|
await client.patchDaemonConfig({ pluginsEnabled: true });
|
||||||
|
await client.installDirectoryPlugin(copy.directory);
|
||||||
|
await page.setViewportSize({ width: 1280, height: 800 });
|
||||||
|
await gotoAppShell(page);
|
||||||
|
const target = { serverId: getServerId(), workspaceId: workspace.workspaceId };
|
||||||
|
await waitForWorkspaceInSidebar(page, target);
|
||||||
|
await switchWorkspaceViaSidebar({ page, ...target });
|
||||||
|
await exercise(workspace);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
await client.removePlugin(example.id);
|
||||||
|
} finally {
|
||||||
|
await client.patchDaemonConfig({ pluginsEnabled: previous.config.pluginsEnabled });
|
||||||
|
await workspace.cleanup();
|
||||||
|
await client.close();
|
||||||
|
await copy.cleanup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test.describe("plugin subscriptions", () => {
|
||||||
|
test.describe.configure({ timeout: 180_000 });
|
||||||
|
|
||||||
|
test("a panel follows events the daemon pushes as files change", async ({ page }) => {
|
||||||
|
await withExample(page, { name: "diff-watch", id: "diff-watch" }, async (workspace) => {
|
||||||
|
await runCommand(page, "Open live changes");
|
||||||
|
await expect(page.getByText("No changes", { exact: true })).toBeVisible();
|
||||||
|
|
||||||
|
await writeFile(path.join(workspace.repoPath, "pushed.txt"), "from the test\n");
|
||||||
|
await expect(page.getByText("1 file changed", { exact: true })).toBeVisible();
|
||||||
|
await expect(page.getByText("pushed.txt", { exact: true })).toBeVisible();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("a panel plays streamed bytes and sends bytes back", async ({ page }) => {
|
||||||
|
await withExample(page, { name: "media-stream", id: "media-stream" }, async () => {
|
||||||
|
await runCommand(page, "Open media stream");
|
||||||
|
await expect(page.getByText("live", { exact: true })).toBeVisible();
|
||||||
|
await expect(page.getByText(/^[1-9]\d* video frames/)).toBeVisible();
|
||||||
|
|
||||||
|
await page.getByRole("button", { name: "Send this frame back", exact: true }).click();
|
||||||
|
await expect(
|
||||||
|
page.getByText(/^The daemon received [1-9]\d* bytes, sha256 [0-9a-f]{12}$/),
|
||||||
|
).toBeVisible();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -2,7 +2,6 @@ import { pluginRequirements } from "../support/helpers/plugin-fixture";
|
|||||||
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import type { Page } from "@playwright/test";
|
|
||||||
import { expect, test } from "../support/fixtures";
|
import { expect, test } from "../support/fixtures";
|
||||||
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
|
import { connectNewWorkspaceDaemonClient } from "../support/helpers/new-workspace";
|
||||||
import { openSettingsSection } from "../support/helpers/settings";
|
import { openSettingsSection } from "../support/helpers/settings";
|
||||||
@@ -69,8 +68,7 @@ test("applies a contributed theme and falls back when its plugin is gone", async
|
|||||||
await openSettingsSection(page, "appearance");
|
await openSettingsSection(page, "appearance");
|
||||||
|
|
||||||
const sectionTitle = page.getByText("Theme", { exact: true }).first();
|
const sectionTitle = page.getByText("Theme", { exact: true }).first();
|
||||||
await page.getByLabel("Theme: System", { exact: true }).click();
|
const mochaItem = page.getByRole("radio", { name: "Catppuccin Mocha", exact: true });
|
||||||
const mochaItem = page.getByText("Catppuccin Mocha", { exact: true });
|
|
||||||
await expect(mochaItem).toBeVisible({ timeout: 30_000 });
|
await expect(mochaItem).toBeVisible({ timeout: 30_000 });
|
||||||
await page.screenshot({
|
await page.screenshot({
|
||||||
path: testInfo.outputPath("plugin-theme-picker.png"),
|
path: testInfo.outputPath("plugin-theme-picker.png"),
|
||||||
@@ -79,14 +77,14 @@ test("applies a contributed theme and falls back when its plugin is gone", async
|
|||||||
});
|
});
|
||||||
|
|
||||||
await test.step("a contributed light theme uses the light palette", async () => {
|
await test.step("a contributed light theme uses the light palette", async () => {
|
||||||
await page.getByText("Catppuccin Latte", { exact: true }).click();
|
const latteItem = page.getByRole("radio", { name: "Catppuccin Latte", exact: true });
|
||||||
await expect(page.getByLabel("Theme: Catppuccin Latte", { exact: true })).toBeVisible();
|
await latteItem.click();
|
||||||
|
await expect(latteItem).toBeChecked();
|
||||||
await expect(sectionTitle).toHaveCSS("color", LATTE_MUTED_FOREGROUND);
|
await expect(sectionTitle).toHaveCSS("color", LATTE_MUTED_FOREGROUND);
|
||||||
await page.getByLabel("Theme: Catppuccin Latte", { exact: true }).click();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await mochaItem.click();
|
await mochaItem.click();
|
||||||
await expect(page.getByLabel("Theme: Catppuccin Mocha", { exact: true })).toBeVisible();
|
await expect(mochaItem).toBeChecked();
|
||||||
await expect(sectionTitle).toHaveCSS("color", MOCHA_MUTED_FOREGROUND);
|
await expect(sectionTitle).toHaveCSS("color", MOCHA_MUTED_FOREGROUND);
|
||||||
await page.screenshot({
|
await page.screenshot({
|
||||||
path: testInfo.outputPath("plugin-theme-applied.png"),
|
path: testInfo.outputPath("plugin-theme-applied.png"),
|
||||||
@@ -95,15 +93,13 @@ test("applies a contributed theme and falls back when its plugin is gone", async
|
|||||||
|
|
||||||
await test.step("the selection survives a reload", async () => {
|
await test.step("the selection survives a reload", async () => {
|
||||||
await page.reload();
|
await page.reload();
|
||||||
await expect(page.getByLabel("Theme: Catppuccin Mocha", { exact: true })).toBeVisible({
|
await expect(mochaItem).toBeChecked({ timeout: 30_000 });
|
||||||
timeout: 30_000,
|
|
||||||
});
|
|
||||||
await expect(sectionTitle).toHaveCSS("color", MOCHA_MUTED_FOREGROUND);
|
await expect(sectionTitle).toHaveCSS("color", MOCHA_MUTED_FOREGROUND);
|
||||||
});
|
});
|
||||||
|
|
||||||
await test.step("removing the plugin falls back to the default theme", async () => {
|
await test.step("removing the plugin falls back to the default theme", async () => {
|
||||||
await client.removePlugin(PLUGIN_ID);
|
await client.removePlugin(PLUGIN_ID);
|
||||||
await expect(page.getByLabel("Theme: System", { exact: true })).toBeVisible({
|
await expect(page.getByRole("radio", { name: "System", exact: true })).toBeChecked({
|
||||||
timeout: 30_000,
|
timeout: 30_000,
|
||||||
});
|
});
|
||||||
await expect(sectionTitle).not.toHaveCSS("color", MOCHA_MUTED_FOREGROUND);
|
await expect(sectionTitle).not.toHaveCSS("color", MOCHA_MUTED_FOREGROUND);
|
||||||
@@ -147,15 +143,7 @@ const MANY_THEMES_SOURCE = `export default function contribute(plugin) {
|
|||||||
return () => {};
|
return () => {};
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
async function scrollThemeMenuToLastTheme(page: Page) {
|
test("reaches the last theme when a plugin contributes more themes than fit", async ({
|
||||||
const firstTheme = page.getByText("Pack theme 1", { exact: true });
|
|
||||||
await expect(firstTheme).toBeVisible({ timeout: 30_000 });
|
|
||||||
await firstTheme.hover();
|
|
||||||
await page.mouse.wheel(0, 4000);
|
|
||||||
await expect(page.getByText(LAST_THEME_NAME, { exact: true })).toBeInViewport({ ratio: 1 });
|
|
||||||
}
|
|
||||||
|
|
||||||
test("scrolls to the last theme when a plugin contributes more themes than fit", async ({
|
|
||||||
page,
|
page,
|
||||||
}, testInfo) => {
|
}, testInfo) => {
|
||||||
const directory = await mkdtemp(path.join(tmpdir(), "paseo-plugin-theme-many-e2e-"));
|
const directory = await mkdtemp(path.join(tmpdir(), "paseo-plugin-theme-many-e2e-"));
|
||||||
@@ -175,15 +163,16 @@ test("scrolls to the last theme when a plugin contributes more themes than fit",
|
|||||||
await expect(page.getByTestId("settings-sidebar")).toBeVisible();
|
await expect(page.getByTestId("settings-sidebar")).toBeVisible();
|
||||||
await openSettingsSection(page, "appearance");
|
await openSettingsSection(page, "appearance");
|
||||||
|
|
||||||
await page.getByLabel("Theme: System", { exact: true }).click();
|
const lastTheme = page.getByRole("radio", { name: LAST_THEME_NAME, exact: true });
|
||||||
await scrollThemeMenuToLastTheme(page);
|
await expect(lastTheme).toBeAttached({ timeout: 30_000 });
|
||||||
|
await lastTheme.scrollIntoViewIfNeeded();
|
||||||
await page.screenshot({
|
await page.screenshot({
|
||||||
path: testInfo.outputPath("plugin-theme-picker-scrolled.png"),
|
path: testInfo.outputPath("plugin-theme-picker-scrolled.png"),
|
||||||
animations: "disabled",
|
animations: "disabled",
|
||||||
});
|
});
|
||||||
|
|
||||||
await page.getByText(LAST_THEME_NAME, { exact: true }).click();
|
await lastTheme.click();
|
||||||
await expect(page.getByLabel(`Theme: ${LAST_THEME_NAME}`, { exact: true })).toBeVisible();
|
await expect(lastTheme).toBeChecked();
|
||||||
} finally {
|
} finally {
|
||||||
await client.removePlugin(MANY_THEMES_PLUGIN_ID).catch(() => undefined);
|
await client.removePlugin(MANY_THEMES_PLUGIN_ID).catch(() => undefined);
|
||||||
await client
|
await client
|
||||||
|
|||||||
@@ -108,10 +108,7 @@ test.describe("Question option text", () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test("selecting description text never answers, and the label still does", async ({
|
test("selecting description text keeps the question open", async ({ page, context }) => {
|
||||||
page,
|
|
||||||
context,
|
|
||||||
}) => {
|
|
||||||
test.setTimeout(180_000);
|
test.setTimeout(180_000);
|
||||||
const { session, card } = await openLinkedQuestions(page, context);
|
const { session, card } = await openLinkedQuestions(page, context);
|
||||||
try {
|
try {
|
||||||
@@ -120,16 +117,13 @@ test.describe("Question option text", () => {
|
|||||||
|
|
||||||
await dragAcross(page, description);
|
await dragAcross(page, description);
|
||||||
await expect.poll(() => selectedText(page)).toBe(DONE_DESCRIPTION);
|
await expect.poll(() => selectedText(page)).toBe(DONE_DESCRIPTION);
|
||||||
await expectChecked(done, false);
|
|
||||||
|
|
||||||
await description.getByText("Logs are at", { exact: false }).dblclick({
|
await description.getByText("Logs are at", { exact: false }).dblclick({
|
||||||
position: { x: 4, y: 4 },
|
position: { x: 4, y: 4 },
|
||||||
});
|
});
|
||||||
await expect.poll(() => selectedText(page)).toBe("Logs");
|
await expect.poll(() => selectedText(page)).toBe("Logs");
|
||||||
await expectCurrentQuestion(page, { index: 1, total: 2, question: LINKED_QUESTION });
|
await expectCurrentQuestion(page, { index: 1, total: 2, question: LINKED_QUESTION });
|
||||||
await expectChecked(done, false);
|
await expectChecked(done, true);
|
||||||
|
await continueToNextQuestion(page);
|
||||||
await done.getByText("Done", { exact: true }).click();
|
|
||||||
await expectCurrentQuestion(page, { index: 2, total: 2, question: CHECKS_QUESTION });
|
await expectCurrentQuestion(page, { index: 2, total: 2, question: CHECKS_QUESTION });
|
||||||
await openQuestion(page, { index: 1, total: 2 });
|
await openQuestion(page, { index: 1, total: 2 });
|
||||||
await expectChecked(done, true);
|
await expectChecked(done, true);
|
||||||
@@ -138,11 +132,17 @@ test.describe("Question option text", () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test("double-clicking a single-select label answers once", async ({ page, context }) => {
|
test("double-clicking a single-select label selects once without advancing", async ({
|
||||||
|
page,
|
||||||
|
context,
|
||||||
|
}) => {
|
||||||
test.setTimeout(180_000);
|
test.setTimeout(180_000);
|
||||||
const { session, card } = await openLinkedQuestions(page, context);
|
const { session, card } = await openLinkedQuestions(page, context);
|
||||||
try {
|
try {
|
||||||
await card.getByRole("radio", { name: "Done" }).getByText("Done", { exact: true }).dblclick();
|
await card.getByRole("radio", { name: "Done" }).getByText("Done", { exact: true }).dblclick();
|
||||||
|
await expectCurrentQuestion(page, { index: 1, total: 2, question: LINKED_QUESTION });
|
||||||
|
await expectChecked(card.getByRole("radio", { name: "Done" }), true);
|
||||||
|
await continueToNextQuestion(page);
|
||||||
|
|
||||||
await expectCurrentQuestion(page, { index: 2, total: 2, question: CHECKS_QUESTION });
|
await expectCurrentQuestion(page, { index: 2, total: 2, question: CHECKS_QUESTION });
|
||||||
await expectChecked(card.getByRole("checkbox", { name: "Lint" }), false);
|
await expectChecked(card.getByRole("checkbox", { name: "Lint" }), false);
|
||||||
@@ -154,14 +154,12 @@ test.describe("Question option text", () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test("multi-select description links and selection leave the option unchanged", async ({
|
test("multi-select descriptions support links and text selection", async ({ page, context }) => {
|
||||||
page,
|
|
||||||
context,
|
|
||||||
}) => {
|
|
||||||
test.setTimeout(180_000);
|
test.setTimeout(180_000);
|
||||||
const { session, card } = await openLinkedQuestions(page, context);
|
const { session, card } = await openLinkedQuestions(page, context);
|
||||||
try {
|
try {
|
||||||
await card.getByRole("radio", { name: "Done" }).getByText("Done", { exact: true }).click();
|
await card.getByRole("radio", { name: "Done" }).getByText("Done", { exact: true }).click();
|
||||||
|
await continueToNextQuestion(page);
|
||||||
await expectCurrentQuestion(page, { index: 2, total: 2, question: CHECKS_QUESTION });
|
await expectCurrentQuestion(page, { index: 2, total: 2, question: CHECKS_QUESTION });
|
||||||
|
|
||||||
const lint = card.getByRole("checkbox", { name: "Lint" });
|
const lint = card.getByRole("checkbox", { name: "Lint" });
|
||||||
@@ -177,18 +175,16 @@ test.describe("Question option text", () => {
|
|||||||
|
|
||||||
await dragAcross(page, description);
|
await dragAcross(page, description);
|
||||||
await expect.poll(() => selectedText(page)).toBe(LINT_DESCRIPTION);
|
await expect.poll(() => selectedText(page)).toBe(LINT_DESCRIPTION);
|
||||||
await expectChecked(lint, false);
|
|
||||||
|
|
||||||
await description.getByText("Rules:", { exact: false }).dblclick({
|
await description.getByText("Rules:", { exact: false }).dblclick({
|
||||||
position: { x: 4, y: 4 },
|
position: { x: 4, y: 4 },
|
||||||
});
|
});
|
||||||
await expect.poll(() => selectedText(page)).toBe("Rules");
|
await expect.poll(() => selectedText(page)).toBe("Rules");
|
||||||
await expectChecked(lint, false);
|
await expectChecked(lint, true);
|
||||||
|
|
||||||
await typecheck.getByText("Typecheck", { exact: true }).dblclick();
|
await typecheck.getByText("Typecheck", { exact: true }).dblclick();
|
||||||
await expectChecked(typecheck, true);
|
await expectChecked(typecheck, true);
|
||||||
await lint.getByText("Lint", { exact: true }).click();
|
await lint.getByText("Lint", { exact: true }).click();
|
||||||
await expectChecked(lint, true);
|
await expectChecked(lint, false);
|
||||||
} finally {
|
} finally {
|
||||||
await session.cleanup();
|
await session.cleanup();
|
||||||
}
|
}
|
||||||
@@ -268,6 +264,7 @@ test.describe("Question prompt pagination", () => {
|
|||||||
await expectQuestionHidden(page, SUCCESS_QUESTION);
|
await expectQuestionHidden(page, SUCCESS_QUESTION);
|
||||||
|
|
||||||
await chooseQuestionOption(page, "App");
|
await chooseQuestionOption(page, "App");
|
||||||
|
await continueToNextQuestion(page);
|
||||||
await expectCurrentQuestion(page, {
|
await expectCurrentQuestion(page, {
|
||||||
index: 2,
|
index: 2,
|
||||||
total: TOTAL_QUESTIONS,
|
total: TOTAL_QUESTIONS,
|
||||||
@@ -288,6 +285,7 @@ test.describe("Question prompt pagination", () => {
|
|||||||
preview: 'flags.enabled("new-surface")',
|
preview: 'flags.enabled("new-surface")',
|
||||||
});
|
});
|
||||||
await chooseQuestionOption(page, "Behind feature flag");
|
await chooseQuestionOption(page, "Behind feature flag");
|
||||||
|
await continueToNextQuestion(page);
|
||||||
await expectCurrentQuestion(page, {
|
await expectCurrentQuestion(page, {
|
||||||
index: 3,
|
index: 3,
|
||||||
total: TOTAL_QUESTIONS,
|
total: TOTAL_QUESTIONS,
|
||||||
@@ -466,7 +464,9 @@ retryTest(
|
|||||||
retryTest.setTimeout(180_000);
|
retryTest.setTimeout(180_000);
|
||||||
const card = page.getByTestId("question-form-card");
|
const card = page.getByTestId("question-form-card");
|
||||||
await chooseQuestionOption(page, "App");
|
await chooseQuestionOption(page, "App");
|
||||||
|
await continueToNextQuestion(page);
|
||||||
await chooseQuestionOption(page, "Behind feature flag");
|
await chooseQuestionOption(page, "Behind feature flag");
|
||||||
|
await continueToNextQuestion(page);
|
||||||
await fillQuestionAnswer(page, {
|
await fillQuestionAnswer(page, {
|
||||||
question: SUCCESS_QUESTION,
|
question: SUCCESS_QUESTION,
|
||||||
answer: "Preserve my answers after a failed submission.",
|
answer: "Preserve my answers after a failed submission.",
|
||||||
@@ -520,7 +520,9 @@ retryTest(
|
|||||||
const card = page.getByTestId("question-form-card");
|
const card = page.getByTestId("question-form-card");
|
||||||
questionClient.releaseFirstResponse();
|
questionClient.releaseFirstResponse();
|
||||||
await chooseQuestionOption(page, "App");
|
await chooseQuestionOption(page, "App");
|
||||||
|
await continueToNextQuestion(page);
|
||||||
await chooseQuestionOption(page, "Behind feature flag");
|
await chooseQuestionOption(page, "Behind feature flag");
|
||||||
|
await continueToNextQuestion(page);
|
||||||
await fillQuestionAnswer(page, {
|
await fillQuestionAnswer(page, {
|
||||||
question: SUCCESS_QUESTION,
|
question: SUCCESS_QUESTION,
|
||||||
answer: "Start with the internal team.",
|
answer: "Start with the internal team.",
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
import {
|
||||||
|
openGlobalNewWorkspaceComposer,
|
||||||
|
fillNewWorkspaceDraft,
|
||||||
|
expectNewWorkspaceDraft,
|
||||||
|
} from "../support/helpers/new-workspace";
|
||||||
import { readFile, mkdir, rename, rm } from "node:fs/promises";
|
import { readFile, mkdir, rename, rm } from "node:fs/promises";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import type { DaemonClient } from "@getpaseo/client/internal/daemon-client";
|
import type { DaemonClient } from "@getpaseo/client/internal/daemon-client";
|
||||||
@@ -257,12 +262,15 @@ test.describe("Settings host page", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("restart recovery host controls persist the opt-out and custom prompt", async ({ page }) => {
|
test("restart recovery defaults off and persists opt-in and custom prompt", async ({ page }) => {
|
||||||
const serverId = getServerId();
|
const serverId = getServerId();
|
||||||
await gotoAppShell(page);
|
await gotoAppShell(page);
|
||||||
await openSettings(page);
|
await openSettings(page);
|
||||||
await openSettingsHost(page, serverId);
|
await openSettingsHost(page, serverId);
|
||||||
await openHostSection(page, serverId, "agents");
|
await openHostSection(page, serverId, "agents");
|
||||||
|
await expectRestartRecoveryEnabled(page, false);
|
||||||
|
await setRestartRecoveryEnabled(page, true);
|
||||||
|
await page.reload();
|
||||||
await expectRestartRecoveryEnabled(page, true);
|
await expectRestartRecoveryEnabled(page, true);
|
||||||
await expectRestartRecoveryPrompt(page, "Resume working.");
|
await expectRestartRecoveryPrompt(page, "Resume working.");
|
||||||
await editRestartRecoveryPrompt(page, "Continue the interrupted work.");
|
await editRestartRecoveryPrompt(page, "Continue the interrupted work.");
|
||||||
@@ -273,3 +281,71 @@ test("restart recovery host controls persist the opt-out and custom prompt", asy
|
|||||||
await expectRestartRecoveryPrompt(page, "Continue the interrupted work.");
|
await expectRestartRecoveryPrompt(page, "Continue the interrupted work.");
|
||||||
await editRestartRecoveryPrompt(page, "Resume working.");
|
await editRestartRecoveryPrompt(page, "Resume working.");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("sidebar Add host preserves its caller and stays closed after theme changes", async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
await gotoAppShell(page);
|
||||||
|
await expect(page).toHaveURL(/\/open-project$/);
|
||||||
|
const originalUrl = page.url();
|
||||||
|
await openSidebarAddHost(page);
|
||||||
|
await expect(page).toHaveURL(originalUrl);
|
||||||
|
await closeAddHostAndChangeTheme(page);
|
||||||
|
await expect(page.getByRole("button", { name: "Direct connection", exact: true })).toBeHidden();
|
||||||
|
await expect(page).toHaveURL(originalUrl);
|
||||||
|
});
|
||||||
|
|
||||||
|
async function openSidebarAddHost(page: import("@playwright/test").Page) {
|
||||||
|
await page.getByRole("button", { name: "Hosts", exact: true }).click();
|
||||||
|
await page.getByRole("button", { name: "Add host", exact: true }).click();
|
||||||
|
await expect(page.getByRole("button", { name: "Direct connection", exact: true })).toBeVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function closeAddHostAndChangeTheme(page: import("@playwright/test").Page) {
|
||||||
|
await page.getByRole("button", { name: "Close", exact: true }).click();
|
||||||
|
await expect(page.getByRole("button", { name: "Direct connection", exact: true })).toBeHidden();
|
||||||
|
await page.keyboard.press("Control+Alt+t");
|
||||||
|
}
|
||||||
|
|
||||||
|
test("sidebar Add host completes without navigating", async ({ page }) => {
|
||||||
|
await gotoAppShell(page);
|
||||||
|
await expect(page).toHaveURL(/\/open-project$/);
|
||||||
|
const originalUrl = page.url();
|
||||||
|
await openSidebarAddHost(page);
|
||||||
|
await connectToTestHost(page);
|
||||||
|
await expect(page).toHaveURL(originalUrl);
|
||||||
|
await expect(page.getByRole("button", { name: "Hosts", exact: true })).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Settings Add host opens the saved host Overview", async ({ page }) => {
|
||||||
|
await gotoAppShell(page);
|
||||||
|
await openSettings(page);
|
||||||
|
await addDirectHostFromSettings(page, { host: "127.0.0.1", port: Number(getE2EDaemonPort()) });
|
||||||
|
await expectSettingsHeader(page, "Overview");
|
||||||
|
await expect(page).toHaveURL(new RegExp(`/settings/hosts/${getServerId()}/host$`));
|
||||||
|
});
|
||||||
|
|
||||||
|
test("New workspace Add host preserves the prompt after connecting", async ({ page }) => {
|
||||||
|
await gotoAppShell(page);
|
||||||
|
await openGlobalNewWorkspaceComposer(page);
|
||||||
|
await fillNewWorkspaceDraft(page, "Keep this unfinished prompt while I add a host.");
|
||||||
|
const originalUrl = page.url();
|
||||||
|
await openNewWorkspaceAddHost(page);
|
||||||
|
await expect(page).toHaveURL(originalUrl);
|
||||||
|
await connectToTestHost(page);
|
||||||
|
await expect(page).toHaveURL(originalUrl);
|
||||||
|
await expectNewWorkspaceDraft(page, "Keep this unfinished prompt while I add a host.");
|
||||||
|
});
|
||||||
|
|
||||||
|
async function openNewWorkspaceAddHost(page: import("@playwright/test").Page) {
|
||||||
|
await page.getByTestId("host-picker-trigger").click();
|
||||||
|
await page.getByRole("button", { name: "Add host", exact: true }).click();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function connectToTestHost(page: import("@playwright/test").Page) {
|
||||||
|
await page.getByRole("button", { name: "Direct connection", exact: true }).click();
|
||||||
|
await page.getByRole("textbox", { name: "Host", exact: true }).fill("127.0.0.1");
|
||||||
|
await page.getByRole("textbox", { name: "Port", exact: true }).fill(String(getE2EDaemonPort()));
|
||||||
|
await page.getByRole("button", { name: "Connect", exact: true }).click();
|
||||||
|
await expect(page.getByTestId("add-host-modal")).toBeHidden({ timeout: 30_000 });
|
||||||
|
}
|
||||||
|
|||||||
@@ -326,12 +326,12 @@ test.describe("Settings sidebar navigation", () => {
|
|||||||
|
|
||||||
await test.step("a dropdown owns Escape", async () => {
|
await test.step("a dropdown owns Escape", async () => {
|
||||||
await openSettingsSection(page, "appearance");
|
await openSettingsSection(page, "appearance");
|
||||||
await page.getByLabel(/Theme:/).click();
|
await page.getByLabel(/Highlight theme:/).click();
|
||||||
await expect(page.getByRole("menuitem", { name: "System", exact: true })).toBeVisible();
|
await expect(page.getByRole("menuitem", { name: "GitHub", exact: true })).toBeVisible();
|
||||||
|
|
||||||
await page.keyboard.press("Escape");
|
await page.keyboard.press("Escape");
|
||||||
|
|
||||||
await expect(page.getByRole("menuitem", { name: "System", exact: true })).toHaveCount(0);
|
await expect(page.getByRole("menuitem", { name: "GitHub", exact: true })).toHaveCount(0);
|
||||||
await expect(page).toHaveURL(/\/settings(\/|$)/);
|
await expect(page).toHaveURL(/\/settings(\/|$)/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
movePointerAwayFromWorkspaceHoverCard,
|
movePointerAwayFromWorkspaceHoverCard,
|
||||||
openMobileAgentSidebar,
|
openMobileAgentSidebar,
|
||||||
pinWorkspaceFromSidebar,
|
pinWorkspaceFromSidebar,
|
||||||
|
scrollWorkspaceList,
|
||||||
} from "../support/helpers/sidebar";
|
} from "../support/helpers/sidebar";
|
||||||
import { seedWorkspace } from "../support/helpers/seed-client";
|
import { seedWorkspace } from "../support/helpers/seed-client";
|
||||||
import { expectWorkspaceHeader } from "../support/helpers/workspace-ui";
|
import { expectWorkspaceHeader } from "../support/helpers/workspace-ui";
|
||||||
@@ -582,6 +583,12 @@ test.describe("Half-screen desktop layout", () => {
|
|||||||
await page.getByTestId("menu-button").click();
|
await page.getByTestId("menu-button").click();
|
||||||
await expect(page.getByTestId("sidebar-global-new-workspace")).toBeVisible();
|
await expect(page.getByTestId("sidebar-global-new-workspace")).toBeVisible();
|
||||||
await expect(sidebarScroll).toHaveJSProperty("scrollTop", scrollTop);
|
await expect(sidebarScroll).toHaveJSProperty("scrollTop", scrollTop);
|
||||||
|
|
||||||
|
await movePointerAwayFromWorkspaceHoverCard(page);
|
||||||
|
await focusWorkspaceRowWithKeyboard(page, lastWorkspaceId);
|
||||||
|
await expectWorkspaceHoverCardOpen(page);
|
||||||
|
await scrollWorkspaceList(page);
|
||||||
|
await expectWorkspaceHoverCardClosed(page);
|
||||||
} finally {
|
} finally {
|
||||||
await workspace.cleanup();
|
await workspace.cleanup();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,12 +38,9 @@ async function expectDarkIcons(expected, context) {
|
|||||||
assert.equal(windowState(), expected, context);
|
assert.equal(windowState(), expected, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Settings > Appearance shows every theme as a tile in one radio group.
|
||||||
function selectTheme(theme) {
|
function selectTheme(theme) {
|
||||||
const current = ad("snapshot", "-i").match(/"Theme: ([^"]+)"/)?.[1];
|
|
||||||
assert(current, "Start on Settings > Appearance");
|
|
||||||
ad("press", `label="Theme: ${current}"`, "--settle");
|
|
||||||
ad("press", `label="${theme}"`, "--settle");
|
ad("press", `label="${theme}"`, "--settle");
|
||||||
ad("wait", "text", `Theme: ${theme}`, "5000");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ad("settings", "appearance", "light");
|
ad("settings", "appearance", "light");
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
// Open an existing compact chat, with the keyboard closed, then interrupt its host connection.
|
||||||
|
// Hold that interruption externally (for example, stop a disposable SSH TCP forward).
|
||||||
|
// Leave the daemon running. This test observes the public reconnecting state.
|
||||||
|
// node placement.mjs <session> <platform> <coordinate-scale> <composer-label> <artifacts>
|
||||||
|
// coordinate-scale is screenshot pixels per layout point (Android density; iOS snapshots use 1).
|
||||||
|
import assert from "node:assert/strict";
|
||||||
|
import { execFileSync } from "node:child_process";
|
||||||
|
import { mkdirSync, writeFileSync } from "node:fs";
|
||||||
|
import path from "node:path";
|
||||||
|
|
||||||
|
const [, , session, platform, coordinateScale, composerLabel, artifacts] = process.argv;
|
||||||
|
assert(
|
||||||
|
session && ["android", "ios"].includes(platform) && composerLabel && artifacts,
|
||||||
|
"Pass all five arguments",
|
||||||
|
);
|
||||||
|
const scale = Number(coordinateScale);
|
||||||
|
assert(scale > 0, "Pass a positive coordinate scale");
|
||||||
|
mkdirSync(artifacts, { recursive: true });
|
||||||
|
function ad(...args) {
|
||||||
|
return execFileSync("agent-device", ["--session", session, "--platform", platform, ...args], {
|
||||||
|
encoding: "utf8",
|
||||||
|
timeout: 90_000,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function capture(name) {
|
||||||
|
const snapshot = ad("snapshot", "--raw", "--json");
|
||||||
|
writeFileSync(path.join(artifacts, `${name}.json`), snapshot);
|
||||||
|
ad("screenshot", path.join(artifacts, `${name}.png`));
|
||||||
|
const nodes = JSON.parse(snapshot).data.nodes;
|
||||||
|
const header = nodes.find((node) => node.identifier === "floating-header");
|
||||||
|
const toast = nodes.find((node) => node.identifier === "agent-reconnecting-toast");
|
||||||
|
assert(header?.rect && toast?.rect, "Measured header and reconnecting toast must be present");
|
||||||
|
assert(toast.rect.height > 0 && toast.rect.width > 0, "Toast must have visible bounds");
|
||||||
|
const gap = (toast.rect.y - header.rect.y - header.rect.height) / scale;
|
||||||
|
assert(Math.abs(gap - 12) <= 1, `${name}: actual header-to-toast gap ${gap}, expected12 points`);
|
||||||
|
return toast.rect.y / scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
ad("wait", 'id="agent-reconnecting-toast"', "20000");
|
||||||
|
const closedTop = capture("keyboard-closed");
|
||||||
|
ad("press", `label=${JSON.stringify(composerLabel)}`);
|
||||||
|
const opened = ad("snapshot", "--raw", "--json");
|
||||||
|
const nodes = JSON.parse(opened).data.nodes;
|
||||||
|
assert(
|
||||||
|
nodes.some(
|
||||||
|
(node) => /keyboard/i.test(node.type ?? "") || /inputmethod/i.test(node.bundleId ?? ""),
|
||||||
|
),
|
||||||
|
"Use a real visible software keyboard; open Android sessions with --no-test-ime",
|
||||||
|
);
|
||||||
|
const openTop = capture("keyboard-open");
|
||||||
|
assert(Math.abs(openTop - closedTop) <= 1, "Keyboard must not translate the toast");
|
||||||
|
console.log(
|
||||||
|
"PASS: rendered reconnecting toast stays12 points below measured header, keyboard closed/open",
|
||||||
|
);
|
||||||
@@ -107,6 +107,8 @@ const daemonTest = metroTest.extend<
|
|||||||
});
|
});
|
||||||
|
|
||||||
const test = daemonTest.extend<{
|
const test = daemonTest.extend<{
|
||||||
|
/** Specs start past first-run setup; onboarding specs opt out to see a fresh install. */
|
||||||
|
e2eOnboardingCompleted: boolean;
|
||||||
paseoE2ESetup: void;
|
paseoE2ESetup: void;
|
||||||
outdatedDaemon: OutdatedDaemon;
|
outdatedDaemon: OutdatedDaemon;
|
||||||
desktopManagedOutdatedDaemon: OutdatedDaemon;
|
desktopManagedOutdatedDaemon: OutdatedDaemon;
|
||||||
@@ -114,8 +116,9 @@ const test = daemonTest.extend<{
|
|||||||
projectPickerFixture: TrackedProjectPickerFixture;
|
projectPickerFixture: TrackedProjectPickerFixture;
|
||||||
withWorkspace: WithWorkspace;
|
withWorkspace: WithWorkspace;
|
||||||
}>({
|
}>({
|
||||||
|
e2eOnboardingCompleted: [true, { option: true }],
|
||||||
paseoE2ESetup: [
|
paseoE2ESetup: [
|
||||||
async ({ page }, provide, testInfo) => {
|
async ({ page, e2eOnboardingCompleted }, provide, testInfo) => {
|
||||||
const daemonPort = getE2EDaemonPort();
|
const daemonPort = getE2EDaemonPort();
|
||||||
const metroPort = process.env.E2E_METRO_PORT;
|
const metroPort = process.env.E2E_METRO_PORT;
|
||||||
if (!metroPort) {
|
if (!metroPort) {
|
||||||
@@ -157,7 +160,7 @@ const test = daemonTest.extend<{
|
|||||||
const createAgentPreferences = buildCreateAgentPreferences();
|
const createAgentPreferences = buildCreateAgentPreferences();
|
||||||
|
|
||||||
await page.addInitScript(
|
await page.addInitScript(
|
||||||
({ daemon, preferences, seedNonce: nonce, extraHostsKey }) => {
|
({ daemon, preferences, seedNonce: nonce, extraHostsKey, onboardingCompleted }) => {
|
||||||
// `addInitScript` runs on every navigation (including reloads). Some tests intentionally
|
// `addInitScript` runs on every navigation (including reloads). Some tests intentionally
|
||||||
// override storage and reload; they can opt out of seeding for the *next* navigation by
|
// override storage and reload; they can opt out of seeding for the *next* navigation by
|
||||||
// setting this flag before the reload.
|
// setting this flag before the reload.
|
||||||
@@ -185,12 +188,20 @@ const test = daemonTest.extend<{
|
|||||||
if (!localStorage.getItem("@paseo:app-settings")) {
|
if (!localStorage.getItem("@paseo:app-settings")) {
|
||||||
localStorage.setItem("@paseo:app-settings", JSON.stringify({ chatDisplay: "full" }));
|
localStorage.setItem("@paseo:app-settings", JSON.stringify({ chatDisplay: "full" }));
|
||||||
}
|
}
|
||||||
|
// The shared daemon often has no projects, which would open first-run setup over the app.
|
||||||
|
if (onboardingCompleted && !localStorage.getItem("@paseo:onboarding")) {
|
||||||
|
localStorage.setItem(
|
||||||
|
"@paseo:onboarding",
|
||||||
|
JSON.stringify({ completedAt: new Date(0).toISOString() }),
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
daemon: testDaemon,
|
daemon: testDaemon,
|
||||||
preferences: createAgentPreferences,
|
preferences: createAgentPreferences,
|
||||||
seedNonce,
|
seedNonce,
|
||||||
extraHostsKey: EXTRA_HOSTS_KEY,
|
extraHostsKey: EXTRA_HOSTS_KEY,
|
||||||
|
onboardingCompleted: e2eOnboardingCompleted,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -113,3 +113,29 @@ export async function expectAddProjectResultVisible(page: Page, text: string): P
|
|||||||
})
|
})
|
||||||
.toBe(true);
|
.toBe(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function chooseAddHostFromProjectFlow(page: Page): Promise<void> {
|
||||||
|
await page.getByRole("button", { name: /Add host.*No connected hosts/ }).click();
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function navigateAndDismissAddProject(page: Page): Promise<void> {
|
||||||
|
// Keep both keys in one task so Escape closes with a selection update still queued.
|
||||||
|
await page.evaluate(() => {
|
||||||
|
for (const key of ["ArrowDown", "Escape"]) {
|
||||||
|
window.dispatchEvent(
|
||||||
|
new KeyboardEvent("keydown", { key, code: key, bubbles: true, cancelable: true }),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function watchAddProjectRenderWarnings(page: Page): string[] {
|
||||||
|
const warnings: string[] = [];
|
||||||
|
page.on("console", (message) => {
|
||||||
|
const text = message.text();
|
||||||
|
if (text.includes("Cannot update a component") && text.includes("AddProjectFlow")) {
|
||||||
|
warnings.push(text);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return warnings;
|
||||||
|
}
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ export async function chooseCustomSkills(page: Page, selected: string[]): Promis
|
|||||||
await all.click();
|
await all.click();
|
||||||
const keep = new Set(selected);
|
const keep = new Set(selected);
|
||||||
for (const name of await listSkillChoices(page)) {
|
for (const name of await listSkillChoices(page)) {
|
||||||
if (!keep.has(name)) await page.getByRole("checkbox", { name, exact: true }).click();
|
if (!keep.has(name)) await skillSwitch(page, name).click();
|
||||||
}
|
}
|
||||||
await expectSkillChoices(page, selected);
|
await expectSkillChoices(page, selected);
|
||||||
}
|
}
|
||||||
@@ -176,7 +176,7 @@ export async function cancelSkillSelection(page: Page): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function toggleSkill(page: Page, name: string): Promise<void> {
|
export async function toggleSkill(page: Page, name: string): Promise<void> {
|
||||||
await page.getByRole("checkbox", { name, exact: true }).click();
|
await skillSwitch(page, name).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function answerNextRemovalWarning(
|
export function answerNextRemovalWarning(
|
||||||
@@ -222,15 +222,21 @@ export async function expectSkillFile(
|
|||||||
export async function expectSkillChoices(page: Page, selected: string[]): Promise<void> {
|
export async function expectSkillChoices(page: Page, selected: string[]): Promise<void> {
|
||||||
const expected = new Set(selected);
|
const expected = new Set(selected);
|
||||||
for (const name of await listSkillChoices(page)) {
|
for (const name of await listSkillChoices(page)) {
|
||||||
await expect(page.getByRole("checkbox", { name, exact: true })).toBeChecked({
|
await expect(skillSwitch(page, name)).toBeChecked({
|
||||||
checked: expected.has(name),
|
checked: expected.has(name),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** One bundled skill's switch in the picker; "All skills" sits outside the list. */
|
||||||
|
function skillSwitch(page: Page, name: string) {
|
||||||
|
return page.getByTestId("skill-selection-list-card").getByRole("switch", { name, exact: true });
|
||||||
|
}
|
||||||
|
|
||||||
async function listSkillChoices(page: Page): Promise<string[]> {
|
async function listSkillChoices(page: Page): Promise<string[]> {
|
||||||
return page
|
return page
|
||||||
.getByRole("checkbox")
|
.getByTestId("skill-selection-list-card")
|
||||||
|
.getByRole("switch")
|
||||||
.evaluateAll((elements) =>
|
.evaluateAll((elements) =>
|
||||||
elements
|
elements
|
||||||
.map((element) => element.getAttribute("aria-label") ?? "")
|
.map((element) => element.getAttribute("aria-label") ?? "")
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import { expect, type Page } from "@playwright/test";
|
||||||
|
import { PARENT_AGENT_ID_LABEL } from "@getpaseo/protocol/agent-labels";
|
||||||
|
import type { SeededWorkspace } from "./seed-client";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts a background agent the way a plugin helper does: in the workspace, under a parent,
|
||||||
|
* streaming for about ten seconds. Resolves once the daemon reports it running.
|
||||||
|
*/
|
||||||
|
export async function startBackgroundAgent(
|
||||||
|
workspace: Pick<SeededWorkspace, "client" | "repoPath" | "workspaceId">,
|
||||||
|
input: { parentId: string; title: string },
|
||||||
|
): Promise<{ id: string }> {
|
||||||
|
const agent = await workspace.client.createAgent({
|
||||||
|
provider: "mock",
|
||||||
|
cwd: workspace.repoPath,
|
||||||
|
workspaceId: workspace.workspaceId,
|
||||||
|
title: input.title,
|
||||||
|
modeId: "load-test",
|
||||||
|
model: "ten-second-stream",
|
||||||
|
initialPrompt: "classify the last turn",
|
||||||
|
labels: { [PARENT_AGENT_ID_LABEL]: input.parentId },
|
||||||
|
background: true,
|
||||||
|
});
|
||||||
|
await workspace.client.waitForAgentUpsert(agent.id, (snapshot) => snapshot.status === "running");
|
||||||
|
return { id: agent.id };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Waits for the agent's turn to end and archives it, as the plugin does with a helper's reply. */
|
||||||
|
export async function finishAndArchiveAgent(
|
||||||
|
workspace: Pick<SeededWorkspace, "client">,
|
||||||
|
agentId: string,
|
||||||
|
): Promise<void> {
|
||||||
|
const finished = await workspace.client.waitForFinish(agentId, 60_000);
|
||||||
|
expect(finished.status).toBe("idle");
|
||||||
|
await workspace.client.archiveAgent(agentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function expectWorkspaceShownIdle(page: Page, workspaceName: string): Promise<void> {
|
||||||
|
const row = page.getByRole("button", {
|
||||||
|
name: new RegExp(`^${escapeRegExp(workspaceName)}(?:,|$)`),
|
||||||
|
});
|
||||||
|
await expect(row).toBeVisible({ timeout: 30_000 });
|
||||||
|
await expect(row.getByTestId("workspace-status-indicator-running")).toHaveCount(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function escapeRegExp(value: string): string {
|
||||||
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||||
|
}
|
||||||
@@ -54,12 +54,15 @@ export async function leaveContextWindowMeter(page: Page): Promise<void> {
|
|||||||
await expect(contextWindowDetails(page)).toHaveCount(0);
|
await expect(contextWindowDetails(page)).toHaveCount(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Compact screens open the meter's details in a sheet. */
|
/** Clicking the meter opens its details in the active layout. */
|
||||||
export async function pressContextWindowMeter(page: Page, name = METER_NAME): Promise<Locator> {
|
export async function pressContextWindowMeter(
|
||||||
|
page: Page,
|
||||||
|
name: string | RegExp = METER_NAME,
|
||||||
|
): Promise<Locator> {
|
||||||
await page.getByRole("button", { name, exact: true }).click({ timeout: 30_000 });
|
await page.getByRole("button", { name, exact: true }).click({ timeout: 30_000 });
|
||||||
const sheet = contextWindowDetails(page);
|
const details = contextWindowDetails(page);
|
||||||
await expect(sheet).toBeVisible();
|
await expect(details).toBeVisible();
|
||||||
return sheet;
|
return details;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function closeContextWindowSheet(page: Page): Promise<void> {
|
export async function closeContextWindowSheet(page: Page): Promise<void> {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { Page, WebSocketRoute } from "@playwright/test";
|
import type { Page, WebSocketRoute } from "@playwright/test";
|
||||||
import { daemonWsRoutePattern } from "./daemon-port";
|
import { daemonWsRoutePattern, wsRoutePatternForPort } from "./daemon-port";
|
||||||
|
|
||||||
export interface DirectoryBootstrapCounts {
|
export interface DirectoryBootstrapCounts {
|
||||||
agents: number;
|
agents: number;
|
||||||
@@ -294,7 +294,8 @@ function recordClientRequest(
|
|||||||
directoryStarts.total[directory] += 1;
|
directoryStarts.total[directory] += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function installDaemonWebSocketGate(page: Page) {
|
/** Gates the shared E2E daemon, or the daemon on `port` for a spec that runs its own. */
|
||||||
|
export async function installDaemonWebSocketGate(page: Page, options: { port?: number } = {}) {
|
||||||
let acceptingConnections = true;
|
let acceptingConnections = true;
|
||||||
let reconnectWithFreshClient = false;
|
let reconnectWithFreshClient = false;
|
||||||
let suppressAgentStream = false;
|
let suppressAgentStream = false;
|
||||||
@@ -445,7 +446,11 @@ export async function installDaemonWebSocketGate(page: Page) {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
await page.routeWebSocket(daemonWsRoutePattern(), (ws) => {
|
const routePattern =
|
||||||
|
options.port === undefined
|
||||||
|
? daemonWsRoutePattern()
|
||||||
|
: wsRoutePatternForPort(String(options.port));
|
||||||
|
await page.routeWebSocket(routePattern, (ws) => {
|
||||||
if (!acceptingConnections) {
|
if (!acceptingConnections) {
|
||||||
blockedConnectionCount += 1;
|
blockedConnectionCount += 1;
|
||||||
for (const resolve of blockedConnectionWaiters) resolve();
|
for (const resolve of blockedConnectionWaiters) resolve();
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import type { Page, WebSocketRoute } from "@playwright/test";
|
||||||
|
import { daemonWsRoutePattern } from "./daemon-port";
|
||||||
|
|
||||||
|
function listingResponse(message: string | Buffer) {
|
||||||
|
try {
|
||||||
|
const envelope = JSON.parse(message.toString());
|
||||||
|
return envelope.message?.type === "file_explorer_response" ? envelope.message.payload : null;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Delay one real directory response after the daemon has read its contents. */
|
||||||
|
export async function delayDirectoryListingResponse(page: Page, directoryPath: string) {
|
||||||
|
let held: { socket: WebSocketRoute; message: string | Buffer; requestId: string } | null = null;
|
||||||
|
let resolveHeld!: () => void;
|
||||||
|
const heldResponse = new Promise<void>((resolve) => {
|
||||||
|
resolveHeld = resolve;
|
||||||
|
});
|
||||||
|
await page.routeWebSocket(daemonWsRoutePattern(), (socket) => {
|
||||||
|
const server = socket.connectToServer();
|
||||||
|
socket.onMessage((message) => server.send(message));
|
||||||
|
server.onMessage((message) => {
|
||||||
|
const response = listingResponse(message);
|
||||||
|
if (!held && response?.mode === "list" && response.path === directoryPath) {
|
||||||
|
held = { socket, message, requestId: response.requestId };
|
||||||
|
resolveHeld();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
socket.send(message);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
waitUntilHeld: () => heldResponse,
|
||||||
|
release: async () => {
|
||||||
|
if (!held) throw new Error("Directory response must be held before release");
|
||||||
|
held.socket.send(held.message);
|
||||||
|
// Let the delivered reply update the UI before the user reopens the folder.
|
||||||
|
await page.evaluate(
|
||||||
|
() => new Promise<void>((resolve) => requestAnimationFrame(() => resolve())),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -273,3 +273,25 @@ export async function reloadPreservingHostRegistry(page: Page): Promise<void> {
|
|||||||
);
|
);
|
||||||
await page.reload();
|
await page.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function disconnectAllHostsAndReload(page: Page): Promise<void> {
|
||||||
|
await page.evaluate(
|
||||||
|
({ registryKey, nonceKey, disableSeedKey }) => {
|
||||||
|
const nonce = localStorage.getItem(nonceKey);
|
||||||
|
if (!nonce) throw new Error("Expected the e2e seed nonce");
|
||||||
|
const hosts = JSON.parse(localStorage.getItem(registryKey) ?? "[]");
|
||||||
|
for (const host of hosts) {
|
||||||
|
host.connections = [{ id: "offline", type: "directTcp", endpoint: "127.0.0.1:59999" }];
|
||||||
|
host.preferredConnectionId = "offline";
|
||||||
|
}
|
||||||
|
localStorage.setItem(registryKey, JSON.stringify(hosts));
|
||||||
|
localStorage.setItem(disableSeedKey, nonce);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
registryKey: REGISTRY_KEY,
|
||||||
|
nonceKey: SEED_NONCE_KEY,
|
||||||
|
disableSeedKey: DISABLE_DEFAULT_SEED_ONCE_KEY,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
await page.reload();
|
||||||
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ export interface IsolatedHostDaemon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IsolatedHostDaemonOptions {
|
export interface IsolatedHostDaemonOptions {
|
||||||
|
/** Written to the daemon's config.json; `mutableRelay` adds `daemon.relay` to it. */
|
||||||
|
config?: { daemon?: Record<string, unknown>; [key: string]: unknown };
|
||||||
environment?: NodeJS.ProcessEnv;
|
environment?: NodeJS.ProcessEnv;
|
||||||
mutableRelay?: {
|
mutableRelay?: {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
@@ -93,6 +95,28 @@ async function waitForServer(port: number, child: ChildProcess): Promise<void> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function withMutableRelay(
|
||||||
|
config: NonNullable<IsolatedHostDaemonOptions["config"]>,
|
||||||
|
relay: NonNullable<IsolatedHostDaemonOptions["mutableRelay"]>,
|
||||||
|
): NonNullable<IsolatedHostDaemonOptions["config"]> {
|
||||||
|
const endpoint =
|
||||||
|
relay.endpoint ??
|
||||||
|
(process.env.E2E_RELAY_PORT ? `127.0.0.1:${process.env.E2E_RELAY_PORT}` : "127.0.0.1:9");
|
||||||
|
return {
|
||||||
|
...config,
|
||||||
|
daemon: {
|
||||||
|
...config.daemon,
|
||||||
|
relay: {
|
||||||
|
enabled: relay.enabled,
|
||||||
|
endpoint,
|
||||||
|
publicEndpoint: endpoint,
|
||||||
|
useTls: false,
|
||||||
|
publicUseTls: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export async function startIsolatedHostDaemon(
|
export async function startIsolatedHostDaemon(
|
||||||
serverId: string,
|
serverId: string,
|
||||||
options: IsolatedHostDaemonOptions = {},
|
options: IsolatedHostDaemonOptions = {},
|
||||||
@@ -138,24 +162,13 @@ export async function startIsolatedHostDaemon(
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (options.mutableRelay) {
|
const config = options.mutableRelay
|
||||||
const endpoint =
|
? withMutableRelay(options.config ?? {}, options.mutableRelay)
|
||||||
options.mutableRelay.endpoint ??
|
: options.config;
|
||||||
(process.env.E2E_RELAY_PORT ? `127.0.0.1:${process.env.E2E_RELAY_PORT}` : "127.0.0.1:9");
|
if (config) {
|
||||||
await writeFile(
|
await writeFile(
|
||||||
path.join(paseoHome, "config.json"),
|
path.join(paseoHome, "config.json"),
|
||||||
`${JSON.stringify({
|
`${JSON.stringify({ version: 1, ...config })}\n`,
|
||||||
version: 1,
|
|
||||||
daemon: {
|
|
||||||
relay: {
|
|
||||||
enabled: options.mutableRelay.enabled,
|
|
||||||
endpoint,
|
|
||||||
publicEndpoint: endpoint,
|
|
||||||
useTls: false,
|
|
||||||
publicUseTls: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})}\n`,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const serverDir = publishedPackageRoot
|
const serverDir = publishedPackageRoot
|
||||||
|
|||||||
@@ -0,0 +1,230 @@
|
|||||||
|
import { randomUUID } from "node:crypto";
|
||||||
|
import { mkdir, mkdtemp, rm, utimes, writeFile } from "node:fs/promises";
|
||||||
|
import { tmpdir } from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import { expect, type Locator, type Page } from "@playwright/test";
|
||||||
|
import type { DaemonClient as InternalDaemonClient } from "@getpaseo/client/internal/daemon-client";
|
||||||
|
import { addProjectFlow, addProjectFlowInput, chooseAddProjectMethod } from "./add-project-flow";
|
||||||
|
import { connectDaemonClient } from "./daemon-client-loader";
|
||||||
|
import { buildCreateAgentPreferences, buildSeededHost } from "./daemon-registry";
|
||||||
|
import { startIsolatedHostDaemon, type IsolatedHostDaemonOptions } from "./isolated-host-daemon";
|
||||||
|
|
||||||
|
/** Points a fresh browser profile at one host, with no first-run record and no app settings. */
|
||||||
|
export async function openAppAsNewUser(
|
||||||
|
page: Page,
|
||||||
|
host: { serverId: string; port: number },
|
||||||
|
): Promise<void> {
|
||||||
|
const seededHost = buildSeededHost({
|
||||||
|
serverId: host.serverId,
|
||||||
|
endpoint: `127.0.0.1:${host.port}`,
|
||||||
|
nowIso: new Date().toISOString(),
|
||||||
|
});
|
||||||
|
await page.route(/:6767\b/, (route) => route.abort());
|
||||||
|
await page.routeWebSocket(/:6767\b/, async (webSocket) => {
|
||||||
|
await webSocket.close({ code: 1008, reason: "Blocked developer daemon during e2e." });
|
||||||
|
});
|
||||||
|
await page.addInitScript(
|
||||||
|
({ registryHost, preferences }) => {
|
||||||
|
localStorage.setItem("@paseo:e2e", "1");
|
||||||
|
localStorage.setItem("@paseo:daemon-registry", JSON.stringify([registryHost]));
|
||||||
|
localStorage.setItem("@paseo:create-agent-preferences", JSON.stringify(preferences));
|
||||||
|
},
|
||||||
|
{ registryHost: seededHost, preferences: buildCreateAgentPreferences() },
|
||||||
|
);
|
||||||
|
await page.goto("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setupModal(page: Page): Locator {
|
||||||
|
return page.getByTestId("onboarding-modal").getByRole("dialog");
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function expectSetupStep(page: Page, title: string): Promise<void> {
|
||||||
|
await expect(setupModal(page).getByRole("heading", { name: title, exact: true })).toBeVisible({
|
||||||
|
timeout: 60_000,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function pickTheme(page: Page, name: string): Promise<void> {
|
||||||
|
const tile = setupModal(page).getByRole("radio", { name, exact: true });
|
||||||
|
await tile.click();
|
||||||
|
await expect(tile).toBeChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function continueSetup(page: Page): Promise<void> {
|
||||||
|
await setupModal(page).getByRole("button", { name: "Continue", exact: true }).click();
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function skipSetup(page: Page): Promise<void> {
|
||||||
|
await setupModal(page).getByRole("button", { name: "Skip setup", exact: true }).click();
|
||||||
|
await expect(setupModal(page)).toHaveCount(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Adds a folder through the regular Add project flow, opened from the setup's Projects step. */
|
||||||
|
export async function addProjectFromSetup(page: Page, projectPath: string): Promise<void> {
|
||||||
|
await setupModal(page).getByRole("button", { name: "Add project", exact: true }).click();
|
||||||
|
await expect(addProjectFlow(page)).toBeVisible({ timeout: 30_000 });
|
||||||
|
await chooseAddProjectMethod(page, "directory-search");
|
||||||
|
await addProjectFlowInput(page).fill(projectPath);
|
||||||
|
await page.keyboard.press("Enter");
|
||||||
|
await expect(addProjectFlow(page)).toHaveCount(0, { timeout: 30_000 });
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function showSetupAgainFromSettings(page: Page): Promise<void> {
|
||||||
|
await page.locator('[data-testid="sidebar-settings"]:visible').first().click();
|
||||||
|
await page.getByRole("button", { name: "Show setup again", exact: true }).click();
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function goToSetupStep(page: Page, label: string): Promise<void> {
|
||||||
|
await setupModal(page).getByRole("tab", { name: label, exact: true }).click();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function paseoToolsSwitch(scope: Page | Locator): Locator {
|
||||||
|
return scope.getByRole("switch", { name: "Inject Paseo tools", exact: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Whether the host gives its agents Paseo tools, read from the host itself. */
|
||||||
|
export async function hostGivesAgentsPaseoTools(host: { port: number }): Promise<boolean> {
|
||||||
|
const client = await connectDaemonClient<
|
||||||
|
Pick<InternalDaemonClient, "connect" | "close" | "getDaemonConfig">
|
||||||
|
>({ clientIdPrefix: "app-e2e-onboarding", port: host.port });
|
||||||
|
try {
|
||||||
|
return (await client.getDaemonConfig()).config.mcp.injectIntoAgents !== false;
|
||||||
|
} finally {
|
||||||
|
await client.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function finishSetup(page: Page): Promise<void> {
|
||||||
|
await setupModal(page).getByRole("button", { name: "Finish", exact: true }).click();
|
||||||
|
await expect(setupModal(page)).toHaveCount(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Opens the Phone step's Relay row: the pair device modal, over setup. */
|
||||||
|
export async function openRelayPairingFromSetup(page: Page): Promise<Locator> {
|
||||||
|
await setupModal(page).getByRole("button", { name: "Relay", exact: true }).click();
|
||||||
|
const pairing = page.getByTestId("onboarding-pair-device-card");
|
||||||
|
await expect(pairing).toBeVisible();
|
||||||
|
return pairing;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function closeRelayPairing(pairing: Locator): Promise<void> {
|
||||||
|
await pairing.getByRole("button", { name: "Close", exact: true }).click();
|
||||||
|
await expect(pairing).toHaveCount(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Clicks the Phone step's Tailscale row and returns the docs page it opened. */
|
||||||
|
export async function openTailscaleDocsFromSetup(page: Page): Promise<string> {
|
||||||
|
await page
|
||||||
|
.context()
|
||||||
|
.route("https://paseo.sh/**", (route) =>
|
||||||
|
route.fulfill({ contentType: "text/html", body: "<title>Paseo docs</title>" }),
|
||||||
|
);
|
||||||
|
const popup = page.waitForEvent("popup");
|
||||||
|
await setupModal(page).getByRole("link", { name: "Tailscale, Docs", exact: true }).click();
|
||||||
|
const docs = await popup;
|
||||||
|
await docs.waitForLoadState("domcontentloaded");
|
||||||
|
const url = docs.url();
|
||||||
|
await docs.close();
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SetupHost {
|
||||||
|
serverId: string;
|
||||||
|
port: number;
|
||||||
|
close(): Promise<void>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An isolated host whose only agent history is the Claude sessions given here, so suggestions
|
||||||
|
* never depend on the machine running the test. Its HOME is a scratch folder, so the skills setup
|
||||||
|
* installs never land in the real ~/.agents, ~/.claude or ~/.codex. `withBrokenProvider` adds a
|
||||||
|
* provider that cannot start.
|
||||||
|
*/
|
||||||
|
export async function startSetupHost(
|
||||||
|
label: string,
|
||||||
|
options: {
|
||||||
|
claudeSessionsIn?: readonly string[];
|
||||||
|
withBrokenProvider?: boolean;
|
||||||
|
mutableRelay?: IsolatedHostDaemonOptions["mutableRelay"];
|
||||||
|
} = {},
|
||||||
|
): Promise<SetupHost> {
|
||||||
|
const serverId = `srv_onboarding_${label}_${randomUUID().replaceAll("-", "").slice(0, 8)}`;
|
||||||
|
const claudeConfigDir = await seedClaudeHistory(options.claudeSessionsIn ?? []);
|
||||||
|
const home = await mkdtemp(path.join(tmpdir(), "paseo-onboarding-home-"));
|
||||||
|
const daemon = await startIsolatedHostDaemon(serverId, {
|
||||||
|
config: claudeOnlyConfig({ withBrokenProvider: options.withBrokenProvider ?? false }),
|
||||||
|
environment: { ...process.env, HOME: home, CLAUDE_CONFIG_DIR: claudeConfigDir },
|
||||||
|
mutableRelay: options.mutableRelay,
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
serverId,
|
||||||
|
port: daemon.port,
|
||||||
|
close: async () => {
|
||||||
|
await daemon.close();
|
||||||
|
await rm(claudeConfigDir, { recursive: true, force: true });
|
||||||
|
await rm(home, { recursive: true, force: true });
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Writes one recent Claude session per folder into a fresh CLAUDE_CONFIG_DIR. */
|
||||||
|
async function seedClaudeHistory(cwds: readonly string[]): Promise<string> {
|
||||||
|
const configDir = await mkdtemp(path.join(tmpdir(), "paseo-onboarding-claude-"));
|
||||||
|
const newest = Date.now() - 60_000;
|
||||||
|
for (const [index, cwd] of cwds.entries()) {
|
||||||
|
const sessionId = `onboarding-session-${index + 1}`;
|
||||||
|
const projectDir = path.join(configDir, "projects", cwd.replace(/[^a-zA-Z0-9]/g, "-"));
|
||||||
|
await mkdir(projectDir, { recursive: true });
|
||||||
|
const sessionPath = path.join(projectDir, `${sessionId}.jsonl`);
|
||||||
|
const record = {
|
||||||
|
type: "user",
|
||||||
|
uuid: `${sessionId}-user`,
|
||||||
|
message: { role: "user", content: `Work on session ${index + 1}` },
|
||||||
|
cwd,
|
||||||
|
sessionId,
|
||||||
|
};
|
||||||
|
await writeFile(sessionPath, `${JSON.stringify(record)}\n`);
|
||||||
|
const timestamp = new Date(newest - index * 60_000);
|
||||||
|
await utimes(sessionPath, timestamp, timestamp);
|
||||||
|
}
|
||||||
|
return configDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
function claudeOnlyConfig(options: { withBrokenProvider: boolean }) {
|
||||||
|
const brokenProvider = {
|
||||||
|
"broken-acp": {
|
||||||
|
extends: "acp",
|
||||||
|
label: "Broken ACP",
|
||||||
|
command: ["missing-agent-command", "acp"],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
agents: {
|
||||||
|
providers: {
|
||||||
|
codex: { enabled: false },
|
||||||
|
copilot: { enabled: false },
|
||||||
|
omp: { enabled: false },
|
||||||
|
opencode: { enabled: false },
|
||||||
|
pi: { enabled: false },
|
||||||
|
...(options.withBrokenProvider ? brokenProvider : {}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The switch that picks a suggested project for adding. */
|
||||||
|
export function projectSuggestion(page: Page, name: string): Locator {
|
||||||
|
return setupModal(page).getByRole("switch", { name, exact: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The whole suggestion row, with its path, last use and any add error beside the switch. */
|
||||||
|
export function projectSuggestionRow(page: Page, name: string): Locator {
|
||||||
|
return setupModal(page)
|
||||||
|
.getByTestId("project-suggestion")
|
||||||
|
.filter({ has: page.getByRole("switch", { name, exact: true }) });
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The footer's main button, which adds the checked suggestions when there are any. */
|
||||||
|
export function setupPrimaryButton(page: Page, label: string): Locator {
|
||||||
|
return setupModal(page).getByRole("button", { name: label, exact: true });
|
||||||
|
}
|
||||||
@@ -4,6 +4,9 @@ import path from "node:path";
|
|||||||
import type { Locator, TestInfo } from "@playwright/test";
|
import type { Locator, TestInfo } from "@playwright/test";
|
||||||
import { test, expect, type Page } from "@playwright/test";
|
import { test, expect, type Page } from "@playwright/test";
|
||||||
import { gotoAppShell } from "./app";
|
import { gotoAppShell } from "./app";
|
||||||
|
import { scrollAgentChatToBottom, waitForScrollableChat } from "./agent-bottom-anchor";
|
||||||
|
import { expectTurnCopyButton } from "./agent-stream";
|
||||||
|
import { submitMessage } from "./composer";
|
||||||
import { buildAgentRoute } from "./mock-agent";
|
import { buildAgentRoute } from "./mock-agent";
|
||||||
import { openCommandCenter } from "./command-center";
|
import { openCommandCenter } from "./command-center";
|
||||||
import {
|
import {
|
||||||
@@ -88,7 +91,7 @@ export default function contribute(client) {
|
|||||||
header("locked", { title: "Production locked", icon: "Lock", disabled: true, behavior: { kind: "action", onPress() {} } });
|
header("locked", { title: "Production locked", icon: "Lock", disabled: true, behavior: { kind: "action", onPress() {} } });
|
||||||
const review = pill("review", { title: "Run review", icon: "Scan", label: "Review", behavior: { kind: "action", async onPress() { await new Promise((resolve) => { finishReview = resolve; }); review.update({ label: "Reviewed" }); } } });
|
const review = pill("review", { title: "Run review", icon: "Scan", label: "Review", behavior: { kind: "action", async onPress() { await new Promise((resolve) => { finishReview = resolve; }); review.update({ label: "Reviewed" }); } } });
|
||||||
const pillMenu = pill("checks", { title: "Composer checks", icon: "ListChecks", label: "Checks", behavior: menu });
|
const pillMenu = pill("checks", { title: "Composer checks", icon: "ListChecks", label: "Checks", behavior: menu });
|
||||||
pill("usage", { title: "Composer status", icon: StatusIcon, label: "Status", behavior: { kind: "popover", Content: Details } });
|
const usage = pill("usage", { title: "Composer status", icon: StatusIcon, label: "Status", behavior: { kind: "popover", Content: Details } });
|
||||||
const command = (id, title, onSelect) => client.addCommandCenterItem({ id, title, icon: "Settings", context: "workspace", onSelect });
|
const command = (id, title, onSelect) => client.addCommandCenterItem({ id, title, icon: "Settings", context: "workspace", onSelect });
|
||||||
command("finish", "Finish deployment", () => finish());
|
command("finish", "Finish deployment", () => finish());
|
||||||
command("finish-review", "Finish review", () => finishReview());
|
command("finish-review", "Finish review", () => finishReview());
|
||||||
@@ -102,10 +105,16 @@ export default function contribute(client) {
|
|||||||
command("hide-menu", "Hide composer menu", () => pillMenu.update({ visible: false }));
|
command("hide-menu", "Hide composer menu", () => pillMenu.update({ visible: false }));
|
||||||
command("show-menu", "Show composer menu", () => pillMenu.update({ visible: true }));
|
command("show-menu", "Show composer menu", () => pillMenu.update({ visible: true }));
|
||||||
const lifetime = new AbortController();
|
const lifetime = new AbortController();
|
||||||
|
let pillsHidden = false;
|
||||||
const applyWorkspace = (workspace) => {
|
const applyWorkspace = (workspace) => {
|
||||||
if (workspace.id !== workspaceId) return;
|
if (workspace.id !== workspaceId) return;
|
||||||
|
const hidePills = workspace.name === "No composer pills";
|
||||||
deploy.update({ visible: workspace.name !== "Compact checks" });
|
deploy.update({ visible: workspace.name !== "Compact checks" });
|
||||||
pillMenu.update({ visible: workspace.name !== "Hide composer menu" });
|
pillMenu.update({ visible: workspace.name !== "Hide composer menu" && !hidePills });
|
||||||
|
if (hidePills === pillsHidden) return;
|
||||||
|
pillsHidden = hidePills;
|
||||||
|
review.update({ visible: !hidePills });
|
||||||
|
usage.update({ visible: !hidePills });
|
||||||
};
|
};
|
||||||
void client.paseo.workspaces.list({ subscribe: {}, signal: lifetime.signal }).then(({ subscription }) => {
|
void client.paseo.workspaces.list({ subscribe: {}, signal: lifetime.signal }).then(({ subscription }) => {
|
||||||
subscription.subscribe({
|
subscription.subscribe({
|
||||||
@@ -244,6 +253,38 @@ async function captureSchemes(page: Page, info: TestInfo, name: string, subject:
|
|||||||
await page.emulateMedia({ colorScheme: "light" });
|
await page.emulateMedia({ colorScheme: "light" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const COMPOSER_PILLS = ["Run review", "Composer checks", "Composer status"] as const;
|
||||||
|
|
||||||
|
function chevronOf(page: Page, title: string): Locator {
|
||||||
|
return page
|
||||||
|
.getByRole("button", { name: title, exact: true })
|
||||||
|
.getByTestId("plugin-button-chevron");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Composer pills that open a menu or popover carry a chevron; a one-tap action does not. */
|
||||||
|
async function expectComposerPillChevrons(page: Page) {
|
||||||
|
await expect(chevronOf(page, "Composer checks")).toHaveCount(1);
|
||||||
|
await expect(chevronOf(page, "Composer status")).toHaveCount(1);
|
||||||
|
await expect(chevronOf(page, "Run review")).toHaveCount(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setComposerPillsShown(
|
||||||
|
page: Page,
|
||||||
|
showcase: { setTitle(title: string): Promise<unknown> },
|
||||||
|
shown: boolean,
|
||||||
|
) {
|
||||||
|
await showcase.setTitle(shown ? "Button showcase" : "No composer pills");
|
||||||
|
for (const title of COMPOSER_PILLS) {
|
||||||
|
await expect(page.getByRole("button", { name: title, exact: true })).toHaveCount(shown ? 1 : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function lastTurnTop(page: Page): Promise<number> {
|
||||||
|
const box = await page.getByRole("button", { name: "Copy turn" }).last().boundingBox();
|
||||||
|
expect(box).not.toBeNull();
|
||||||
|
return box!.y;
|
||||||
|
}
|
||||||
|
|
||||||
async function expectHeaderTextTruncated(page: Page) {
|
async function expectHeaderTextTruncated(page: Page) {
|
||||||
const title = page.getByTestId("workspace-header-title");
|
const title = page.getByTestId("workspace-header-title");
|
||||||
const subtitle = page.getByTestId("workspace-header-subtitle");
|
const subtitle = page.getByTestId("workspace-header-subtitle");
|
||||||
@@ -276,6 +317,7 @@ export async function withButtonShowcase(
|
|||||||
run: (buttons: {
|
run: (buttons: {
|
||||||
openWideMenusAndPopovers(): Promise<void>;
|
openWideMenusAndPopovers(): Promise<void>;
|
||||||
runAndUpdateActions(): Promise<void>;
|
runAndUpdateActions(): Promise<void>;
|
||||||
|
keepTrackSpaceWithoutPills(): Promise<void>;
|
||||||
openCompactSheets(): Promise<void>;
|
openCompactSheets(): Promise<void>;
|
||||||
useCompactWorkspaceMenu(): Promise<void>;
|
useCompactWorkspaceMenu(): Promise<void>;
|
||||||
hideAndUnloadOpenButtons(): Promise<void>;
|
hideAndUnloadOpenButtons(): Promise<void>;
|
||||||
@@ -348,11 +390,7 @@ export async function withButtonShowcase(
|
|||||||
.getByRole("button", { name: "Header checks", exact: true })
|
.getByRole("button", { name: "Header checks", exact: true })
|
||||||
.getByTestId("plugin-button-chevron"),
|
.getByTestId("plugin-button-chevron"),
|
||||||
).toHaveCount(1);
|
).toHaveCount(1);
|
||||||
await expect(
|
await expectComposerPillChevrons(page);
|
||||||
page
|
|
||||||
.getByRole("button", { name: "Composer checks", exact: true })
|
|
||||||
.getByTestId("plugin-button-chevron"),
|
|
||||||
).toHaveCount(0);
|
|
||||||
await expectSurfaceVisible(page);
|
await expectSurfaceVisible(page);
|
||||||
await captureSchemes(
|
await captureSchemes(
|
||||||
page,
|
page,
|
||||||
@@ -476,10 +514,31 @@ export async function withButtonShowcase(
|
|||||||
"Review ready",
|
"Review ready",
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
keepTrackSpaceWithoutPills: () =>
|
||||||
|
test.step("the composer track keeps its space when every pill leaves and returns", async () => {
|
||||||
|
await page.setViewportSize(WIDE);
|
||||||
|
await submitMessage(page, "Stream a turn under the composer pills");
|
||||||
|
await expectTurnCopyButton(page);
|
||||||
|
await waitForScrollableChat(page, { minScrollableDistance: 200, timeout: 30_000 });
|
||||||
|
for (const viewport of [WIDE, COMPACT]) {
|
||||||
|
await page.setViewportSize(viewport);
|
||||||
|
await scrollAgentChatToBottom(page);
|
||||||
|
const top = await lastTurnTop(page);
|
||||||
|
await setComposerPillsShown(page, showcase, false);
|
||||||
|
expect(await lastTurnTop(page)).toBe(top);
|
||||||
|
await setComposerPillsShown(page, showcase, true);
|
||||||
|
expect(await lastTurnTop(page)).toBe(top);
|
||||||
|
}
|
||||||
|
await page.setViewportSize(WIDE);
|
||||||
|
}),
|
||||||
openCompactSheets: () =>
|
openCompactSheets: () =>
|
||||||
test.step("compact header leaves plugin actions to the workspace menu while composer triggers open sheets", async () => {
|
test.step("compact header leaves plugin actions to the workspace menu while composer triggers open sheets", async () => {
|
||||||
await page.setViewportSize(COMPACT);
|
await page.setViewportSize(COMPACT);
|
||||||
await expect(page.getByTestId("plugin-button-chevron")).toHaveCount(0);
|
await expect(
|
||||||
|
page.getByRole("toolbar", { name: "Workspace actions", exact: true }),
|
||||||
|
).toHaveCount(0);
|
||||||
|
await expectComposerPillChevrons(page);
|
||||||
|
await expect(page.getByTestId("plugin-button-chevron")).toHaveCount(2);
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole("button", { name: "Composer checks", exact: true }),
|
page.getByRole("button", { name: "Composer checks", exact: true }),
|
||||||
).toContainText("Checks");
|
).toContainText("Checks");
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
import { copyPluginExample } from "./plugin-fixture";
|
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
||||||
|
import { tmpdir } from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import { copyPluginExample, pluginRequirements } from "./plugin-fixture";
|
||||||
import { expect, test as base, type Page } from "../fixtures";
|
import { expect, test as base, type Page } from "../fixtures";
|
||||||
import { gotoAppShell, openSettings } from "./app";
|
import { gotoAppShell, openSettings } from "./app";
|
||||||
import { goBackInSettings, openCompactSettings, openHostSection } from "./settings";
|
import { goBackInSettings, openCompactSettings, openHostSection } from "./settings";
|
||||||
@@ -9,6 +12,54 @@ import { connectNewWorkspaceDaemonClient } from "./new-workspace";
|
|||||||
|
|
||||||
type SettingsClient = Awaited<ReturnType<typeof connectNewWorkspaceDaemonClient>>;
|
type SettingsClient = Awaited<ReturnType<typeof connectNewWorkspaceDaemonClient>>;
|
||||||
|
|
||||||
|
const TABBED_PLUGIN_ID = "settings-tabs";
|
||||||
|
const TABBED_PLUGIN_NAME = "Tabbed settings";
|
||||||
|
/** Two settings screens, so the settings page shows a tab per screen. */
|
||||||
|
const TABBED_SOURCE = `import React from "react";
|
||||||
|
import { Text, View } from "react-native";
|
||||||
|
import { defineTranslations, useTranslation } from "@getpaseo/plugin/client";
|
||||||
|
|
||||||
|
const messages = defineTranslations({ resources: { en: { icon: "advanced-tab-icon" } } });
|
||||||
|
|
||||||
|
function General({ theme }) {
|
||||||
|
return <Text style={{ color: theme.colors.foreground }}>General settings body</Text>;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Advanced({ theme }) {
|
||||||
|
return <Text style={{ color: theme.colors.foreground }}>Advanced settings body</Text>;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Component icons run with the plugin's runtime; one that throws costs its tab only the icon.
|
||||||
|
function TranslatedIcon({ color, size }) {
|
||||||
|
const { t } = useTranslation(messages);
|
||||||
|
return <View testID={t("icon")} aria-hidden style={{ width: size, height: size, borderRadius: size / 2, backgroundColor: color }} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
function BrokenIcon() {
|
||||||
|
throw new Error("Settings tab icon exploded");
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function contribute(client) {
|
||||||
|
client.addSettingsScreen({ id: "general", title: "General", icon: BrokenIcon, Component: General });
|
||||||
|
client.addSettingsScreen({ id: "advanced", title: "Advanced", icon: TranslatedIcon, Component: Advanced });
|
||||||
|
return () => {};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
async function writeTabbedPlugin() {
|
||||||
|
const directory = await mkdtemp(path.join(tmpdir(), `paseo-${TABBED_PLUGIN_ID}-`));
|
||||||
|
await writeFile(
|
||||||
|
path.join(directory, "paseo-plugin.json"),
|
||||||
|
JSON.stringify({
|
||||||
|
id: TABBED_PLUGIN_ID,
|
||||||
|
name: TABBED_PLUGIN_NAME,
|
||||||
|
requirements: pluginRequirements,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
await writeFile(path.join(directory, "index.client.tsx"), TABBED_SOURCE);
|
||||||
|
return { directory, cleanup: () => rm(directory, { recursive: true, force: true }) };
|
||||||
|
}
|
||||||
|
|
||||||
export const test = base.extend<{ settingsPlugin: SettingsClient }>({
|
export const test = base.extend<{ settingsPlugin: SettingsClient }>({
|
||||||
settingsPlugin: [
|
settingsPlugin: [
|
||||||
async ({ e2eWorker, page }, provide, testInfo) => {
|
async ({ e2eWorker, page }, provide, testInfo) => {
|
||||||
@@ -16,16 +67,20 @@ export const test = base.extend<{ settingsPlugin: SettingsClient }>({
|
|||||||
const client = await connectNewWorkspaceDaemonClient({ ownProjects: false });
|
const client = await connectNewWorkspaceDaemonClient({ ownProjects: false });
|
||||||
const previous = await client.getDaemonConfig();
|
const previous = await client.getDaemonConfig();
|
||||||
const example = await copyPluginExample("settings");
|
const example = await copyPluginExample("settings");
|
||||||
|
const tabbed = await writeTabbedPlugin();
|
||||||
try {
|
try {
|
||||||
await client.patchDaemonConfig({ pluginsEnabled: true });
|
await client.patchDaemonConfig({ pluginsEnabled: true });
|
||||||
await client.installDirectoryPlugin(example.directory);
|
await client.installDirectoryPlugin(example.directory);
|
||||||
|
await client.installDirectoryPlugin(tabbed.directory);
|
||||||
await provide(client);
|
await provide(client);
|
||||||
await page.screenshot({ path: testInfo.outputPath("settings.png") });
|
await page.screenshot({ path: testInfo.outputPath("settings.png") });
|
||||||
} finally {
|
} finally {
|
||||||
await client.removePlugin("settings-example");
|
await client.removePlugin("settings-example");
|
||||||
|
await client.removePlugin(TABBED_PLUGIN_ID);
|
||||||
await client.patchDaemonConfig({ pluginsEnabled: previous.config.pluginsEnabled });
|
await client.patchDaemonConfig({ pluginsEnabled: previous.config.pluginsEnabled });
|
||||||
await client.close();
|
await client.close();
|
||||||
await example.cleanup();
|
await example.cleanup();
|
||||||
|
await tabbed.cleanup();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ auto: true },
|
{ auto: true },
|
||||||
@@ -44,9 +99,88 @@ export async function openCompactDisplaySettings(page: Page) {
|
|||||||
}
|
}
|
||||||
async function openPluginScreen(page: Page) {
|
async function openPluginScreen(page: Page) {
|
||||||
await openHostSection(page, getServerId(), "plugins");
|
await openHostSection(page, getServerId(), "plugins");
|
||||||
await page.getByRole("button", { name: "Actions for settings-example", exact: true }).click();
|
await openSettingsFromCog(page);
|
||||||
await page.getByRole("menuitem", { name: "Display", exact: true }).click();
|
}
|
||||||
|
/** 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();
|
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 expectSettingsHeader(page, "settings-example");
|
||||||
|
}
|
||||||
|
export async function openPluginsPage(page: Page) {
|
||||||
|
await gotoAppShell(page);
|
||||||
|
await openSettings(page);
|
||||||
|
await openHostSection(page, getServerId(), "plugins");
|
||||||
|
}
|
||||||
|
export async function expectActionsMenuWithoutSettings(page: Page) {
|
||||||
|
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: "Display", exact: true })).toHaveCount(0);
|
||||||
|
await page.keyboard.press("Escape");
|
||||||
|
}
|
||||||
|
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 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 controls; the id stays visible beneath it. */
|
||||||
|
export async function expectNamedPluginRow(page: Page) {
|
||||||
|
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(
|
||||||
|
page.getByRole("button", { name: `Actions for ${TABBED_PLUGIN_NAME}`, exact: true }),
|
||||||
|
).toBeVisible();
|
||||||
|
}
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
function settingsTab(page: Page, title: string) {
|
||||||
|
return page.getByTestId("plugin-settings-tabs").getByRole("button", { name: title, exact: true });
|
||||||
|
}
|
||||||
|
export async function selectSettingsTab(page: Page, title: "General" | "Advanced") {
|
||||||
|
await settingsTab(page, title).click();
|
||||||
|
await expectSettingsTab(page, title);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
// 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(
|
||||||
|
`${buildSettingsHostSectionRoute(getServerId(), "plugins")}/${TABBED_PLUGIN_ID}/${title.toLowerCase()}`,
|
||||||
|
);
|
||||||
|
await expectSettingsTab(page, title);
|
||||||
}
|
}
|
||||||
export async function groupByWorkspace(page: Page) {
|
export async function groupByWorkspace(page: Page) {
|
||||||
await page.getByRole("button", { name: /^Group agents by:/ }).click();
|
await page.getByRole("button", { name: /^Group agents by:/ }).click();
|
||||||
@@ -101,11 +235,7 @@ export async function discardTitle(page: Page) {
|
|||||||
}
|
}
|
||||||
export async function returnAndReopenSettings(page: Page) {
|
export async function returnAndReopenSettings(page: Page) {
|
||||||
await goBackInSettings(page);
|
await goBackInSettings(page);
|
||||||
const actions = page.getByRole("button", { name: "Actions for settings-example", exact: true });
|
await openSettingsFromCog(page);
|
||||||
await expect(actions).toBeVisible();
|
|
||||||
await actions.click();
|
|
||||||
await page.getByRole("menuitem", { name: "Display", exact: true }).click();
|
|
||||||
await expect(page.getByRole("switch", { name: "Show metadata" })).toBeVisible();
|
|
||||||
}
|
}
|
||||||
export async function returnToPluginsPage(page: Page) {
|
export async function returnToPluginsPage(page: Page) {
|
||||||
await page.getByRole("button", { name: "Back to plugins", exact: true }).click();
|
await page.getByRole("button", { name: "Back to plugins", exact: true }).click();
|
||||||
@@ -114,6 +244,10 @@ export async function returnToPluginsPage(page: Page) {
|
|||||||
page.getByRole("button", { name: "Actions for settings-example", exact: true }),
|
page.getByRole("button", { name: "Actions for settings-example", exact: true }),
|
||||||
).toBeVisible();
|
).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) {
|
export async function expectSettingsUnavailable(page: Page) {
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText("This plugin settings screen is unavailable.", { exact: true }),
|
page.getByText("This plugin settings screen is unavailable.", { exact: true }),
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ export interface SeedDaemonClient {
|
|||||||
featureValues?: Record<string, unknown>;
|
featureValues?: Record<string, unknown>;
|
||||||
initialPrompt?: string;
|
initialPrompt?: string;
|
||||||
labels?: Record<string, string>;
|
labels?: Record<string, string>;
|
||||||
|
background?: boolean;
|
||||||
}): Promise<{ id: string; status: string }>;
|
}): Promise<{ id: string; status: string }>;
|
||||||
fetchAgents(options?: { scope?: "active" }): Promise<{
|
fetchAgents(options?: { scope?: "active" }): Promise<{
|
||||||
entries: Array<{
|
entries: Array<{
|
||||||
|
|||||||
@@ -71,6 +71,15 @@ export async function focusWorkspaceRowWithKeyboard(
|
|||||||
await expect(row).toBeFocused();
|
await expect(row).toBeFocused();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function scrollWorkspaceList(page: Page): Promise<void> {
|
||||||
|
const list = page.getByTestId("sidebar-project-workspace-list-scroll");
|
||||||
|
const before = await list.evaluate((element) => element.scrollTop);
|
||||||
|
await list.evaluate((element) =>
|
||||||
|
element.scrollBy({ top: element.scrollTop > 0 ? -40 : 40, behavior: "instant" }),
|
||||||
|
);
|
||||||
|
await expect.poll(() => list.evaluate((element) => element.scrollTop)).not.toBe(before);
|
||||||
|
}
|
||||||
|
|
||||||
export async function expectWorkspaceHoverCardOpen(page: Page): Promise<void> {
|
export async function expectWorkspaceHoverCardOpen(page: Page): Promise<void> {
|
||||||
await expect(page.getByTestId("workspace-hover-card")).toBeVisible();
|
await expect(page.getByTestId("workspace-hover-card")).toBeVisible();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
apply plugin: 'expo-module-gradle-plugin'
|
||||||
|
|
||||||
|
group = 'sh.paseo.keyboard'
|
||||||
|
version = '0.1.0'
|
||||||
|
android {
|
||||||
|
namespace 'sh.paseo.keyboard'
|
||||||
|
defaultConfig {
|
||||||
|
versionCode 1
|
||||||
|
versionName '0.1.0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
implementation 'com.facebook.react:react-android'
|
||||||
|
testImplementation 'junit:junit:4.13.2'
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package sh.paseo.keyboard
|
||||||
|
|
||||||
|
import android.view.KeyCharacterMap
|
||||||
|
|
||||||
|
internal fun hardwareCharacterKey(character: Int): String =
|
||||||
|
if (character and KeyCharacterMap.COMBINING_ACCENT != 0) "Dead"
|
||||||
|
else String(Character.toChars(character))
|
||||||
+164
@@ -0,0 +1,164 @@
|
|||||||
|
package sh.paseo.keyboard
|
||||||
|
|
||||||
|
import android.content.ComponentCallbacks
|
||||||
|
import android.content.res.Configuration
|
||||||
|
import android.hardware.input.InputManager
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
|
import android.view.InputDevice
|
||||||
|
import android.view.KeyEvent
|
||||||
|
import android.view.Window
|
||||||
|
import android.widget.EditText
|
||||||
|
import android.view.inputmethod.BaseInputConnection
|
||||||
|
import com.facebook.react.bridge.UiThreadUtil
|
||||||
|
import com.facebook.react.bridge.ReactContext
|
||||||
|
import com.facebook.react.interfaces.ExtraWindowEventListener
|
||||||
|
import expo.modules.kotlin.modules.Module
|
||||||
|
import expo.modules.kotlin.modules.ModuleDefinition
|
||||||
|
|
||||||
|
internal object HardwareKeyboard {
|
||||||
|
var module: PaseoHardwareKeyboardModule? = null
|
||||||
|
@Volatile var overlayKeys: Set<String> = emptySet()
|
||||||
|
private val windows = mutableMapOf<Window, KeyboardWindowCallback>()
|
||||||
|
val dispatcher = WindowKeyDispatcher<KeyEvent>()
|
||||||
|
private val consumedPresses = mutableSetOf<Int>()
|
||||||
|
|
||||||
|
fun observe(window: Window) {
|
||||||
|
if (windows.containsKey(window)) return
|
||||||
|
val callback = KeyboardWindowCallback(window, window.callback)
|
||||||
|
windows[window] = callback
|
||||||
|
window.callback = callback
|
||||||
|
}
|
||||||
|
fun release(window: Window) {
|
||||||
|
val callback = windows.remove(window) ?: return
|
||||||
|
if (window.callback === callback) window.callback = callback.previous
|
||||||
|
}
|
||||||
|
fun releaseAll() {
|
||||||
|
windows.keys.toList().forEach { release(it) }
|
||||||
|
consumedPresses.clear()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun dispatch(event: KeyEvent, composing: Boolean): Boolean {
|
||||||
|
if (event.flags and KeyEvent.FLAG_SOFT_KEYBOARD != 0) return false
|
||||||
|
if (event.action != KeyEvent.ACTION_DOWN && event.action != KeyEvent.ACTION_UP) return false
|
||||||
|
val code = code(event.keyCode)
|
||||||
|
if (code.isEmpty()) return false
|
||||||
|
val textModifiers = event.metaState and KeyEvent.META_CTRL_MASK.inv() and KeyEvent.META_META_MASK.inv()
|
||||||
|
val character = event.getUnicodeChar(textModifiers)
|
||||||
|
val named = !code.startsWith("Key") && !code.startsWith("Digit")
|
||||||
|
val key = when {
|
||||||
|
code.startsWith("Control") -> "Control"
|
||||||
|
code.startsWith("Meta") -> "Meta"
|
||||||
|
code.startsWith("Shift") -> "Shift"
|
||||||
|
code.startsWith("Alt") -> "Alt"
|
||||||
|
named && (character == 0 || code == "Enter" || code == "Tab" || code == "Backspace") -> code
|
||||||
|
character != 0 -> hardwareCharacterKey(character)
|
||||||
|
else -> code
|
||||||
|
}
|
||||||
|
module?.emit(mapOf(
|
||||||
|
"key" to key, "code" to code,
|
||||||
|
"altKey" to event.isAltPressed, "ctrlKey" to event.isCtrlPressed,
|
||||||
|
"metaKey" to event.isMetaPressed, "shiftKey" to event.isShiftPressed,
|
||||||
|
"repeat" to (event.repeatCount > 0), "isComposing" to composing,
|
||||||
|
"phase" to if (event.action == KeyEvent.ACTION_UP) "up" else "down"
|
||||||
|
))
|
||||||
|
if (event.action == KeyEvent.ACTION_UP) return consumedPresses.remove(event.keyCode)
|
||||||
|
val overlayOwnsKey = key != "Dead" && key in overlayKeys && !event.isCtrlPressed && !event.isMetaPressed && !event.isAltPressed && !composing
|
||||||
|
if (overlayOwnsKey) consumedPresses.add(event.keyCode)
|
||||||
|
return overlayOwnsKey
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun code(keyCode: Int): String = when (keyCode) {
|
||||||
|
in KeyEvent.KEYCODE_A..KeyEvent.KEYCODE_Z -> "Key" + ('A'.code + keyCode - KeyEvent.KEYCODE_A).toChar()
|
||||||
|
in KeyEvent.KEYCODE_0..KeyEvent.KEYCODE_9 -> "Digit" + (keyCode - KeyEvent.KEYCODE_0)
|
||||||
|
in KeyEvent.KEYCODE_F1..KeyEvent.KEYCODE_F12 -> "F" + (keyCode - KeyEvent.KEYCODE_F1 + 1)
|
||||||
|
KeyEvent.KEYCODE_ENTER, KeyEvent.KEYCODE_NUMPAD_ENTER -> "Enter"
|
||||||
|
KeyEvent.KEYCODE_ESCAPE -> "Escape"
|
||||||
|
KeyEvent.KEYCODE_DEL -> "Backspace"
|
||||||
|
KeyEvent.KEYCODE_FORWARD_DEL -> "Delete"
|
||||||
|
KeyEvent.KEYCODE_TAB -> "Tab"
|
||||||
|
KeyEvent.KEYCODE_SPACE -> "Space"
|
||||||
|
KeyEvent.KEYCODE_DPAD_UP -> "ArrowUp"
|
||||||
|
KeyEvent.KEYCODE_DPAD_DOWN -> "ArrowDown"
|
||||||
|
KeyEvent.KEYCODE_DPAD_LEFT -> "ArrowLeft"
|
||||||
|
KeyEvent.KEYCODE_DPAD_RIGHT -> "ArrowRight"
|
||||||
|
KeyEvent.KEYCODE_CTRL_LEFT -> "ControlLeft"
|
||||||
|
KeyEvent.KEYCODE_CTRL_RIGHT -> "ControlRight"
|
||||||
|
KeyEvent.KEYCODE_META_LEFT -> "MetaLeft"
|
||||||
|
KeyEvent.KEYCODE_META_RIGHT -> "MetaRight"
|
||||||
|
KeyEvent.KEYCODE_SHIFT_LEFT -> "ShiftLeft"
|
||||||
|
KeyEvent.KEYCODE_SHIFT_RIGHT -> "ShiftRight"
|
||||||
|
KeyEvent.KEYCODE_ALT_LEFT -> "AltLeft"
|
||||||
|
KeyEvent.KEYCODE_ALT_RIGHT -> "AltRight"
|
||||||
|
KeyEvent.KEYCODE_COMMA -> "Comma"
|
||||||
|
KeyEvent.KEYCODE_PERIOD -> "Period"
|
||||||
|
KeyEvent.KEYCODE_MINUS -> "Minus"
|
||||||
|
KeyEvent.KEYCODE_EQUALS -> "Equal"
|
||||||
|
KeyEvent.KEYCODE_LEFT_BRACKET -> "BracketLeft"
|
||||||
|
KeyEvent.KEYCODE_RIGHT_BRACKET -> "BracketRight"
|
||||||
|
KeyEvent.KEYCODE_BACKSLASH -> "Backslash"
|
||||||
|
KeyEvent.KEYCODE_SEMICOLON -> "Semicolon"
|
||||||
|
KeyEvent.KEYCODE_APOSTROPHE -> "Quote"
|
||||||
|
KeyEvent.KEYCODE_GRAVE -> "Backquote"
|
||||||
|
KeyEvent.KEYCODE_SLASH -> "Slash"
|
||||||
|
else -> ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class KeyboardWindowCallback(private val window: Window, val previous: Window.Callback) : Window.Callback by previous {
|
||||||
|
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
|
||||||
|
val editable = (window.currentFocus as? EditText)?.text
|
||||||
|
val composing = editable != null && BaseInputConnection.getComposingSpanStart(editable) >= 0
|
||||||
|
return HardwareKeyboard.dispatcher.dispatch(event, { HardwareKeyboard.dispatch(event, composing) }, { previous.dispatchKeyEvent(event) })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PaseoHardwareKeyboardModule : Module(), ExtraWindowEventListener, InputManager.InputDeviceListener, ComponentCallbacks {
|
||||||
|
private var inputManager: InputManager? = null
|
||||||
|
private var registeredReactContext: ReactContext? = null
|
||||||
|
private fun keyboardPresent(): Boolean {
|
||||||
|
val config = registeredReactContext?.resources?.configuration
|
||||||
|
return (config?.keyboard == Configuration.KEYBOARD_QWERTY && config.hardKeyboardHidden != Configuration.HARDKEYBOARDHIDDEN_YES) ||
|
||||||
|
InputDevice.getDeviceIds().any { id -> InputDevice.getDevice(id)?.let { !it.isVirtual && it.keyboardType == InputDevice.KEYBOARD_TYPE_ALPHABETIC } == true }
|
||||||
|
}
|
||||||
|
private fun presenceChanged() { sendEvent("onHardwareKeyboardPresenceChanged", emptyMap<String, Any>()) }
|
||||||
|
override fun onInputDeviceAdded(id: Int) { presenceChanged() }
|
||||||
|
override fun onInputDeviceRemoved(id: Int) { presenceChanged() }
|
||||||
|
override fun onInputDeviceChanged(id: Int) { presenceChanged() }
|
||||||
|
override fun onConfigurationChanged(config: Configuration) { presenceChanged() }
|
||||||
|
override fun onLowMemory() {}
|
||||||
|
override fun onExtraWindowCreate(window: Window) { HardwareKeyboard.observe(window) }
|
||||||
|
override fun onExtraWindowDestroy(window: Window) { HardwareKeyboard.release(window) }
|
||||||
|
override fun definition() = ModuleDefinition {
|
||||||
|
Name("PaseoHardwareKeyboard")
|
||||||
|
Events("onHardwareKeyboardShortcut", "onHardwareKeyboardPresenceChanged")
|
||||||
|
OnCreate {
|
||||||
|
HardwareKeyboard.module = this@PaseoHardwareKeyboardModule
|
||||||
|
val context = appContext.reactContext
|
||||||
|
require(context is ReactContext) { "Hardware keyboard observation requires a React context" }
|
||||||
|
registeredReactContext = context
|
||||||
|
context.registerComponentCallbacks(this@PaseoHardwareKeyboardModule)
|
||||||
|
inputManager = context.getSystemService(InputManager::class.java)
|
||||||
|
inputManager?.registerInputDeviceListener(this@PaseoHardwareKeyboardModule, Handler(Looper.getMainLooper()))
|
||||||
|
context.addExtraWindowEventListener(this@PaseoHardwareKeyboardModule)
|
||||||
|
UiThreadUtil.runOnUiThread { appContext.currentActivity?.window?.let { HardwareKeyboard.observe(it) } }
|
||||||
|
}
|
||||||
|
OnDestroy {
|
||||||
|
inputManager?.unregisterInputDeviceListener(this@PaseoHardwareKeyboardModule)
|
||||||
|
inputManager = null
|
||||||
|
registeredReactContext?.unregisterComponentCallbacks(this@PaseoHardwareKeyboardModule)
|
||||||
|
registeredReactContext?.removeExtraWindowEventListener(this@PaseoHardwareKeyboardModule)
|
||||||
|
registeredReactContext = null
|
||||||
|
if (HardwareKeyboard.module === this@PaseoHardwareKeyboardModule) {
|
||||||
|
HardwareKeyboard.module = null
|
||||||
|
HardwareKeyboard.overlayKeys = emptySet()
|
||||||
|
UiThreadUtil.runOnUiThread { if (HardwareKeyboard.module == null) HardwareKeyboard.releaseAll() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Function("getHardwareKeyboardPresent") { keyboardPresent() }
|
||||||
|
Function("setOverlayKeys") { keys: List<String> ->
|
||||||
|
HardwareKeyboard.overlayKeys = keys.filter { it in setOf("Escape", "Enter", "ArrowUp", "ArrowDown") }.toSet()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
internal fun emit(event: Map<String, Any>) { sendEvent("onHardwareKeyboardShortcut", event) }
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
package sh.paseo.keyboard
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.Bundle
|
||||||
|
import expo.modules.core.interfaces.Package
|
||||||
|
import expo.modules.core.interfaces.ReactActivityLifecycleListener
|
||||||
|
|
||||||
|
class PaseoHardwareKeyboardPackage : Package {
|
||||||
|
override fun createReactActivityLifecycleListeners(activityContext: Context): List<ReactActivityLifecycleListener> = listOf(
|
||||||
|
object : ReactActivityLifecycleListener {
|
||||||
|
override fun onCreate(activity: Activity, savedInstanceState: Bundle?) { HardwareKeyboard.observe(activity.window) }
|
||||||
|
override fun onResume(activity: Activity) { HardwareKeyboard.observe(activity.window) }
|
||||||
|
override fun onDestroy(activity: Activity) { HardwareKeyboard.release(activity.window) }
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package sh.paseo.keyboard
|
||||||
|
|
||||||
|
// A modal can forward the same physical event into the activity window. Keep
|
||||||
|
// observation outside that nested delivery, without retaining recycled KeyEvents.
|
||||||
|
internal class WindowKeyDispatcher<Event : Any> {
|
||||||
|
private val delivering = java.util.Collections.newSetFromMap(java.util.IdentityHashMap<Event, Boolean>())
|
||||||
|
fun dispatch(event: Event, observe: () -> Boolean, deliver: () -> Boolean): Boolean {
|
||||||
|
if (!delivering.add(event)) return deliver()
|
||||||
|
return try { observe() || deliver() } finally { delivering.remove(event) }
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package sh.paseo.keyboard
|
||||||
|
import org.junit.Assert.assertEquals
|
||||||
|
import org.junit.Test
|
||||||
|
class HardwareCharacterKeyTest {
|
||||||
|
@Test fun deadAccentUsesDomKeyWithoutThrowing() {
|
||||||
|
assertEquals("Dead", hardwareCharacterKey(Int.MIN_VALUE or 0xB4))
|
||||||
|
}
|
||||||
|
@Test fun ordinaryUnicodeRemainsText() {
|
||||||
|
assertEquals("é", hardwareCharacterKey(0xE9))
|
||||||
|
}
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
package sh.paseo.keyboard
|
||||||
|
|
||||||
|
import org.junit.Assert.assertEquals
|
||||||
|
import org.junit.Assert.assertTrue
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
class WindowKeyDispatcherTest {
|
||||||
|
@Test fun observesOnePressAcrossNestedWindows() {
|
||||||
|
val dispatcher = WindowKeyDispatcher<Any>()
|
||||||
|
val event = Any()
|
||||||
|
var observations = 0
|
||||||
|
var deliveries = 0
|
||||||
|
dispatcher.dispatch(event, { observations++; false }, {
|
||||||
|
dispatcher.dispatch(event, { observations++; false }, { deliveries++; false })
|
||||||
|
})
|
||||||
|
assertEquals(1, observations)
|
||||||
|
assertEquals(1, deliveries)
|
||||||
|
dispatcher.dispatch(event, { observations++; false }, { false })
|
||||||
|
assertEquals(2, observations)
|
||||||
|
}
|
||||||
|
@Test fun consumedOverlayKeyDoesNotReachTheView() {
|
||||||
|
val dispatcher = WindowKeyDispatcher<Any>()
|
||||||
|
var deliveries = 0
|
||||||
|
assertTrue(dispatcher.dispatch(Any(), { true }, { deliveries++; false }))
|
||||||
|
assertEquals(0, deliveries)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
const { withAppDelegate } = require("expo/config-plugins");
|
||||||
|
const SCENE_START = "super.scene(scene, willConnectTo: session, options: connectionOptions)";
|
||||||
|
|
||||||
|
function configureHardwareKeyboardAppDelegate(source) {
|
||||||
|
source = source.replace(
|
||||||
|
/^import PaseoHardwareKeyboard$/m,
|
||||||
|
"internal import PaseoHardwareKeyboard",
|
||||||
|
);
|
||||||
|
if (source.includes("PaseoHardwareKeyboardWindow.observing(window)")) return source;
|
||||||
|
if (!source.includes(SCENE_START)) {
|
||||||
|
throw new Error("Hardware keyboard observation requires the app's Expo scene delegate");
|
||||||
|
}
|
||||||
|
const installation = `${SCENE_START}
|
||||||
|
if let window {
|
||||||
|
let observedWindow = PaseoHardwareKeyboardWindow.observing(window)
|
||||||
|
self.window = observedWindow
|
||||||
|
(UIApplication.shared.delegate as? ExpoReactNativeFactoryProvider)?.window = observedWindow
|
||||||
|
}`;
|
||||||
|
return "internal import PaseoHardwareKeyboard\n" + source.replace(SCENE_START, installation);
|
||||||
|
}
|
||||||
|
module.exports = function withHardwareKeyboardWindow(config) {
|
||||||
|
return withAppDelegate(config, (modConfig) => {
|
||||||
|
modConfig.modResults.contents = configureHardwareKeyboardAppDelegate(
|
||||||
|
modConfig.modResults.contents,
|
||||||
|
);
|
||||||
|
return modConfig;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
module.exports.configureHardwareKeyboardAppDelegate = configureHardwareKeyboardAppDelegate;
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
"platforms": ["ios"],
|
"platforms": ["ios", "android"],
|
||||||
"ios": {
|
"ios": {
|
||||||
"modules": ["PaseoHardwareKeyboardModule"],
|
"modules": ["PaseoHardwareKeyboardModule"]
|
||||||
"reactDelegateHandlers": ["PaseoHardwareKeyboardReactDelegateHandler"]
|
},
|
||||||
|
"android": {
|
||||||
|
"modules": ["sh.paseo.keyboard.PaseoHardwareKeyboardModule"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+150
-12
@@ -1,53 +1,159 @@
|
|||||||
import ExpoModulesCore
|
import ExpoModulesCore
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import GameController
|
||||||
|
|
||||||
private let hardwareSubmitEventName = "onHardwareKeyboardSubmit"
|
private let hardwareSubmitEventName = "onHardwareKeyboardSubmit"
|
||||||
|
private let hardwareShortcutEventName = "onHardwareKeyboardShortcut"
|
||||||
|
|
||||||
private weak var activeModule: PaseoHardwareKeyboardModule?
|
private weak var activeModule: PaseoHardwareKeyboardModule?
|
||||||
private var isHardwareSubmitEnabled = false
|
private var isHardwareSubmitEnabled = false
|
||||||
|
private var overlayKeys: Set<String> = []
|
||||||
|
|
||||||
@objc
|
/// UIKit spells non-character keys as sentinel input strings rather than as the
|
||||||
public class PaseoHardwareKeyboardReactDelegateHandler: ExpoReactDelegateHandler {
|
/// character they would type. JS sends the DOM `code` and the mapping lives
|
||||||
public override func createRootViewController() -> UIViewController? {
|
/// here, so the constants stay in the one place that owns UIKit vocabulary.
|
||||||
return PaseoHardwareKeyboardRootViewController()
|
private let namedKeyInputs: [String: String] = [
|
||||||
|
"Escape": UIKeyCommand.inputEscape,
|
||||||
|
"ArrowUp": UIKeyCommand.inputUpArrow,
|
||||||
|
"ArrowDown": UIKeyCommand.inputDownArrow,
|
||||||
|
"Enter": "\r",
|
||||||
|
]
|
||||||
|
|
||||||
|
/// Whether the first responder is mid-IME-composition.
|
||||||
|
///
|
||||||
|
/// A committing key has to stay out of the way while a CJK candidate is being
|
||||||
|
/// chosen: Enter confirms the candidate, and consuming it as a key command
|
||||||
|
/// would submit the half-composed text instead.
|
||||||
|
private func isComposingText() -> Bool {
|
||||||
|
guard let responder = UIResponder.paseoCurrentFirstResponder as? UITextInput else {
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
return responder.markedTextRange != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PaseoHardwareKeyboardModule: Module {
|
public class PaseoHardwareKeyboardModule: Module {
|
||||||
|
private var keyboardObservers: [NSObjectProtocol] = []
|
||||||
public func definition() -> ModuleDefinition {
|
public func definition() -> ModuleDefinition {
|
||||||
Name("PaseoHardwareKeyboard")
|
Name("PaseoHardwareKeyboard")
|
||||||
|
|
||||||
Events(hardwareSubmitEventName)
|
Events(hardwareSubmitEventName, hardwareShortcutEventName, "onHardwareKeyboardPresenceChanged")
|
||||||
|
|
||||||
OnCreate {
|
OnCreate {
|
||||||
activeModule = self
|
activeModule = self
|
||||||
|
for name in [Notification.Name.GCKeyboardDidConnect, Notification.Name.GCKeyboardDidDisconnect] {
|
||||||
|
self.keyboardObservers.append(NotificationCenter.default.addObserver(forName: name, object: nil, queue: .main) { [weak self] _ in
|
||||||
|
self?.sendEvent("onHardwareKeyboardPresenceChanged", [:])
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Function("getHardwareKeyboardPresent") { GCKeyboard.coalesced != nil }
|
||||||
|
|
||||||
Function("setHardwareKeyboardSubmitEnabled") { (enabled: Bool) in
|
Function("setHardwareKeyboardSubmitEnabled") { (enabled: Bool) in
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
isHardwareSubmitEnabled = enabled
|
isHardwareSubmitEnabled = enabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Function("setOverlayKeys") { (keys: [String]) in
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
overlayKeys = Set(keys).intersection(["Enter", "ArrowUp", "ArrowDown"])
|
||||||
|
UIMenuSystem.main.setNeedsRebuild()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
OnDestroy {
|
OnDestroy {
|
||||||
|
self.keyboardObservers.forEach(NotificationCenter.default.removeObserver)
|
||||||
|
self.keyboardObservers = []
|
||||||
if activeModule === self {
|
if activeModule === self {
|
||||||
activeModule = nil
|
activeModule = nil
|
||||||
|
isHardwareSubmitEnabled = false
|
||||||
|
overlayKeys = []
|
||||||
}
|
}
|
||||||
isHardwareSubmitEnabled = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func emitHardwareKeyboardSubmit() {
|
fileprivate func emitHardwareKeyboardSubmit() {
|
||||||
sendEvent(hardwareSubmitEventName, [:])
|
sendEvent(hardwareSubmitEventName, [:])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fileprivate func emitHardwareKeyboardPress(_ press: UIPress, isRepeat: Bool) {
|
||||||
|
guard let key = press.key else { return }
|
||||||
|
let code = hardwareKeyCode(key)
|
||||||
|
let characters = key.characters
|
||||||
|
let named = namedKeyInputs.first { $0.value == characters }?.key
|
||||||
|
let keyName: String
|
||||||
|
if code.hasPrefix("Meta") { keyName = "Meta" }
|
||||||
|
else if code.hasPrefix("Control") { keyName = "Control" }
|
||||||
|
else if code.hasPrefix("Shift") { keyName = "Shift" }
|
||||||
|
else if code.hasPrefix("Alt") { keyName = "Alt" }
|
||||||
|
else { keyName = named ?? (characters.isEmpty ? code : characters) }
|
||||||
|
guard !code.isEmpty else { return }
|
||||||
|
sendEvent(hardwareShortcutEventName, [
|
||||||
|
"key": keyName,
|
||||||
|
"code": code,
|
||||||
|
"altKey": key.modifierFlags.contains(.alternate),
|
||||||
|
"ctrlKey": key.modifierFlags.contains(.control),
|
||||||
|
"metaKey": key.modifierFlags.contains(.command),
|
||||||
|
"shiftKey": key.modifierFlags.contains(.shift),
|
||||||
|
"repeat": isRepeat,
|
||||||
|
"isComposing": isComposingText(),
|
||||||
|
"phase": press.phase == .ended || press.phase == .cancelled ? "up" : "down",
|
||||||
|
])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class PaseoHardwareKeyboardRootViewController: UIViewController {
|
public final class PaseoHardwareKeyboardWindow: UIWindow {
|
||||||
override var keyCommands: [UIKeyCommand]? {
|
private var pressedCodes: Set<Int> = []
|
||||||
guard isHardwareSubmitEnabled && UIDevice.current.userInterfaceIdiom == .pad else {
|
public static func observing(_ original: UIWindow) -> UIWindow {
|
||||||
return super.keyCommands
|
if original is PaseoHardwareKeyboardWindow { return original }
|
||||||
}
|
guard let scene = original.windowScene else { return original }
|
||||||
|
let observed = PaseoHardwareKeyboardWindow(windowScene: scene)
|
||||||
|
observed.windowLevel = original.windowLevel
|
||||||
|
observed.backgroundColor = original.backgroundColor
|
||||||
|
let controller = original.rootViewController
|
||||||
|
original.rootViewController = nil
|
||||||
|
original.isHidden = true
|
||||||
|
observed.rootViewController = controller
|
||||||
|
observed.makeKeyAndVisible()
|
||||||
|
return observed
|
||||||
|
}
|
||||||
|
|
||||||
|
public override func sendEvent(_ event: UIEvent) {
|
||||||
|
if let event = event as? UIPressesEvent {
|
||||||
|
for press in event.allPresses where press.phase == .began || press.phase == .ended || press.phase == .cancelled {
|
||||||
|
guard let key = press.key else { continue }
|
||||||
|
let raw = Int(key.keyCode.rawValue)
|
||||||
|
let isRepeat = press.phase == .began && pressedCodes.contains(raw)
|
||||||
|
if press.phase == .began { pressedCodes.insert(raw) }
|
||||||
|
else { pressedCodes.remove(raw) }
|
||||||
|
activeModule?.emitHardwareKeyboardPress(press, isRepeat: isRepeat)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.sendEvent(event)
|
||||||
|
}
|
||||||
|
public override var keyCommands: [UIKeyCommand]? {
|
||||||
|
var commands = super.keyCommands ?? []
|
||||||
|
if isHardwareSubmitEnabled && !isPlainReturnClaimed && !isComposingText()
|
||||||
|
&& UIDevice.current.userInterfaceIdiom == .pad
|
||||||
|
{
|
||||||
|
commands.append(makeSubmitCommand())
|
||||||
|
}
|
||||||
|
if !isComposingText() { commands.append(contentsOf: overlayKeys.compactMap(makeShortcutCommand)) }
|
||||||
|
return commands
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Whether something registered has already asked for an unmodified Return.
|
||||||
|
///
|
||||||
|
/// The submit command is registered for as long as the composer holds focus,
|
||||||
|
/// which includes while a picker is open over it. Registering both would put
|
||||||
|
/// two commands on one press, and the composer would win a press the picker
|
||||||
|
/// asked for — Enter would create the workspace instead of choosing a project.
|
||||||
|
private var isPlainReturnClaimed: Bool {
|
||||||
|
overlayKeys.contains("Enter")
|
||||||
|
}
|
||||||
|
|
||||||
|
private func makeSubmitCommand() -> UIKeyCommand {
|
||||||
let command = UIKeyCommand(
|
let command = UIKeyCommand(
|
||||||
input: "\r",
|
input: "\r",
|
||||||
modifierFlags: [],
|
modifierFlags: [],
|
||||||
@@ -56,7 +162,14 @@ private final class PaseoHardwareKeyboardRootViewController: UIViewController {
|
|||||||
if #available(iOS 15.0, *) {
|
if #available(iOS 15.0, *) {
|
||||||
command.wantsPriorityOverSystemBehavior = true
|
command.wantsPriorityOverSystemBehavior = true
|
||||||
}
|
}
|
||||||
return (super.keyCommands ?? []) + [command]
|
return command
|
||||||
|
}
|
||||||
|
|
||||||
|
private func makeShortcutCommand(_ key: String) -> UIKeyCommand? {
|
||||||
|
guard let input = namedKeyInputs[key] else { return nil }
|
||||||
|
let command = UIKeyCommand(input: input, modifierFlags: [], action: #selector(handleHardwareKeyboardShortcut(_:)))
|
||||||
|
if #available(iOS 15.0, *) { command.wantsPriorityOverSystemBehavior = true }
|
||||||
|
return command
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
@@ -67,6 +180,9 @@ private final class PaseoHardwareKeyboardRootViewController: UIViewController {
|
|||||||
activeModule?.emitHardwareKeyboardSubmit()
|
activeModule?.emitHardwareKeyboardSubmit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc
|
||||||
|
private func handleHardwareKeyboardShortcut(_ sender: UIKeyCommand) {}
|
||||||
|
|
||||||
private func canSubmitCurrentTextInput() -> Bool {
|
private func canSubmitCurrentTextInput() -> Bool {
|
||||||
guard let responder = UIResponder.paseoCurrentFirstResponder else {
|
guard let responder = UIResponder.paseoCurrentFirstResponder else {
|
||||||
return false
|
return false
|
||||||
@@ -97,3 +213,25 @@ private extension UIResponder {
|
|||||||
UIResponder.currentFirstResponder = self
|
UIResponder.currentFirstResponder = self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private func hardwareKeyCode(_ key: UIKey) -> String {
|
||||||
|
let raw = key.keyCode.rawValue
|
||||||
|
if raw >= 4 && raw <= 29 {
|
||||||
|
let letter = UnicodeScalar(Int(raw) + 61)!
|
||||||
|
return "Key" + String(letter)
|
||||||
|
}
|
||||||
|
if raw >= 30 && raw <= 38 { return "Digit" + String(raw - 29) }
|
||||||
|
if raw == 39 { return "Digit0" }
|
||||||
|
let codes: [Int: String] = [
|
||||||
|
40: "Enter", 41: "Escape", 42: "Backspace", 43: "Tab", 44: "Space",
|
||||||
|
45: "Minus", 46: "Equal", 47: "BracketLeft", 48: "BracketRight",
|
||||||
|
49: "Backslash", 51: "Semicolon", 52: "Quote", 53: "Backquote",
|
||||||
|
54: "Comma", 55: "Period", 56: "Slash", 76: "Delete", 79: "ArrowRight",
|
||||||
|
80: "ArrowLeft", 81: "ArrowDown", 82: "ArrowUp", 224: "ControlLeft",
|
||||||
|
225: "ShiftLeft", 226: "AltLeft", 227: "MetaLeft", 228: "ControlRight",
|
||||||
|
229: "ShiftRight", 230: "AltRight", 231: "MetaRight",
|
||||||
|
]
|
||||||
|
if raw >= 58 && raw <= 69 { return "F" + String(raw - 57) }
|
||||||
|
return codes[Int(raw)] ?? ""
|
||||||
|
}
|
||||||
|
|||||||
+60
-2
@@ -4,11 +4,13 @@ import android.graphics.Rect
|
|||||||
import android.text.Selection
|
import android.text.Selection
|
||||||
import android.text.Spannable
|
import android.text.Spannable
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.view.InputDevice
|
||||||
|
import android.view.MotionEvent
|
||||||
|
import android.os.SystemClock
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
import androidx.test.platform.app.InstrumentationRegistry
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
import com.facebook.react.bridge.BridgeReactContext
|
|
||||||
import com.facebook.react.bridge.JavaOnlyArray
|
import com.facebook.react.bridge.JavaOnlyArray
|
||||||
import com.facebook.react.bridge.JavaOnlyMap
|
import com.facebook.react.bridge.JavaOnlyMap
|
||||||
import com.facebook.react.soloader.OpenSourceMergedSoMapping
|
import com.facebook.react.soloader.OpenSourceMergedSoMapping
|
||||||
@@ -24,6 +26,40 @@ import org.junit.runner.RunWith
|
|||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
class ScrollSelectionTest {
|
class ScrollSelectionTest {
|
||||||
|
@Test fun mouseWheelMovesInvertedViewportInVisualDirection() = withScroll(inverted = true) { scroll, _ ->
|
||||||
|
val before = scroll.scrollY
|
||||||
|
withWheel(1f) { event ->
|
||||||
|
assertTrue(scroll.dispatchGenericMotionEvent(event))
|
||||||
|
assertTrue("Wheel up must move toward older messages: $before -> ${scroll.scrollY}", scroll.scrollY > before)
|
||||||
|
assertEquals("The caller's event must not change", 1f, event.getAxisValue(MotionEvent.AXIS_VSCROLL))
|
||||||
|
}
|
||||||
|
val afterUp = scroll.scrollY
|
||||||
|
withWheel(-1f) { event ->
|
||||||
|
assertTrue(scroll.dispatchGenericMotionEvent(event))
|
||||||
|
assertTrue("Wheel down must move toward newer messages: $afterUp -> ${scroll.scrollY}", scroll.scrollY < afterUp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test fun mouseWheelKeepsOrdinaryScrollDirection() = withScroll(inverted = false) { scroll, _ ->
|
||||||
|
val before = scroll.scrollY
|
||||||
|
withWheel(1f) { event ->
|
||||||
|
assertTrue(scroll.dispatchGenericMotionEvent(event))
|
||||||
|
assertTrue(scroll.scrollY < before)
|
||||||
|
}
|
||||||
|
val afterUp = scroll.scrollY
|
||||||
|
withWheel(-1f) { event ->
|
||||||
|
assertTrue(scroll.dispatchGenericMotionEvent(event))
|
||||||
|
assertTrue(scroll.scrollY > afterUp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test fun mouseWheelRespectsDisabledScrolling() = withScroll(inverted = true) { scroll, _ ->
|
||||||
|
scroll.setScrollEnabled(false)
|
||||||
|
val before = scroll.scrollY
|
||||||
|
withWheel(1f) { scroll.dispatchGenericMotionEvent(it) }
|
||||||
|
assertEquals(before, scroll.scrollY)
|
||||||
|
}
|
||||||
|
|
||||||
@Test fun focusingSelectableTextKeepsInvertedViewportStill() = withScroll(inverted = true) { scroll, text ->
|
@Test fun focusingSelectableTextKeepsInvertedViewportStill() = withScroll(inverted = true) { scroll, text ->
|
||||||
val before = scroll.scrollY
|
val before = scroll.scrollY
|
||||||
assertTrue(text.requestFocus())
|
assertTrue(text.requestFocus())
|
||||||
@@ -70,7 +106,7 @@ class ScrollSelectionTest {
|
|||||||
val appContext = instrumentation.targetContext
|
val appContext = instrumentation.targetContext
|
||||||
DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(appContext)
|
DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(appContext)
|
||||||
SoLoader.init(appContext, OpenSourceMergedSoMapping)
|
SoLoader.init(appContext, OpenSourceMergedSoMapping)
|
||||||
val reactContext = BridgeReactContext(appContext)
|
val reactContext = ScrollTestContext(appContext)
|
||||||
val context = ThemedReactContext(reactContext, appContext)
|
val context = ThemedReactContext(reactContext, appContext)
|
||||||
val manager = PaseoScrollPackage().createViewManager(reactContext, ReactScrollViewManager.REACT_CLASS) as ReactScrollViewManager
|
val manager = PaseoScrollPackage().createViewManager(reactContext, ReactScrollViewManager.REACT_CLASS) as ReactScrollViewManager
|
||||||
val scroll = manager.createViewInstance(context)
|
val scroll = manager.createViewInstance(context)
|
||||||
@@ -98,4 +134,26 @@ class ScrollSelectionTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun exact(size: Int) = View.MeasureSpec.makeMeasureSpec(size, View.MeasureSpec.EXACTLY)
|
private fun exact(size: Int) = View.MeasureSpec.makeMeasureSpec(size, View.MeasureSpec.EXACTLY)
|
||||||
|
|
||||||
|
private fun withWheel(axis: Float, check: (MotionEvent) -> Unit) {
|
||||||
|
val time = SystemClock.uptimeMillis()
|
||||||
|
val properties = MotionEvent.PointerProperties().apply {
|
||||||
|
id = 0
|
||||||
|
toolType = MotionEvent.TOOL_TYPE_MOUSE
|
||||||
|
}
|
||||||
|
val coordinates = MotionEvent.PointerCoords().apply {
|
||||||
|
x = 150f
|
||||||
|
y = 150f
|
||||||
|
setAxisValue(MotionEvent.AXIS_VSCROLL, axis)
|
||||||
|
}
|
||||||
|
val event = MotionEvent.obtain(
|
||||||
|
time, time, MotionEvent.ACTION_SCROLL, 1, arrayOf(properties), arrayOf(coordinates),
|
||||||
|
0, 0, 1f, 1f, 0, 0, InputDevice.SOURCE_MOUSE, 0,
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
check(event)
|
||||||
|
} finally {
|
||||||
|
event.recycle()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package sh.paseo.scroll;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import com.facebook.react.bridge.BridgeReactContext;
|
||||||
|
import com.facebook.react.uimanager.events.BlackHoleEventDispatcher;
|
||||||
|
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||||
|
import com.facebook.react.uimanager.events.EventDispatcherProvider;
|
||||||
|
|
||||||
|
/** Native-only tests use RN's dispatcher for a context without a JS instance. */
|
||||||
|
final class ScrollTestContext extends BridgeReactContext implements EventDispatcherProvider {
|
||||||
|
ScrollTestContext(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventDispatcher getEventDispatcher() {
|
||||||
|
return BlackHoleEventDispatcher.INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
||||||
+42
-6
@@ -2,6 +2,8 @@ package sh.paseo.scroll
|
|||||||
|
|
||||||
import android.graphics.Matrix
|
import android.graphics.Matrix
|
||||||
import android.graphics.Rect
|
import android.graphics.Rect
|
||||||
|
import android.view.InputDevice
|
||||||
|
import android.view.MotionEvent
|
||||||
import com.facebook.react.ReactPackage
|
import com.facebook.react.ReactPackage
|
||||||
import com.facebook.react.ViewManagerOnDemandReactPackage
|
import com.facebook.react.ViewManagerOnDemandReactPackage
|
||||||
import com.facebook.react.bridge.NativeModule
|
import com.facebook.react.bridge.NativeModule
|
||||||
@@ -30,13 +32,47 @@ private class PaseoScrollViewManager : ReactScrollViewManager() {
|
|||||||
private class PaseoScrollView(context: ThemedReactContext) : ReactScrollView(context) {
|
private class PaseoScrollView(context: ThemedReactContext) : ReactScrollView(context) {
|
||||||
private val transformValues = FloatArray(9)
|
private val transformValues = FloatArray(9)
|
||||||
|
|
||||||
|
private fun isVerticallyInverted(): Boolean {
|
||||||
|
// Android FlatList uses scale: -1, which RN decomposes into a 180-degree
|
||||||
|
// rotation with positive scaleY. Read the resulting transform, not scaleY.
|
||||||
|
matrix.getValues(transformValues)
|
||||||
|
return transformValues[Matrix.MSCALE_Y] < 0
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onGenericMotionEvent(event: MotionEvent): Boolean {
|
||||||
|
if (!isVerticallyInverted() || event.actionMasked != MotionEvent.ACTION_SCROLL ||
|
||||||
|
!event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) {
|
||||||
|
return super.onGenericMotionEvent(event)
|
||||||
|
}
|
||||||
|
if (!scrollEnabled) return false
|
||||||
|
|
||||||
|
// Android applies wheel axes directly to scrollY; the inversion transform only
|
||||||
|
// transforms pointer coordinates. Reverse the vertical axis before delegating so
|
||||||
|
// platform scroll bounds and scroll events still apply.
|
||||||
|
val properties = Array(event.pointerCount) { index ->
|
||||||
|
MotionEvent.PointerProperties().also { event.getPointerProperties(index, it) }
|
||||||
|
}
|
||||||
|
val coordinates = Array(event.pointerCount) { index ->
|
||||||
|
MotionEvent.PointerCoords().also {
|
||||||
|
event.getPointerCoords(index, it)
|
||||||
|
it.setAxisValue(MotionEvent.AXIS_VSCROLL, -it.getAxisValue(MotionEvent.AXIS_VSCROLL))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val correctedEvent = MotionEvent.obtain(
|
||||||
|
event.downTime, event.eventTime, event.action, event.pointerCount, properties, coordinates,
|
||||||
|
event.metaState, event.buttonState, event.xPrecision, event.yPrecision,
|
||||||
|
event.deviceId, event.edgeFlags, event.source, event.flags,
|
||||||
|
)
|
||||||
|
return try {
|
||||||
|
super.onGenericMotionEvent(correctedEvent)
|
||||||
|
} finally {
|
||||||
|
correctedEvent.recycle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Both RN focus handling and Android selection visibility requests use this calculation.
|
// Both RN focus handling and Android selection visibility requests use this calculation.
|
||||||
// Its coordinates ignore inversion. Keep focus/selection bookkeeping, but leave timeline
|
// Its coordinates ignore inversion. Keep focus/selection bookkeeping, but leave timeline
|
||||||
// movement to user gestures and explicit scroll commands.
|
// movement to user gestures and explicit scroll commands.
|
||||||
override fun computeScrollDeltaToGetChildRectOnScreen(rect: Rect): Int {
|
override fun computeScrollDeltaToGetChildRectOnScreen(rect: Rect): Int =
|
||||||
// RN's Android scale: -1 becomes a 180-degree rotation with positive scaleY.
|
if (isVerticallyInverted()) 0 else super.computeScrollDeltaToGetChildRectOnScreen(rect)
|
||||||
matrix.getValues(transformValues)
|
|
||||||
if (transformValues[Matrix.MSCALE_Y] < 0) return 0
|
|
||||||
return super.computeScrollDeltaToGetChildRectOnScreen(rect)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@getpaseo/app",
|
"name": "@getpaseo/app",
|
||||||
"version": "0.15.0-beta.1",
|
"version": "0.15.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "index.ts",
|
"main": "index.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
"dev:ios": "npm --prefix ../.. run build:client && cross-env APP_VARIANT=development expo run:ios",
|
"dev:ios": "npm --prefix ../.. run build:client && cross-env APP_VARIANT=development expo run:ios",
|
||||||
"build:apk": "npm --prefix ../.. run build:apk",
|
"build:apk": "npm --prefix ../.. run build:apk",
|
||||||
"build:apk:arm64": "npm --prefix ../.. run build:apk:arm64",
|
"build:apk:arm64": "npm --prefix ../.. run build:apk:arm64",
|
||||||
"test:android": "expo prebuild --platform android --no-install && cd android && ./gradlew :paseo-native-trace:testReleaseUnitTest :react-native-enriched-markdown:testReleaseUnitTest --tests '*InlineCodeFormattingTest' --no-daemon --max-workers=2 -Dorg.gradle.parallel=false"
|
"test:android": "expo prebuild --platform android --no-install && cd android && ./gradlew :paseo-native-trace:testReleaseUnitTest :paseo-hardware-keyboard:testReleaseUnitTest :react-native-enriched-markdown:testReleaseUnitTest --tests '*InlineCodeFormattingTest' --no-daemon --max-workers=2 -Dorg.gradle.parallel=false"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@codemirror/commands": "6.10.4",
|
"@codemirror/commands": "6.10.4",
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { Combobox, type ComboboxOption } from "@/components/ui/combobox";
|
|||||||
import {
|
import {
|
||||||
createControlGeometry,
|
createControlGeometry,
|
||||||
resolveControlInteractionStyles,
|
resolveControlInteractionStyles,
|
||||||
type FieldControlSize,
|
type ControlSize,
|
||||||
} from "@/components/ui/control-geometry";
|
} from "@/components/ui/control-geometry";
|
||||||
import { Field } from "@/components/ui/form-field";
|
import { Field } from "@/components/ui/form-field";
|
||||||
import { identityForeground } from "@/styles/identity-colors";
|
import { identityForeground } from "@/styles/identity-colors";
|
||||||
@@ -153,7 +153,7 @@ export function AgentProfileAppearanceField({
|
|||||||
icon: string;
|
icon: string;
|
||||||
color: string;
|
color: string;
|
||||||
onChange: (next: { icon: string; color: string }) => void;
|
onChange: (next: { icon: string; color: string }) => void;
|
||||||
size?: FieldControlSize;
|
size?: ControlSize;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
testID?: string;
|
testID?: string;
|
||||||
triggerTestID?: string;
|
triggerTestID?: string;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import type { AgentFeature } from "@getpaseo/protocol/agent-types";
|
|||||||
import type { AgentProfile } from "@getpaseo/protocol/messages";
|
import type { AgentProfile } from "@getpaseo/protocol/messages";
|
||||||
import { AdaptiveModalSheet, type SheetHeader } from "@/components/adaptive-modal-sheet";
|
import { AdaptiveModalSheet, type SheetHeader } from "@/components/adaptive-modal-sheet";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { type FieldControlSize } from "@/components/ui/control-geometry";
|
import { type ControlSize } from "@/components/ui/control-geometry";
|
||||||
import { Field, FormTextInput } from "@/components/ui/form-field";
|
import { Field, FormTextInput } from "@/components/ui/form-field";
|
||||||
import {
|
import {
|
||||||
SelectField,
|
SelectField,
|
||||||
@@ -14,7 +14,6 @@ import {
|
|||||||
type SelectFieldOption,
|
type SelectFieldOption,
|
||||||
} from "@/components/ui/select-field";
|
} from "@/components/ui/select-field";
|
||||||
import { Switch } from "@/components/ui/switch";
|
import { Switch } from "@/components/ui/switch";
|
||||||
import { useIsCompactFormFactor } from "@/constants/layout";
|
|
||||||
import { toErrorMessage } from "@/utils/error-messages";
|
import { toErrorMessage } from "@/utils/error-messages";
|
||||||
import { AgentProfileAppearanceField } from "./agent-profile-appearance-field";
|
import { AgentProfileAppearanceField } from "./agent-profile-appearance-field";
|
||||||
import type {
|
import type {
|
||||||
@@ -133,7 +132,7 @@ function OpenAgentProfileEditModal({
|
|||||||
onSave,
|
onSave,
|
||||||
}: AgentProfileEditModalProps & { onDismiss: () => void }): ReactElement {
|
}: AgentProfileEditModalProps & { onDismiss: () => void }): ReactElement {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const controlSize: FieldControlSize = useIsCompactFormFactor() ? "md" : "sm";
|
const controlSize: ControlSize = "md";
|
||||||
const snapshot = useMemo(
|
const snapshot = useMemo(
|
||||||
() => ({ mode, ...(profile ? { profile } : {}), ...(seed ? { seed } : {}) }),
|
() => ({ mode, ...(profile ? { profile } : {}), ...(seed ? { seed } : {}) }),
|
||||||
[mode, profile, seed],
|
[mode, profile, seed],
|
||||||
@@ -410,7 +409,7 @@ function AgentProfileFeatureRow({
|
|||||||
feature: AgentFeature;
|
feature: AgentFeature;
|
||||||
isFirst: boolean;
|
isFirst: boolean;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
size: FieldControlSize;
|
size: ControlSize;
|
||||||
model: AgentProfileFormModel;
|
model: AgentProfileFormModel;
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const rowStyle = useMemo(
|
const rowStyle = useMemo(
|
||||||
|
|||||||
@@ -103,7 +103,6 @@ export function AgentProfileRow({
|
|||||||
<View style={styles.rowActions}>
|
<View style={styles.rowActions}>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
|
||||||
leftIcon={moveUpIcon}
|
leftIcon={moveUpIcon}
|
||||||
onPress={handleMoveUp}
|
onPress={handleMoveUp}
|
||||||
disabled={isFirst}
|
disabled={isFirst}
|
||||||
@@ -112,7 +111,6 @@ export function AgentProfileRow({
|
|||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
|
||||||
leftIcon={moveDownIcon}
|
leftIcon={moveDownIcon}
|
||||||
onPress={handleMoveDown}
|
onPress={handleMoveDown}
|
||||||
disabled={isLast}
|
disabled={isLast}
|
||||||
@@ -121,7 +119,6 @@ export function AgentProfileRow({
|
|||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
|
||||||
leftIcon={editIcon}
|
leftIcon={editIcon}
|
||||||
onPress={handleEdit}
|
onPress={handleEdit}
|
||||||
accessibilityLabel={t("settings.host.agentProfiles.editProfile")}
|
accessibilityLabel={t("settings.host.agentProfiles.editProfile")}
|
||||||
@@ -129,7 +126,6 @@ export function AgentProfileRow({
|
|||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
|
||||||
leftIcon={removeIcon}
|
leftIcon={removeIcon}
|
||||||
onPress={handleRemove}
|
onPress={handleRemove}
|
||||||
accessibilityLabel={t("settings.host.agentProfiles.remove")}
|
accessibilityLabel={t("settings.host.agentProfiles.remove")}
|
||||||
|
|||||||
@@ -124,7 +124,6 @@ export function AgentProfilesSection({ serverId }: { serverId: string }): ReactE
|
|||||||
() => (
|
() => (
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
|
||||||
leftIcon={addIcon}
|
leftIcon={addIcon}
|
||||||
onPress={handleAddOpen}
|
onPress={handleAddOpen}
|
||||||
disabled={!profiles}
|
disabled={!profiles}
|
||||||
@@ -181,7 +180,7 @@ export function AgentProfilesSection({ serverId }: { serverId: string }): ReactE
|
|||||||
<Text style={styles.emptyText} testID="agent-profiles-empty">
|
<Text style={styles.emptyText} testID="agent-profiles-empty">
|
||||||
{t("settings.host.agentProfiles.emptyState")}
|
{t("settings.host.agentProfiles.emptyState")}
|
||||||
</Text>
|
</Text>
|
||||||
<Button size="sm" leftIcon={addIcon} onPress={handleAddOpen} disabled={!profiles}>
|
<Button leftIcon={addIcon} onPress={handleAddOpen} disabled={!profiles}>
|
||||||
{t("settings.host.agentProfiles.newProfile")}
|
{t("settings.host.agentProfiles.newProfile")}
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -3,29 +3,27 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { Text, View } from "react-native";
|
import { Text, View } from "react-native";
|
||||||
import { useFocusEffect } from "expo-router/react-navigation";
|
import { useFocusEffect } from "expo-router/react-navigation";
|
||||||
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||||
import { ArrowUpRight, Blocks, Check, Settings2 } from "lucide-react-native";
|
import { Settings2 } from "lucide-react-native";
|
||||||
import type { AgentSkillOperation, AgentSkillsStatus } from "@getpaseo/protocol/messages";
|
import type { AgentSkillOperation, AgentSkillsStatus } from "@getpaseo/protocol/messages";
|
||||||
import type { TFunction } from "i18next";
|
import type { TFunction } from "i18next";
|
||||||
|
import { SettingsCard, SettingsRow, SettingsSection } from "@/components/settings";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { SettingsSection } from "@/components/settings/headings/settings-section";
|
import { Switch } from "@/components/ui/switch";
|
||||||
import { settingsStyles } from "@/styles/settings";
|
import { settingsStyles } from "@/styles/settings";
|
||||||
import { ICON_SIZE, type Theme } from "@/styles/theme";
|
import { ICON_SIZE, type Theme } from "@/styles/theme";
|
||||||
import { confirmDialog } from "@/utils/confirm-dialog";
|
import { confirmDialog } from "@/utils/confirm-dialog";
|
||||||
import { openExternalUrl } from "@/utils/open-external-url";
|
|
||||||
import { SkillSelectionSheet } from "./selection-sheet";
|
import { SkillSelectionSheet } from "./selection-sheet";
|
||||||
import { useAgentSkills } from "./use-agent-skills";
|
import { useAgentSkills, type AgentSkillsController } from "./use-agent-skills";
|
||||||
|
|
||||||
|
export { useAgentSkills, type AgentSkillsController } from "./use-agent-skills";
|
||||||
|
|
||||||
const OP_KIND_ORDER: Record<AgentSkillOperation["kind"], number> = {
|
const OP_KIND_ORDER: Record<AgentSkillOperation["kind"], number> = {
|
||||||
add: 0,
|
add: 0,
|
||||||
update: 1,
|
update: 1,
|
||||||
delete: 2,
|
delete: 2,
|
||||||
};
|
};
|
||||||
const ThemedBlocks = withUnistyles(Blocks);
|
|
||||||
const ThemedCheck = withUnistyles(Check);
|
|
||||||
const ThemedSettings = withUnistyles(Settings2);
|
const ThemedSettings = withUnistyles(Settings2);
|
||||||
const ThemedArrowUpRight = withUnistyles(ArrowUpRight);
|
|
||||||
const SKILLS_DOCS_URL = "https://paseo.sh/docs/skills";
|
const SKILLS_DOCS_URL = "https://paseo.sh/docs/skills";
|
||||||
const foregroundMapping = (theme: Theme) => ({ color: theme.colors.foreground });
|
|
||||||
const mutedMapping = (theme: Theme) => ({ color: theme.colors.foregroundMuted });
|
const mutedMapping = (theme: Theme) => ({ color: theme.colors.foregroundMuted });
|
||||||
|
|
||||||
function formatUpdateMessage(ops: readonly AgentSkillOperation[], t: TFunction): string {
|
function formatUpdateMessage(ops: readonly AgentSkillOperation[], t: TFunction): string {
|
||||||
@@ -35,91 +33,50 @@ function formatUpdateMessage(ops: readonly AgentSkillOperation[], t: TFunction):
|
|||||||
.join("\n");
|
.join("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Whether the host has Paseo's skills installed in any form, current or not. */
|
||||||
|
export function areSkillsInstalled(status: AgentSkillsStatus | null): boolean {
|
||||||
|
return status !== null && status.state !== "not-installed";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Whether the saved selection names any skill there is to install. */
|
||||||
|
export function hasSelectedSkills(status: AgentSkillsStatus | null): boolean {
|
||||||
|
if (!status) return false;
|
||||||
|
if (status.selection.mode === "all") return status.available.length > 0;
|
||||||
|
return status.selection.skills.some((name) => status.available.includes(name));
|
||||||
|
}
|
||||||
|
|
||||||
export function AgentSkillsSection({ serverId }: { serverId: string }) {
|
export function AgentSkillsSection({ serverId }: { serverId: string }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const skills = useAgentSkills(serverId);
|
const skills = useAgentSkills(serverId);
|
||||||
const refreshSkills = skills.refresh;
|
const { refresh, connected, supported, reconcile, uninstall } = skills;
|
||||||
const skillsConnected = skills.connected;
|
|
||||||
const skillsSupported = skills.supported;
|
|
||||||
const [isChoosing, setIsChoosing] = useState(false);
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
if (skillsConnected && skillsSupported) void refreshSkills();
|
if (connected && supported) void refresh();
|
||||||
return undefined;
|
return undefined;
|
||||||
}, [refreshSkills, skillsConnected, skillsSupported]),
|
}, [refresh, connected, supported]),
|
||||||
);
|
);
|
||||||
const maintenanceOps = useMemo(
|
const handleValueChange = useCallback(
|
||||||
() => skills.status?.ops.filter((op) => op.kind !== "delete") ?? [],
|
(next: boolean) => {
|
||||||
[skills.status?.ops],
|
void (next ? reconcile() : uninstall());
|
||||||
|
},
|
||||||
|
[reconcile, uninstall],
|
||||||
);
|
);
|
||||||
const state =
|
const docsLink = useMemo(
|
||||||
skills.status?.state === "drift" && maintenanceOps.length === 0
|
() => ({
|
||||||
? "up-to-date"
|
href: SKILLS_DOCS_URL,
|
||||||
: (skills.status?.state ?? null);
|
label: t("settings.host.skills.docs"),
|
||||||
const hasSelected =
|
accessibilityLabel: t("settings.host.skills.openDocs"),
|
||||||
(skills.status?.selection.mode === "all" && skills.status.available.length > 0) ||
|
}),
|
||||||
(skills.status?.selection.mode === "custom" &&
|
[t],
|
||||||
skills.status.selection.skills.some((name) => skills.status?.available.includes(name)));
|
|
||||||
|
|
||||||
const handleReconcile = useCallback(async () => {
|
|
||||||
if (skills.isWorking) return;
|
|
||||||
const confirmed = await confirmDialog({
|
|
||||||
title: t("settings.host.skills.updateTitle"),
|
|
||||||
message:
|
|
||||||
maintenanceOps.length > 0
|
|
||||||
? formatUpdateMessage(maintenanceOps, t)
|
|
||||||
: t("settings.host.skills.updateFallback"),
|
|
||||||
confirmLabel: t("settings.host.skills.actions.update"),
|
|
||||||
});
|
|
||||||
if (confirmed) await skills.reconcile();
|
|
||||||
}, [maintenanceOps, skills, t]);
|
|
||||||
const handleUninstall = useCallback(async () => {
|
|
||||||
if (skills.isWorking) return;
|
|
||||||
const confirmed = await confirmDialog({
|
|
||||||
title: t("settings.host.skills.uninstallTitle"),
|
|
||||||
message: t("settings.host.skills.uninstallMessage"),
|
|
||||||
confirmLabel: t("settings.host.skills.actions.uninstall"),
|
|
||||||
destructive: true,
|
|
||||||
});
|
|
||||||
if (confirmed) await skills.uninstall();
|
|
||||||
}, [skills, t]);
|
|
||||||
const chooseIcon = useMemo(
|
|
||||||
() => <ThemedSettings size={ICON_SIZE.sm} uniProps={mutedMapping} />,
|
|
||||||
[],
|
|
||||||
);
|
|
||||||
const handleOpen = useCallback(() => setIsChoosing(true), []);
|
|
||||||
const handleClose = useCallback(() => setIsChoosing(false), []);
|
|
||||||
const handleOpenDocs = useCallback(() => {
|
|
||||||
void openExternalUrl(SKILLS_DOCS_URL);
|
|
||||||
}, []);
|
|
||||||
const docsIcon = useMemo(
|
|
||||||
() => <ThemedArrowUpRight size={ICON_SIZE.sm} uniProps={mutedMapping} />,
|
|
||||||
[],
|
|
||||||
);
|
|
||||||
const trailing = useMemo(
|
|
||||||
() => (
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
leftIcon={docsIcon}
|
|
||||||
textStyle={settingsStyles.sectionHeaderLinkText}
|
|
||||||
style={settingsStyles.sectionHeaderLink}
|
|
||||||
onPress={handleOpenDocs}
|
|
||||||
accessibilityLabel={t("settings.host.skills.openDocs")}
|
|
||||||
>
|
|
||||||
{t("settings.host.skills.docs")}
|
|
||||||
</Button>
|
|
||||||
),
|
|
||||||
[docsIcon, handleOpenDocs, t],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!skills.connected || !skills.supported) {
|
if (!connected || !supported) {
|
||||||
return (
|
return (
|
||||||
<SettingsSection title={t("settings.host.skills.sectionTitle")} trailing={trailing}>
|
<SettingsSection title={t("settings.host.skills.sectionTitle")} link={docsLink}>
|
||||||
<View style={settingsStyles.card} testID="host-agent-skills-unavailable">
|
<View style={settingsStyles.card} testID="host-agent-skills-unavailable">
|
||||||
<View style={styles.emptyCard}>
|
<View style={styles.emptyCard}>
|
||||||
<Text style={styles.mutedText}>
|
<Text style={styles.mutedText}>
|
||||||
{skills.connected
|
{connected
|
||||||
? t("settings.host.skills.unsupported")
|
? t("settings.host.skills.unsupported")
|
||||||
: t("settings.host.skills.unavailable")}
|
: t("settings.host.skills.unavailable")}
|
||||||
</Text>
|
</Text>
|
||||||
@@ -130,109 +87,112 @@ export function AgentSkillsSection({ serverId }: { serverId: string }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SettingsSection title={t("settings.host.skills.sectionTitle")} trailing={trailing}>
|
<SettingsSection title={t("settings.host.skills.sectionTitle")} link={docsLink}>
|
||||||
<View style={settingsStyles.card} testID="host-agent-skills-card">
|
<SettingsCard testID="host-agent-skills-card">
|
||||||
<View style={settingsStyles.row}>
|
<AgentSkillsRow
|
||||||
<View style={settingsStyles.rowContent}>
|
skills={skills}
|
||||||
<View style={styles.rowTitleRow}>
|
value={areSkillsInstalled(skills.status)}
|
||||||
<ThemedBlocks size={ICON_SIZE.md} uniProps={foregroundMapping} />
|
onValueChange={handleValueChange}
|
||||||
<Text style={settingsStyles.rowTitle}>{t("settings.host.skills.title")}</Text>
|
|
||||||
</View>
|
|
||||||
<Text style={settingsStyles.rowHint}>
|
|
||||||
{state === "drift"
|
|
||||||
? t("settings.host.skills.updateAvailable")
|
|
||||||
: t("settings.host.skills.description")}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
<View style={styles.actionsRow}>
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
leftIcon={chooseIcon}
|
|
||||||
onPress={handleOpen}
|
|
||||||
disabled={skills.status === null || skills.isWorking}
|
|
||||||
accessibilityLabel={t("settings.host.skills.choose")}
|
|
||||||
/>
|
|
||||||
{hasSelected ? (
|
|
||||||
<SkillsActions
|
|
||||||
state={state}
|
|
||||||
isWorking={skills.isWorking}
|
|
||||||
onInstall={skills.reconcile}
|
|
||||||
onReconcile={handleReconcile}
|
|
||||||
onUninstall={handleUninstall}
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
{skills.status ? (
|
|
||||||
<SkillSelectionSheet
|
|
||||||
visible={isChoosing}
|
|
||||||
available={skills.status.available}
|
|
||||||
selection={skills.status.selection}
|
|
||||||
isSaving={skills.isWorking}
|
|
||||||
onSave={skills.saveSelection}
|
|
||||||
onClose={handleClose}
|
|
||||||
/>
|
/>
|
||||||
) : null}
|
</SettingsCard>
|
||||||
</SettingsSection>
|
</SettingsSection>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SkillsActions({
|
/**
|
||||||
state,
|
* The orchestration skills row: a switch for whether they are installed, a gear that opens the
|
||||||
isWorking,
|
* skill picker, and Update when the installed skills fall behind the bundled ones. The caller
|
||||||
onReconcile,
|
* decides what the switch is bound to; the picker and Update always act on the host.
|
||||||
onInstall,
|
*/
|
||||||
onUninstall,
|
export function AgentSkillsRow({
|
||||||
|
skills,
|
||||||
|
value,
|
||||||
|
onValueChange,
|
||||||
|
disabled = false,
|
||||||
}: {
|
}: {
|
||||||
state: AgentSkillsStatus["state"] | null;
|
skills: AgentSkillsController;
|
||||||
isWorking: boolean;
|
value: boolean;
|
||||||
onReconcile: () => void;
|
onValueChange: (next: boolean) => void;
|
||||||
onInstall: () => void;
|
disabled?: boolean;
|
||||||
onUninstall: () => void;
|
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
if (state === "up-to-date") {
|
const { status, isWorking, reconcile, saveSelection } = skills;
|
||||||
return (
|
const [isChoosing, setIsChoosing] = useState(false);
|
||||||
<View style={styles.actionsRow}>
|
// Deleting a deselected skill is a choice made in the picker, not an update to offer here.
|
||||||
<View style={styles.installedLabel}>
|
const maintenanceOps = useMemo(
|
||||||
<ThemedCheck size={14} uniProps={mutedMapping} />
|
() => status?.ops.filter((op) => op.kind !== "delete") ?? [],
|
||||||
<Text style={styles.mutedText}>{t("settings.host.skills.actions.installed")}</Text>
|
[status?.ops],
|
||||||
</View>
|
);
|
||||||
<Button variant="outline" size="sm" onPress={onUninstall} disabled={isWorking}>
|
const needsUpdate = status?.state === "drift" && maintenanceOps.length > 0;
|
||||||
{t("settings.host.skills.actions.uninstall")}
|
|
||||||
</Button>
|
const handleUpdate = useCallback(async () => {
|
||||||
</View>
|
if (isWorking) return;
|
||||||
);
|
const confirmed = await confirmDialog({
|
||||||
}
|
title: t("settings.host.skills.updateTitle"),
|
||||||
if (state === "drift") {
|
message: formatUpdateMessage(maintenanceOps, t),
|
||||||
return (
|
confirmLabel: t("settings.host.skills.actions.update"),
|
||||||
<View style={styles.actionsRow}>
|
});
|
||||||
<Button variant="outline" size="sm" onPress={onReconcile} disabled={isWorking}>
|
if (confirmed) await reconcile();
|
||||||
{isWorking
|
}, [isWorking, maintenanceOps, reconcile, t]);
|
||||||
? t("settings.host.skills.actions.working")
|
const handleOpen = useCallback(() => setIsChoosing(true), []);
|
||||||
: t("settings.host.skills.actions.update")}
|
const handleClose = useCallback(() => setIsChoosing(false), []);
|
||||||
</Button>
|
const chooseIcon = useMemo(
|
||||||
<Button variant="outline" size="sm" onPress={onUninstall} disabled={isWorking}>
|
() => <ThemedSettings size={ICON_SIZE.sm} uniProps={mutedMapping} />,
|
||||||
{t("settings.host.skills.actions.uninstall")}
|
[],
|
||||||
</Button>
|
);
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<Button variant="outline" size="sm" onPress={onInstall} disabled={isWorking}>
|
<>
|
||||||
{isWorking
|
<SettingsRow
|
||||||
? t("settings.host.skills.actions.installing")
|
label={t("settings.host.skills.title")}
|
||||||
: t("settings.host.skills.actions.install")}
|
hint={
|
||||||
</Button>
|
needsUpdate
|
||||||
|
? t("settings.host.skills.updateAvailable")
|
||||||
|
: t("settings.host.skills.description")
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<View style={styles.controls}>
|
||||||
|
{needsUpdate ? (
|
||||||
|
<Button variant="outline" onPress={handleUpdate} disabled={disabled || isWorking}>
|
||||||
|
{isWorking
|
||||||
|
? t("settings.host.skills.actions.working")
|
||||||
|
: t("settings.host.skills.actions.update")}
|
||||||
|
</Button>
|
||||||
|
) : null}
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
leftIcon={chooseIcon}
|
||||||
|
onPress={handleOpen}
|
||||||
|
disabled={disabled || status === null || isWorking}
|
||||||
|
accessibilityLabel={t("settings.host.skills.choose")}
|
||||||
|
/>
|
||||||
|
<Switch
|
||||||
|
value={value}
|
||||||
|
onValueChange={onValueChange}
|
||||||
|
// Nothing picked means nothing to install; the gear is the way forward.
|
||||||
|
disabled={
|
||||||
|
disabled || status === null || isWorking || (!value && !hasSelectedSkills(status))
|
||||||
|
}
|
||||||
|
accessibilityLabel={t("settings.host.skills.title")}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</SettingsRow>
|
||||||
|
{status ? (
|
||||||
|
<SkillSelectionSheet
|
||||||
|
visible={isChoosing}
|
||||||
|
available={status.available}
|
||||||
|
selection={status.selection}
|
||||||
|
isSaving={isWorking}
|
||||||
|
onSave={saveSelection}
|
||||||
|
onClose={handleClose}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create((theme) => ({
|
const styles = StyleSheet.create((theme) => ({
|
||||||
rowTitleRow: { flexDirection: "row", alignItems: "center", gap: theme.spacing[2] },
|
controls: { flexDirection: "row", alignItems: "center", gap: theme.spacing[2] },
|
||||||
installedLabel: { flexDirection: "row", alignItems: "center", gap: 4 },
|
|
||||||
mutedText: { color: theme.colors.foregroundMuted, fontSize: theme.fontSize.sm },
|
mutedText: { color: theme.colors.foregroundMuted, fontSize: theme.fontSize.sm },
|
||||||
actionsRow: { flexDirection: "row", alignItems: "center", gap: theme.spacing[2] },
|
|
||||||
emptyCard: { padding: theme.spacing[4] },
|
emptyCard: { padding: theme.spacing[4] },
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -1,23 +1,18 @@
|
|||||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Pressable, Text, View } from "react-native";
|
import { Text, View } from "react-native";
|
||||||
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
import { StyleSheet } from "react-native-unistyles";
|
||||||
import { Check } from "lucide-react-native";
|
|
||||||
import { AdaptiveModalSheet, type SheetHeader } from "@/components/adaptive-modal-sheet";
|
import { AdaptiveModalSheet, type SheetHeader } from "@/components/adaptive-modal-sheet";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Switch } from "@/components/ui/switch";
|
import { Switch } from "@/components/ui/switch";
|
||||||
import { SettingsSection } from "@/components/settings/headings/settings-section";
|
import { SettingsCard, SettingsRow, SettingsSection } from "@/components/settings";
|
||||||
import { settingsStyles } from "@/styles/settings";
|
import { settingsStyles } from "@/styles/settings";
|
||||||
import type { Theme } from "@/styles/theme";
|
|
||||||
import { confirmDialog } from "@/utils/confirm-dialog";
|
import { confirmDialog } from "@/utils/confirm-dialog";
|
||||||
import type {
|
import type {
|
||||||
AgentSkillSelection as SkillSelection,
|
AgentSkillSelection as SkillSelection,
|
||||||
AgentSkillsSaveResult as SkillsSaveResult,
|
AgentSkillsSaveResult as SkillsSaveResult,
|
||||||
} from "@getpaseo/protocol/messages";
|
} from "@getpaseo/protocol/messages";
|
||||||
|
|
||||||
const ThemedCheck = withUnistyles(Check);
|
|
||||||
const checkedIconMapping = (theme: Theme) => ({ color: theme.colors.accentForeground });
|
|
||||||
|
|
||||||
interface SkillSelectionSheetProps {
|
interface SkillSelectionSheetProps {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
available: readonly string[];
|
available: readonly string[];
|
||||||
@@ -157,12 +152,11 @@ export function SkillSelectionSheet({
|
|||||||
footer={footer}
|
footer={footer}
|
||||||
testID="skill-selection-sheet"
|
testID="skill-selection-sheet"
|
||||||
>
|
>
|
||||||
<View style={settingsStyles.card} testID="skill-selection-all-card">
|
<SettingsCard testID="skill-selection-all-card">
|
||||||
<View style={settingsStyles.row}>
|
<SettingsRow
|
||||||
<View style={settingsStyles.rowContent}>
|
label={t("settings.host.skills.chooseAll")}
|
||||||
<Text style={settingsStyles.rowTitle}>{t("settings.host.skills.chooseAll")}</Text>
|
hint={t("settings.host.skills.chooseAllHint")}
|
||||||
<Text style={settingsStyles.rowHint}>{t("settings.host.skills.chooseAllHint")}</Text>
|
>
|
||||||
</View>
|
|
||||||
<Switch
|
<Switch
|
||||||
value={allSkills}
|
value={allSkills}
|
||||||
onValueChange={handleToggleAll}
|
onValueChange={handleToggleAll}
|
||||||
@@ -170,30 +164,29 @@ export function SkillSelectionSheet({
|
|||||||
accessibilityLabel={t("settings.host.skills.chooseAll")}
|
accessibilityLabel={t("settings.host.skills.chooseAll")}
|
||||||
testID="skill-selection-all"
|
testID="skill-selection-all"
|
||||||
/>
|
/>
|
||||||
</View>
|
</SettingsRow>
|
||||||
</View>
|
</SettingsCard>
|
||||||
|
|
||||||
{/* The sheet body already spaces its blocks apart, so the section owns
|
{/* The sheet body already spaces its blocks apart, so the section owns
|
||||||
only the gap between its label and the list the label names. */}
|
only the gap between its label and the list the label names. */}
|
||||||
<SettingsSection title={t("settings.host.skills.chooseList")} flush>
|
<SettingsSection title={t("settings.host.skills.chooseList")} flush>
|
||||||
<View style={settingsStyles.card} testID="skill-selection-list-card">
|
<SettingsCard testID="skill-selection-list-card">
|
||||||
{available.length === 0 ? (
|
{available.length === 0 ? (
|
||||||
<View style={settingsStyles.row}>
|
<View style={settingsStyles.row}>
|
||||||
<Text style={settingsStyles.rowHint}>{t("settings.host.skills.chooseEmpty")}</Text>
|
<Text style={settingsStyles.rowHint}>{t("settings.host.skills.chooseEmpty")}</Text>
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
available.map((name, index) => (
|
available.map((name) => (
|
||||||
<SkillCheckboxRow
|
<SkillRow
|
||||||
key={name}
|
key={name}
|
||||||
name={name}
|
name={name}
|
||||||
checked={isSkillSelected(draft, name)}
|
checked={isSkillSelected(draft, name)}
|
||||||
disabled={allSkills || isSaving}
|
disabled={allSkills || isSaving}
|
||||||
withBorder={index > 0}
|
|
||||||
onToggle={handleToggleSkill}
|
onToggle={handleToggleSkill}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
</View>
|
</SettingsCard>
|
||||||
</SettingsSection>
|
</SettingsSection>
|
||||||
|
|
||||||
{saveError ? <Text style={settingsStyles.rowError}>{saveError}</Text> : null}
|
{saveError ? <Text style={settingsStyles.rowError}>{saveError}</Text> : null}
|
||||||
@@ -201,52 +194,27 @@ export function SkillSelectionSheet({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SkillCheckboxRowProps {
|
function SkillRow({
|
||||||
name: string;
|
|
||||||
checked: boolean;
|
|
||||||
disabled: boolean;
|
|
||||||
withBorder: boolean;
|
|
||||||
onToggle: (name: string) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
function SkillCheckboxRow({
|
|
||||||
name,
|
name,
|
||||||
checked,
|
checked,
|
||||||
disabled,
|
disabled,
|
||||||
withBorder,
|
|
||||||
onToggle,
|
onToggle,
|
||||||
}: SkillCheckboxRowProps) {
|
}: {
|
||||||
const handlePress = useCallback(() => onToggle(name), [name, onToggle]);
|
name: string;
|
||||||
const accessibilityState = useMemo(() => ({ checked, disabled }), [checked, disabled]);
|
checked: boolean;
|
||||||
const rowStyle = useMemo(
|
disabled: boolean;
|
||||||
() => [
|
onToggle: (name: string) => void;
|
||||||
settingsStyles.row,
|
}) {
|
||||||
withBorder ? settingsStyles.rowBorder : null,
|
const handleValueChange = useCallback(() => onToggle(name), [name, onToggle]);
|
||||||
styles.checkboxRow,
|
|
||||||
disabled ? styles.disabledRow : null,
|
|
||||||
],
|
|
||||||
[disabled, withBorder],
|
|
||||||
);
|
|
||||||
const boxStyle = useMemo(
|
|
||||||
() => [styles.checkbox, checked ? styles.checkboxChecked : null],
|
|
||||||
[checked],
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<SettingsRow label={name}>
|
||||||
style={rowStyle}
|
<Switch
|
||||||
onPress={handlePress}
|
value={checked}
|
||||||
disabled={disabled}
|
onValueChange={handleValueChange}
|
||||||
accessibilityRole="checkbox"
|
disabled={disabled}
|
||||||
accessibilityLabel={name}
|
accessibilityLabel={name}
|
||||||
accessibilityState={accessibilityState}
|
/>
|
||||||
aria-checked={checked}
|
</SettingsRow>
|
||||||
>
|
|
||||||
<View style={boxStyle}>
|
|
||||||
{checked ? <ThemedCheck size={14} uniProps={checkedIconMapping} /> : null}
|
|
||||||
</View>
|
|
||||||
<Text style={settingsStyles.rowTitle}>{name}</Text>
|
|
||||||
</Pressable>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,24 +227,4 @@ const styles = StyleSheet.create((theme) => ({
|
|||||||
footerButton: {
|
footerButton: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
},
|
},
|
||||||
checkboxRow: {
|
|
||||||
justifyContent: "flex-start",
|
|
||||||
gap: theme.spacing[3],
|
|
||||||
},
|
|
||||||
disabledRow: {
|
|
||||||
opacity: theme.opacity[50],
|
|
||||||
},
|
|
||||||
checkbox: {
|
|
||||||
width: 22,
|
|
||||||
height: 22,
|
|
||||||
borderRadius: theme.borderRadius.sm,
|
|
||||||
borderWidth: 1,
|
|
||||||
borderColor: theme.colors.border,
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "center",
|
|
||||||
},
|
|
||||||
checkboxChecked: {
|
|
||||||
backgroundColor: theme.colors.accent,
|
|
||||||
borderColor: theme.colors.accent,
|
|
||||||
},
|
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ import { useToast } from "@/contexts/toast-context";
|
|||||||
import { useFetchQuery } from "@/data/query";
|
import { useFetchQuery } from "@/data/query";
|
||||||
import { useHostFeature } from "@/runtime/host-features";
|
import { useHostFeature } from "@/runtime/host-features";
|
||||||
import { useHostRuntimeClient, useHostRuntimeIsConnected } from "@/runtime/host-runtime";
|
import { useHostRuntimeClient, useHostRuntimeIsConnected } from "@/runtime/host-runtime";
|
||||||
|
import { confirmDialog } from "@/utils/confirm-dialog";
|
||||||
|
|
||||||
|
export type AgentSkillsController = ReturnType<typeof useAgentSkills>;
|
||||||
|
|
||||||
export function useAgentSkills(serverId: string) {
|
export function useAgentSkills(serverId: string) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -83,12 +86,30 @@ export function useAgentSkills(serverId: string) {
|
|||||||
const refresh = useCallback(async () => {
|
const refresh = useCallback(async () => {
|
||||||
await refetch();
|
await refetch();
|
||||||
}, [refetch]);
|
}, [refetch]);
|
||||||
const runReconcile = useCallback(async () => {
|
// Both resolve to whether the host ended in the asked-for state; failures are already toasted.
|
||||||
await reconcileAsync().catch(() => undefined);
|
const runReconcile = useCallback(
|
||||||
}, [reconcileAsync]);
|
() =>
|
||||||
|
reconcileAsync().then(
|
||||||
|
(status) => status.state !== "not-installed",
|
||||||
|
() => false,
|
||||||
|
),
|
||||||
|
[reconcileAsync],
|
||||||
|
);
|
||||||
|
// Uninstalling deletes whole skill folders, including anything the user added inside them, so
|
||||||
|
// it always asks first. Declining resolves false, as a failure does.
|
||||||
const runUninstall = useCallback(async () => {
|
const runUninstall = useCallback(async () => {
|
||||||
await uninstallAsync().catch(() => undefined);
|
const confirmed = await confirmDialog({
|
||||||
}, [uninstallAsync]);
|
title: t("settings.host.skills.uninstallTitle"),
|
||||||
|
message: t("settings.host.skills.uninstallMessage"),
|
||||||
|
confirmLabel: t("settings.host.skills.actions.uninstall"),
|
||||||
|
destructive: true,
|
||||||
|
});
|
||||||
|
if (!confirmed) return false;
|
||||||
|
return uninstallAsync().then(
|
||||||
|
(status) => status.state === "not-installed",
|
||||||
|
() => false,
|
||||||
|
);
|
||||||
|
}, [t, uninstallAsync]);
|
||||||
const saveSelection = useCallback(
|
const saveSelection = useCallback(
|
||||||
(selection: AgentSkillSelection, confirmedRemovals: readonly string[] = []) =>
|
(selection: AgentSkillSelection, confirmedRemovals: readonly string[] = []) =>
|
||||||
saveAsync({ selection, confirmedRemovals }),
|
saveAsync({ selection, confirmedRemovals }),
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { PaneFind, findShortcutPlatform, isFindShortcut, type PaneFindHandle } f
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { usePaneFocus } from "@/panels/pane-context";
|
import { usePaneFocus } from "@/panels/pane-context";
|
||||||
import { useRetainedPanelActive } from "@/components/retained-panel";
|
import { useRetainedPanelActive } from "@/components/retained-panel";
|
||||||
import { hasActiveWebOverlay } from "@/lib/overlay-root";
|
import { hasActiveOverlay } from "@/keyboard";
|
||||||
import { isImeComposingKeyboardEvent } from "@/utils/keyboard-ime";
|
import { isImeComposingKeyboardEvent } from "@/utils/keyboard-ime";
|
||||||
import { getHostRuntimeStore } from "@/runtime/host-runtime";
|
import { getHostRuntimeStore } from "@/runtime/host-runtime";
|
||||||
import { planTimelinePromptJump } from "@/timeline/timeline-sync-plan";
|
import { planTimelinePromptJump } from "@/timeline/timeline-sync-plan";
|
||||||
@@ -104,7 +104,7 @@ export function ChatFind({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!active || !isInteractive) return;
|
if (!active || !isInteractive) return;
|
||||||
const onKeyDown = (event: KeyboardEvent) => {
|
const onKeyDown = (event: KeyboardEvent) => {
|
||||||
if (event.defaultPrevented || hasActiveWebOverlay() || isImeComposingKeyboardEvent(event))
|
if (event.defaultPrevented || hasActiveOverlay() || isImeComposingKeyboardEvent(event))
|
||||||
return;
|
return;
|
||||||
if (isFindShortcut(event, findShortcutPlatform())) {
|
if (isFindShortcut(event, findShortcutPlatform())) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -147,7 +147,7 @@ export function ChatFind({
|
|||||||
{state.failure && (
|
{state.failure && (
|
||||||
<View style={styles.error}>
|
<View style={styles.error}>
|
||||||
<Text style={styles.errorText}>{t(FAILURE_TEXT[state.failure])}</Text>
|
<Text style={styles.errorText}>{t(FAILURE_TEXT[state.failure])}</Text>
|
||||||
<Button size="xs" variant="ghost" onPress={model.retry}>
|
<Button size="sm" variant="ghost" onPress={model.retry}>
|
||||||
{t("paneFind.retry")}
|
{t("paneFind.retry")}
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ function installProbe(
|
|||||||
queryClient: new QueryClient(),
|
queryClient: new QueryClient(),
|
||||||
paseo: {} as InstalledPlugin["paseo"],
|
paseo: {} as InstalledPlugin["paseo"],
|
||||||
invoke: async () => undefined,
|
invoke: async () => undefined,
|
||||||
|
subscribe: () => {
|
||||||
|
throw new Error("Subscriptions are not used here");
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { useHardwareKeyboardPresent } from "@/keyboard";
|
||||||
|
import { AddHostProvider, AddHostFlowHost } from "@/hosts/add-host";
|
||||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||||
import { useActiveWorkspaceSelection } from "@/stores/navigation-active-workspace-store";
|
import { useActiveWorkspaceSelection } from "@/stores/navigation-active-workspace-store";
|
||||||
import { useIsExplorerSidebarOpen } from "@/workspace-tabs/explorer-sidebar";
|
import { useIsExplorerSidebarOpen } from "@/workspace-tabs/explorer-sidebar";
|
||||||
@@ -35,6 +37,7 @@ import { DownloadToast } from "@/components/download-toast";
|
|||||||
import { QuittingOverlay } from "@/components/quitting-overlay";
|
import { QuittingOverlay } from "@/components/quitting-overlay";
|
||||||
import { KeyboardShortcutsDialog } from "@/components/keyboard-shortcuts-dialog";
|
import { KeyboardShortcutsDialog } from "@/components/keyboard-shortcuts-dialog";
|
||||||
import { ChangelogHost } from "@/changelog";
|
import { ChangelogHost } from "@/changelog";
|
||||||
|
import { OnboardingHost } from "@/onboarding";
|
||||||
import { AppDiagnosticHost } from "@/components/app-diagnostic-host";
|
import { AppDiagnosticHost } from "@/components/app-diagnostic-host";
|
||||||
import { AppearanceStyleBoundary } from "@/components/appearance-style-boundary";
|
import { AppearanceStyleBoundary } from "@/components/appearance-style-boundary";
|
||||||
import { LeftSidebar } from "@/components/left-sidebar";
|
import { LeftSidebar } from "@/components/left-sidebar";
|
||||||
@@ -88,7 +91,7 @@ import { useActiveWorktreeNewAction } from "@/hooks/use-active-worktree-new-acti
|
|||||||
import { useGlobalNewWorkspaceAction } from "@/hooks/use-global-new-workspace-action";
|
import { useGlobalNewWorkspaceAction } from "@/hooks/use-global-new-workspace-action";
|
||||||
import { useLatchedBoolean } from "@/hooks/use-latched-boolean";
|
import { useLatchedBoolean } from "@/hooks/use-latched-boolean";
|
||||||
import { useFaviconStatus } from "@/hooks/use-favicon-status";
|
import { useFaviconStatus } from "@/hooks/use-favicon-status";
|
||||||
import { useKeyboardShortcuts } from "@/hooks/use-keyboard-shortcuts";
|
import { useKeyboardShortcuts } from "@/keyboard/use-shortcuts";
|
||||||
import { KeyboardShiftProvider } from "@/keyboard/shift";
|
import { KeyboardShiftProvider } from "@/keyboard/shift";
|
||||||
import { useCompactWebViewportZoomLock } from "@/hooks/use-compact-web-viewport-zoom-lock";
|
import { useCompactWebViewportZoomLock } from "@/hooks/use-compact-web-viewport-zoom-lock";
|
||||||
import { useOpenProject } from "@/hooks/use-open-project";
|
import { useOpenProject } from "@/hooks/use-open-project";
|
||||||
@@ -465,6 +468,7 @@ function AppContainer({ children, chromeEnabled: chromeEnabledOverride }: AppCon
|
|||||||
const surface = (
|
const surface = (
|
||||||
<View style={layoutStyles.surfaceFill}>
|
<View style={layoutStyles.surfaceFill}>
|
||||||
{workspaceChrome}
|
{workspaceChrome}
|
||||||
|
<AddHostFlowHost />
|
||||||
<AppearanceStyleBoundary>
|
<AppearanceStyleBoundary>
|
||||||
{!isCompactLayout && appChromeLayout.sidebarToggleOwner === "window" ? (
|
{!isCompactLayout && appChromeLayout.sidebarToggleOwner === "window" ? (
|
||||||
<WindowChromeRegion corners="top-left">
|
<WindowChromeRegion corners="top-left">
|
||||||
@@ -494,6 +498,7 @@ function AppContainer({ children, chromeEnabled: chromeEnabledOverride }: AppCon
|
|||||||
<WorkspacePinShortcutHandler />
|
<WorkspacePinShortcutHandler />
|
||||||
<WorkspaceRenameHost />
|
<WorkspaceRenameHost />
|
||||||
<CommandCenter />
|
<CommandCenter />
|
||||||
|
<OnboardingHost />
|
||||||
<AddProjectFlowHost />
|
<AddProjectFlowHost />
|
||||||
<HostChooserModal />
|
<HostChooserModal />
|
||||||
<HostConfirmationSheet />
|
<HostConfirmationSheet />
|
||||||
@@ -545,8 +550,12 @@ function SidebarChrome({
|
|||||||
const isMobileActive = useIsMobilePanelActive("agent-list");
|
const isMobileActive = useIsMobilePanelActive("agent-list");
|
||||||
const isDesktopOpen = usePanelStore((state) => state.desktop.agentListOpen);
|
const isDesktopOpen = usePanelStore((state) => state.desktop.agentListOpen);
|
||||||
const active = visible && (isCompactLayout ? isMobileActive : isDesktopOpen);
|
const active = visible && (isCompactLayout ? isMobileActive : isDesktopOpen);
|
||||||
|
const hardwareKeyboardPresent = useHardwareKeyboardPresent();
|
||||||
return (
|
return (
|
||||||
<SidebarModelProvider active={active}>
|
<SidebarModelProvider
|
||||||
|
active={active}
|
||||||
|
keyboardNavigationActive={keyboardShortcutsEnabled && hardwareKeyboardPresent}
|
||||||
|
>
|
||||||
{mounted ? <LeftSidebar active={active} /> : null}
|
{mounted ? <LeftSidebar active={active} /> : null}
|
||||||
<WorkspaceShortcutTargetsSubscriber enabled={keyboardShortcutsEnabled} />
|
<WorkspaceShortcutTargetsSubscriber enabled={keyboardShortcutsEnabled} />
|
||||||
</SidebarModelProvider>
|
</SidebarModelProvider>
|
||||||
@@ -805,7 +814,6 @@ function RootStack() {
|
|||||||
<Stack.Screen name="open-project" />
|
<Stack.Screen name="open-project" />
|
||||||
<Stack.Screen name="sessions" />
|
<Stack.Screen name="sessions" />
|
||||||
<Stack.Screen name="schedules" />
|
<Stack.Screen name="schedules" />
|
||||||
<Stack.Screen name="pair-scan" />
|
|
||||||
</Stack.Protected>
|
</Stack.Protected>
|
||||||
<Stack.Screen name="h/[serverId]" />
|
<Stack.Screen name="h/[serverId]" />
|
||||||
<Stack.Screen name="settings/hosts/[serverId]/index" />
|
<Stack.Screen name="settings/hosts/[serverId]/index" />
|
||||||
@@ -890,11 +898,13 @@ function RootAppTree() {
|
|||||||
<GestureHandlerRootView style={flexStyle}>
|
<GestureHandlerRootView style={flexStyle}>
|
||||||
<View style={layoutStyles.surfaceFill}>
|
<View style={layoutStyles.surfaceFill}>
|
||||||
<LucideProvider strokeWidth={ICON_STROKE_WIDTH}>
|
<LucideProvider strokeWidth={ICON_STROKE_WIDTH}>
|
||||||
<RootProviders>
|
<AddHostProvider>
|
||||||
<RuntimeProviders>
|
<RootProviders>
|
||||||
<AppShell />
|
<RuntimeProviders>
|
||||||
</RuntimeProviders>
|
<AppShell />
|
||||||
</RootProviders>
|
</RuntimeProviders>
|
||||||
|
</RootProviders>
|
||||||
|
</AddHostProvider>
|
||||||
</LucideProvider>
|
</LucideProvider>
|
||||||
</View>
|
</View>
|
||||||
</GestureHandlerRootView>
|
</GestureHandlerRootView>
|
||||||
|
|||||||
@@ -35,10 +35,9 @@ function SettingsDaemonRedirect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function SettingsSectionRoute() {
|
export default function SettingsSectionRoute() {
|
||||||
const params = useLocalSearchParams<{ section?: string; addHost?: string }>();
|
const params = useLocalSearchParams<{ section?: string }>();
|
||||||
const rawSection = typeof params.section === "string" ? params.section : "";
|
const rawSection = typeof params.section === "string" ? params.section : "";
|
||||||
const section: SettingsSectionSlug = isSettingsSectionSlug(rawSection) ? rawSection : "general";
|
const section: SettingsSectionSlug = isSettingsSectionSlug(rawSection) ? rawSection : "general";
|
||||||
const openAddHostIntent = typeof params.addHost === "string" ? params.addHost : null;
|
|
||||||
const view = useMemo(() => ({ kind: "section" as const, section }), [section]);
|
const view = useMemo(() => ({ kind: "section" as const, section }), [section]);
|
||||||
|
|
||||||
// COMPAT(settingsDaemonRedirect): added 2026-07-08, remove after 2027-01-08.
|
// COMPAT(settingsDaemonRedirect): added 2026-07-08, remove after 2027-01-08.
|
||||||
@@ -50,5 +49,5 @@ export default function SettingsSectionRoute() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return <SettingsScreen view={view} openAddHostIntent={openAddHostIntent} />;
|
return <SettingsScreen view={view} />;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,292 @@
|
|||||||
|
import { useCallback, useMemo } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { Text, View, type PressableStateCallbackType } from "react-native";
|
||||||
|
import { StyleSheet } from "react-native-unistyles";
|
||||||
|
import { PressHighlight } from "@/components/ui/press-highlight";
|
||||||
|
import { DEFAULT_THEME_PREFERENCE, useAppSettings, type AppSettings } from "@/hooks/use-settings";
|
||||||
|
import type { PluginThemeOption } from "@/plugins/themes";
|
||||||
|
import {
|
||||||
|
THEME_OPTIONS,
|
||||||
|
PLUGIN_THEME_PREFERENCE,
|
||||||
|
darkTheme,
|
||||||
|
lightTheme,
|
||||||
|
type Theme,
|
||||||
|
} from "@/styles/theme";
|
||||||
|
import { useContributedThemes } from "./provider";
|
||||||
|
|
||||||
|
type BuiltInThemePreference = Exclude<AppSettings["theme"], typeof PLUGIN_THEME_PREFERENCE>;
|
||||||
|
|
||||||
|
// System leads the grid because it is the default.
|
||||||
|
const PICKER_THEME_OPTIONS = [
|
||||||
|
...THEME_OPTIONS.filter((option) => option.name === "auto"),
|
||||||
|
...THEME_OPTIONS.filter((option) => option.name !== "auto"),
|
||||||
|
];
|
||||||
|
|
||||||
|
const PREVIEW_ASPECT_RATIO = 16 / 9;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Every theme as a tile with a small preview drawn from its own tokens. Picking a tile applies
|
||||||
|
* the theme to the whole app at once. Settings → Appearance and first-run setup share it.
|
||||||
|
*/
|
||||||
|
export function ThemePicker() {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const { settings, updateSettings } = useAppSettings();
|
||||||
|
const { options: pluginThemes, selected: selectedPluginTheme, select } = useContributedThemes();
|
||||||
|
// A selected contribution that is no longer installed shows the fallback the app renders.
|
||||||
|
const builtInValue =
|
||||||
|
settings.theme === PLUGIN_THEME_PREFERENCE ? DEFAULT_THEME_PREFERENCE : settings.theme;
|
||||||
|
|
||||||
|
const selectBuiltIn = useCallback(
|
||||||
|
(theme: BuiltInThemePreference) => {
|
||||||
|
void updateSettings({ theme });
|
||||||
|
},
|
||||||
|
[updateSettings],
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
style={styles.grid}
|
||||||
|
accessibilityRole="radiogroup"
|
||||||
|
accessibilityLabel={t("settings.appearance.theme.title")}
|
||||||
|
>
|
||||||
|
{PICKER_THEME_OPTIONS.map((option) => (
|
||||||
|
<BuiltInThemeTile
|
||||||
|
key={option.name}
|
||||||
|
value={option.name}
|
||||||
|
selected={selectedPluginTheme === null && builtInValue === option.name}
|
||||||
|
onSelect={selectBuiltIn}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
{pluginThemes.map((option) => (
|
||||||
|
<PluginThemeTile
|
||||||
|
key={option.id}
|
||||||
|
option={option}
|
||||||
|
selected={selectedPluginTheme?.id === option.id}
|
||||||
|
onSelect={select}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function BuiltInThemeTile({
|
||||||
|
value,
|
||||||
|
selected,
|
||||||
|
onSelect,
|
||||||
|
}: {
|
||||||
|
value: BuiltInThemePreference;
|
||||||
|
selected: boolean;
|
||||||
|
onSelect: (value: BuiltInThemePreference) => void;
|
||||||
|
}) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const handlePress = useCallback(() => onSelect(value), [onSelect, value]);
|
||||||
|
const option = THEME_OPTIONS.find((candidate) => candidate.name === value);
|
||||||
|
return (
|
||||||
|
<ThemeTile
|
||||||
|
label={t(`settings.appearance.theme.options.${value}`)}
|
||||||
|
selected={selected}
|
||||||
|
onPress={handlePress}
|
||||||
|
previewTheme={option && "theme" in option ? option.theme : "system"}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function PluginThemeTile({
|
||||||
|
option,
|
||||||
|
selected,
|
||||||
|
onSelect,
|
||||||
|
}: {
|
||||||
|
option: PluginThemeOption;
|
||||||
|
selected: boolean;
|
||||||
|
onSelect: (option: PluginThemeOption) => void;
|
||||||
|
}) {
|
||||||
|
const handlePress = useCallback(() => onSelect(option), [onSelect, option]);
|
||||||
|
return (
|
||||||
|
<ThemeTile
|
||||||
|
label={option.name}
|
||||||
|
selected={selected}
|
||||||
|
onPress={handlePress}
|
||||||
|
previewTheme={option.theme}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ThemeTile({
|
||||||
|
label,
|
||||||
|
selected,
|
||||||
|
onPress,
|
||||||
|
previewTheme,
|
||||||
|
}: {
|
||||||
|
label: string;
|
||||||
|
selected: boolean;
|
||||||
|
onPress: () => void;
|
||||||
|
/** "system" follows the OS, so its preview shows both halves. */
|
||||||
|
previewTheme: Theme | "system";
|
||||||
|
}) {
|
||||||
|
const accessibilityState = useMemo(() => ({ checked: selected }), [selected]);
|
||||||
|
const tileStyle = useCallback(
|
||||||
|
({ hovered }: PressableStateCallbackType & { hovered?: boolean }) => [
|
||||||
|
styles.tile,
|
||||||
|
hovered && !selected && styles.tileHovered,
|
||||||
|
selected && styles.tileSelected,
|
||||||
|
],
|
||||||
|
[selected],
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<View style={styles.cell}>
|
||||||
|
<PressHighlight
|
||||||
|
style={tileStyle}
|
||||||
|
onPress={onPress}
|
||||||
|
accessibilityRole="radio"
|
||||||
|
accessibilityLabel={label}
|
||||||
|
accessibilityState={accessibilityState}
|
||||||
|
aria-checked={selected}
|
||||||
|
>
|
||||||
|
<View style={styles.previewFrame}>
|
||||||
|
{previewTheme === "system" ? (
|
||||||
|
<SystemThemePreview />
|
||||||
|
) : (
|
||||||
|
<ThemePreview theme={previewTheme} />
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
<Text style={styles.label} numberOfLines={1}>
|
||||||
|
{label}
|
||||||
|
</Text>
|
||||||
|
</PressHighlight>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A sketch of the app — sidebar, a few lines of text and an accent bubble — in `theme`'s colors. */
|
||||||
|
function ThemePreview({ theme }: { theme: Theme }) {
|
||||||
|
const colors = theme.colors;
|
||||||
|
const previewStyles = useMemo(
|
||||||
|
() => ({
|
||||||
|
root: [styles.preview, { backgroundColor: colors.surface0 }],
|
||||||
|
sidebar: [styles.previewSidebar, { backgroundColor: colors.surfaceSidebar }],
|
||||||
|
mutedLine: { backgroundColor: colors.foregroundMuted },
|
||||||
|
strongLine: { backgroundColor: colors.foreground },
|
||||||
|
bubble: [styles.previewBubble, { backgroundColor: colors.accent }],
|
||||||
|
}),
|
||||||
|
[colors],
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<View style={previewStyles.root}>
|
||||||
|
<View style={previewStyles.sidebar}>
|
||||||
|
<View style={[styles.previewLine, styles.sidebarLineWide, previewStyles.mutedLine]} />
|
||||||
|
<View style={[styles.previewLine, styles.sidebarLineNarrow, previewStyles.mutedLine]} />
|
||||||
|
<View style={[styles.previewLine, styles.sidebarLineMedium, previewStyles.mutedLine]} />
|
||||||
|
</View>
|
||||||
|
<View style={styles.previewMain}>
|
||||||
|
<View style={[styles.previewTitle, previewStyles.strongLine]} />
|
||||||
|
<View style={[styles.previewLine, styles.mainLineWide, previewStyles.mutedLine]} />
|
||||||
|
<View style={[styles.previewLine, styles.mainLineNarrow, previewStyles.mutedLine]} />
|
||||||
|
<View style={previewStyles.bubble} />
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** "System" follows the OS: light on the left half, dark on the right. */
|
||||||
|
function SystemThemePreview() {
|
||||||
|
return (
|
||||||
|
<View style={styles.preview}>
|
||||||
|
<ThemePreview theme={lightTheme} />
|
||||||
|
<View style={styles.systemDarkHalf}>
|
||||||
|
<View style={styles.systemDarkOffset}>
|
||||||
|
<ThemePreview theme={darkTheme} />
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create((theme) => ({
|
||||||
|
// Columns fill the row: each cell is a fixed fraction of it, and the half-gap padding on every
|
||||||
|
// cell plus the negative margin here leaves exactly one gap between neighbors.
|
||||||
|
grid: {
|
||||||
|
flexDirection: "row",
|
||||||
|
flexWrap: "wrap",
|
||||||
|
margin: -theme.spacing[3] / 2,
|
||||||
|
},
|
||||||
|
cell: {
|
||||||
|
width: { xs: "50%", md: "25%" },
|
||||||
|
padding: theme.spacing[3] / 2,
|
||||||
|
},
|
||||||
|
tile: {
|
||||||
|
padding: theme.spacing[1],
|
||||||
|
gap: theme.spacing[1],
|
||||||
|
borderRadius: theme.borderRadius.lg,
|
||||||
|
borderWidth: theme.borderWidth[2],
|
||||||
|
borderColor: "transparent",
|
||||||
|
},
|
||||||
|
tileHovered: {
|
||||||
|
backgroundColor: theme.colors.surface2,
|
||||||
|
},
|
||||||
|
tileSelected: {
|
||||||
|
borderColor: theme.colors.accent,
|
||||||
|
},
|
||||||
|
previewFrame: {
|
||||||
|
borderRadius: theme.borderRadius.md,
|
||||||
|
borderWidth: theme.borderWidth[1],
|
||||||
|
borderColor: theme.colors.border,
|
||||||
|
overflow: "hidden",
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
color: theme.colors.foreground,
|
||||||
|
fontSize: theme.fontSize.sm,
|
||||||
|
paddingHorizontal: theme.spacing[1],
|
||||||
|
},
|
||||||
|
preview: {
|
||||||
|
width: "100%",
|
||||||
|
aspectRatio: PREVIEW_ASPECT_RATIO,
|
||||||
|
flexDirection: "row",
|
||||||
|
overflow: "hidden",
|
||||||
|
},
|
||||||
|
previewSidebar: {
|
||||||
|
width: 36,
|
||||||
|
paddingHorizontal: 6,
|
||||||
|
paddingVertical: 8,
|
||||||
|
gap: 5,
|
||||||
|
},
|
||||||
|
previewMain: {
|
||||||
|
flex: 1,
|
||||||
|
padding: 8,
|
||||||
|
gap: 5,
|
||||||
|
},
|
||||||
|
previewLine: {
|
||||||
|
height: 4,
|
||||||
|
borderRadius: 2,
|
||||||
|
opacity: 0.6,
|
||||||
|
},
|
||||||
|
previewTitle: {
|
||||||
|
width: "55%",
|
||||||
|
height: 5,
|
||||||
|
borderRadius: 2,
|
||||||
|
},
|
||||||
|
sidebarLineWide: { width: "100%" },
|
||||||
|
sidebarLineNarrow: { width: "60%" },
|
||||||
|
sidebarLineMedium: { width: "80%" },
|
||||||
|
mainLineWide: { width: "90%" },
|
||||||
|
mainLineNarrow: { width: "65%" },
|
||||||
|
previewBubble: {
|
||||||
|
marginTop: "auto",
|
||||||
|
alignSelf: "flex-end",
|
||||||
|
width: "45%",
|
||||||
|
height: 10,
|
||||||
|
borderRadius: 5,
|
||||||
|
},
|
||||||
|
systemDarkHalf: {
|
||||||
|
position: "absolute",
|
||||||
|
top: 0,
|
||||||
|
bottom: 0,
|
||||||
|
left: "50%",
|
||||||
|
width: "50%",
|
||||||
|
overflow: "hidden",
|
||||||
|
},
|
||||||
|
// A full-width dark preview shifted left by half, so only its right half shows.
|
||||||
|
systemDarkOffset: {
|
||||||
|
width: "200%",
|
||||||
|
marginLeft: "-100%",
|
||||||
|
},
|
||||||
|
}));
|
||||||
@@ -118,7 +118,7 @@ function ChangelogBody({ state, shownReleases, onShowMore, onRetry }: ChangelogB
|
|||||||
description={t("changelog.error.description")}
|
description={t("changelog.error.description")}
|
||||||
testID="changelog-error"
|
testID="changelog-error"
|
||||||
>
|
>
|
||||||
<Button variant="outline" size="sm" onPress={onRetry} testID="changelog-retry">
|
<Button variant="outline" onPress={onRetry} testID="changelog-retry">
|
||||||
{t("common.actions.retry")}
|
{t("common.actions.retry")}
|
||||||
</Button>
|
</Button>
|
||||||
</Alert>
|
</Alert>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { useOverlayRegistration, type KeyboardInputEvent } from "@/keyboard";
|
||||||
import { Modal } from "@/components/ui/modal";
|
import { Modal } from "@/components/ui/modal";
|
||||||
import equal from "fast-deep-equal";
|
import equal from "fast-deep-equal";
|
||||||
import { recordRenderProfileReasons } from "@/utils/render-profiler";
|
import { recordRenderProfileReasons } from "@/utils/render-profiler";
|
||||||
@@ -52,11 +53,7 @@ import { useProjects } from "@/hooks/use-projects";
|
|||||||
import { useTimeAgo } from "@/hooks/use-time-ago";
|
import { useTimeAgo } from "@/hooks/use-time-ago";
|
||||||
import { createProjectIconTarget } from "@/projects/icon-target";
|
import { createProjectIconTarget } from "@/projects/icon-target";
|
||||||
import { useProjectIcons } from "@/projects/icons";
|
import { useProjectIcons } from "@/projects/icons";
|
||||||
import {
|
import { OverlayLayerProvider, useGlobalOverlayLayer } from "@/lib/overlay-root";
|
||||||
OverlayLayerProvider,
|
|
||||||
useGlobalWebOverlayLayer,
|
|
||||||
useWebOverlayRegistration,
|
|
||||||
} from "@/lib/overlay-root";
|
|
||||||
import { useHosts } from "@/runtime/host-runtime";
|
import { useHosts } from "@/runtime/host-runtime";
|
||||||
import {
|
import {
|
||||||
useKeyboardShortcutsStore,
|
useKeyboardShortcutsStore,
|
||||||
@@ -763,6 +760,10 @@ function SectionRow({ row }: { row: Extract<CommandCenterListRow, { kind: "secti
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Escape arrives without asking; it is registered for `agent.interrupt` anyway.
|
||||||
|
// Backspace stays off deliberately — the palette pops its scope with it on web,
|
||||||
|
// but a registered command would stop the search field deleting text.
|
||||||
|
|
||||||
export function CommandCenter() {
|
export function CommandCenter() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const isCompact = useIsCompactFormFactor();
|
const isCompact = useIsCompactFormFactor();
|
||||||
@@ -780,7 +781,7 @@ export function CommandCenter() {
|
|||||||
interaction,
|
interaction,
|
||||||
);
|
);
|
||||||
const showBottomSheet = isCompact && isNative;
|
const showBottomSheet = isCompact && isNative;
|
||||||
const modalLayer = useGlobalWebOverlayLayer("modal", isWeb && state.open && !showBottomSheet);
|
const modalLayer = useGlobalOverlayLayer("modal", state.open);
|
||||||
const { sheetRef, handleSheetChange, handleSheetDismiss } = useIsolatedBottomSheetVisibility({
|
const { sheetRef, handleSheetChange, handleSheetDismiss } = useIsolatedBottomSheetVisibility({
|
||||||
visible: state.open,
|
visible: state.open,
|
||||||
isEnabled: showBottomSheet,
|
isEnabled: showBottomSheet,
|
||||||
@@ -874,23 +875,20 @@ export function CommandCenter() {
|
|||||||
: {}),
|
: {}),
|
||||||
scrollEventThrottle: 16,
|
scrollEventThrottle: 16,
|
||||||
};
|
};
|
||||||
const keyPress = useCallback(
|
|
||||||
({ nativeEvent: { key } }: { nativeEvent: { key: string } }) => state.key(key),
|
|
||||||
[state],
|
|
||||||
);
|
|
||||||
const submit = useCallback(() => state.key("Enter"), [state]);
|
const submit = useCallback(() => state.key("Enter"), [state]);
|
||||||
const handleWebOverlayKeyDown = useCallback(
|
const handleOverlayKeyDown = useCallback(
|
||||||
(event: KeyboardEvent) => {
|
(event: KeyboardInputEvent) => {
|
||||||
if (!state.key(event.key)) return false;
|
if (!state.key(event.key)) return false;
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
[state],
|
[state],
|
||||||
);
|
);
|
||||||
const setWebOverlayScope = useWebOverlayRegistration({
|
const setOverlayScope = useOverlayRegistration({
|
||||||
active: isWeb && state.open && !showBottomSheet,
|
keys: ["Escape", "Enter", "ArrowUp", "ArrowDown"],
|
||||||
|
active: state.open,
|
||||||
layer: modalLayer,
|
layer: modalLayer,
|
||||||
onKeyDown: handleWebOverlayKeyDown,
|
onKeyDown: handleOverlayKeyDown,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (showBottomSheet) {
|
if (showBottomSheet) {
|
||||||
@@ -911,45 +909,46 @@ export function CommandCenter() {
|
|||||||
keyboardBlurBehavior="restore"
|
keyboardBlurBehavior="restore"
|
||||||
accessible={false}
|
accessible={false}
|
||||||
>
|
>
|
||||||
<View style={[styles.bottomSheetHeader, styles.searchRow]} testID="command-center-header">
|
<OverlayLayerProvider layer={modalLayer}>
|
||||||
{state.scope === "files" ? (
|
<View style={[styles.bottomSheetHeader, styles.searchRow]} testID="command-center-header">
|
||||||
<ScopeChip label={t("shell.commandCenter.files")} onRemove={state.clearScope} />
|
{state.scope === "files" ? (
|
||||||
) : null}
|
<ScopeChip label={t("shell.commandCenter.files")} onRemove={state.clearScope} />
|
||||||
<ThemedBottomSheetTextInput
|
) : null}
|
||||||
testID="command-center-input"
|
<ThemedBottomSheetTextInput
|
||||||
ref={bottomSheetInputRef}
|
testID="command-center-input"
|
||||||
initialValue={state.query}
|
ref={bottomSheetInputRef}
|
||||||
variant="bottom-sheet"
|
initialValue={state.query}
|
||||||
onChangeText={state.setQuery}
|
variant="bottom-sheet"
|
||||||
onKeyPress={keyPress}
|
onChangeText={state.setQuery}
|
||||||
onSubmitEditing={submit}
|
onSubmitEditing={submit}
|
||||||
placeholder={
|
placeholder={
|
||||||
state.scope === "files"
|
state.scope === "files"
|
||||||
? t("shell.commandCenter.filePlaceholder")
|
? t("shell.commandCenter.filePlaceholder")
|
||||||
: t("shell.commandCenter.placeholder")
|
: t("shell.commandCenter.placeholder")
|
||||||
}
|
}
|
||||||
style={[styles.input, styles.growingInput]}
|
style={[styles.input, styles.growingInput]}
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
autoFocus
|
autoFocus
|
||||||
/>
|
/>
|
||||||
<FileSearchLoadingIndicator
|
<FileSearchLoadingIndicator
|
||||||
loading={state.fileSearchLoading}
|
loading={state.fileSearchLoading}
|
||||||
label={t("shell.commandCenter.searchingFiles")}
|
label={t("shell.commandCenter.searchingFiles")}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
{fileSearchError}
|
{fileSearchError}
|
||||||
<BottomSheetFlatList ref={bottomSheetListRef} {...commonListProps} />
|
<BottomSheetFlatList ref={bottomSheetListRef} {...commonListProps} />
|
||||||
|
</OverlayLayerProvider>
|
||||||
</IsolatedBottomSheetModal>
|
</IsolatedBottomSheetModal>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!state.open) return null;
|
if (!state.open) return null;
|
||||||
return (
|
return (
|
||||||
<OverlayLayerProvider layer={isWeb ? modalLayer : 0}>
|
<OverlayLayerProvider layer={modalLayer}>
|
||||||
<Modal visible transparent animationType="fade" onRequestClose={state.close}>
|
<Modal visible transparent animationType="fade" onRequestClose={state.close}>
|
||||||
<View style={styles.overlay}>
|
<View style={styles.overlay}>
|
||||||
<Pressable style={styles.backdrop} onPress={state.close} />
|
<Pressable style={styles.backdrop} onPress={state.close} />
|
||||||
<View ref={setWebOverlayScope} testID="command-center-panel" style={styles.panel}>
|
<View ref={setOverlayScope} testID="command-center-panel" style={styles.panel}>
|
||||||
<View style={[styles.header, styles.searchRow]} testID="command-center-header">
|
<View style={[styles.header, styles.searchRow]} testID="command-center-header">
|
||||||
{state.scope === "files" ? (
|
{state.scope === "files" ? (
|
||||||
<ScopeChip label={t("shell.commandCenter.files")} onRemove={state.clearScope} />
|
<ScopeChip label={t("shell.commandCenter.files")} onRemove={state.clearScope} />
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { usesDesktopBindings } from "@/keyboard";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { router, type Href } from "expo-router";
|
import { router, type Href } from "expo-router";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -15,12 +16,12 @@ import {
|
|||||||
Settings,
|
Settings,
|
||||||
} from "lucide-react-native";
|
} from "lucide-react-native";
|
||||||
import { withUnistyles } from "react-native-unistyles";
|
import { withUnistyles } from "react-native-unistyles";
|
||||||
import { getIsElectronRuntime, useIsCompactFormFactor } from "@/constants/layout";
|
import { useIsCompactFormFactor } from "@/constants/layout";
|
||||||
import { useKeyboardShortcutOverrides } from "@/hooks/use-keyboard-shortcut-overrides";
|
import { useKeyboardShortcutOverrides } from "@/hooks/use-keyboard-shortcut-overrides";
|
||||||
import { useOpenAddProject } from "@/hooks/use-open-add-project";
|
import { useOpenAddProject } from "@/hooks/use-open-add-project";
|
||||||
import { useImportSession } from "@/hooks/use-import-session";
|
import { useImportSession } from "@/hooks/use-import-session";
|
||||||
import { useKeyboardActionDispatcher } from "@/keyboard/keyboard-action-dispatcher-context";
|
import { useKeyboardActionDispatcher } from "@/keyboard/keyboard-action-dispatcher-context";
|
||||||
import { useKeyboardShortcutsAvailable } from "@/keyboard/availability";
|
import { useHardwareKeyboardPresent } from "@/keyboard";
|
||||||
import { resolveShortcutKeysForAction } from "@/keyboard/keyboard-shortcuts";
|
import { resolveShortcutKeysForAction } from "@/keyboard/keyboard-shortcuts";
|
||||||
import { useKeyboardShortcutsStore } from "@/stores/keyboard-shortcuts-store";
|
import { useKeyboardShortcutsStore } from "@/stores/keyboard-shortcuts-store";
|
||||||
import { usePanelStore } from "@/stores/panel-store";
|
import { usePanelStore } from "@/stores/panel-store";
|
||||||
@@ -111,7 +112,7 @@ export function CommandCenterRootActions() {
|
|||||||
const keyboardActionDispatcher = useKeyboardActionDispatcher();
|
const keyboardActionDispatcher = useKeyboardActionDispatcher();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { overrides } = useKeyboardShortcutOverrides();
|
const { overrides } = useKeyboardShortcutOverrides();
|
||||||
const shortcutsAvailable = useKeyboardShortcutsAvailable();
|
const shortcutsAvailable = useHardwareKeyboardPresent();
|
||||||
const openAddProject = useOpenAddProject();
|
const openAddProject = useOpenAddProject();
|
||||||
const { open: openImportSession, sheet: importSessionSheet } = useImportSession();
|
const { open: openImportSession, sheet: importSessionSheet } = useImportSession();
|
||||||
const settingsRoute = useMemo<Href>(() => buildSettingsRoute(), []);
|
const settingsRoute = useMemo<Href>(() => buildSettingsRoute(), []);
|
||||||
@@ -128,7 +129,7 @@ export function CommandCenterRootActions() {
|
|||||||
const toggleDesktopAgentList = usePanelStore((state) => state.toggleDesktopAgentList);
|
const toggleDesktopAgentList = usePanelStore((state) => state.toggleDesktopAgentList);
|
||||||
const toggleAgentList = isCompact ? toggleMobileAgentList : toggleDesktopAgentList;
|
const toggleAgentList = isCompact ? toggleMobileAgentList : toggleDesktopAgentList;
|
||||||
const shortcutPlatform = useMemo(
|
const shortcutPlatform = useMemo(
|
||||||
() => ({ isMac: getShortcutOs() === "mac", isDesktop: getIsElectronRuntime() }),
|
() => ({ isMac: getShortcutOs() === "mac", usesDesktopBindings }),
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
const actions = useMemo<CommandCenterContribution[]>(() => {
|
const actions = useMemo<CommandCenterContribution[]>(() => {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { usesDesktopBindings } from "@/keyboard";
|
||||||
import { useCallback, useMemo, type ReactElement } from "react";
|
import { useCallback, useMemo, type ReactElement } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
@@ -105,7 +106,7 @@ function staticIcon(element: ReactElement | undefined): CommandCenterIcon | unde
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resolveWorkspaceShortcuts(overrides: ShortcutOverrides): WorkspaceCommandCenterShortcuts {
|
function resolveWorkspaceShortcuts(overrides: ShortcutOverrides): WorkspaceCommandCenterShortcuts {
|
||||||
const platform = { isMac: getShortcutOs() === "mac", isDesktop: getIsElectron() };
|
const platform = { isMac: getShortcutOs() === "mac", usesDesktopBindings };
|
||||||
return resolveWorkspaceCommandCenterShortcuts({ overrides, platform });
|
return resolveWorkspaceCommandCenterShortcuts({ overrides, platform });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ describe("resolveWorkspaceCommandCenterShortcuts", () => {
|
|||||||
expect(
|
expect(
|
||||||
resolveWorkspaceCommandCenterShortcuts({
|
resolveWorkspaceCommandCenterShortcuts({
|
||||||
overrides: {},
|
overrides: {},
|
||||||
platform: { isMac: true, isDesktop: true },
|
platform: { isMac: true, usesDesktopBindings: true },
|
||||||
}).newAgent,
|
}).newAgent,
|
||||||
).toEqual([["mod", "shift", "A"]]);
|
).toEqual([["mod", "shift", "A"]]);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import type { WorkspaceCommandCenterShortcuts } from "./workspace-contributions"
|
|||||||
|
|
||||||
interface ResolveWorkspaceCommandCenterShortcutsInput {
|
interface ResolveWorkspaceCommandCenterShortcutsInput {
|
||||||
overrides: ShortcutOverrides;
|
overrides: ShortcutOverrides;
|
||||||
platform: { isMac: boolean; isDesktop: boolean };
|
platform: { isMac: boolean; usesDesktopBindings: boolean };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resolveWorkspaceCommandCenterShortcuts({
|
export function resolveWorkspaceCommandCenterShortcuts({
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { useOverlayRegistration, type KeyboardInputEvent } from "@/keyboard";
|
||||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||||
import type { ComponentProps, ReactNode } from "react";
|
import type { ComponentProps, ReactNode } from "react";
|
||||||
import { createPortal } from "react-dom";
|
import { createPortal } from "react-dom";
|
||||||
@@ -6,12 +7,7 @@ import { Keyboard, Pressable, Text, View } from "react-native";
|
|||||||
import type { DimensionValue, StyleProp, ViewProps, ViewStyle } from "react-native";
|
import type { DimensionValue, StyleProp, ViewProps, ViewStyle } from "react-native";
|
||||||
import { StyleSheet, useUnistyles, withUnistyles } from "react-native-unistyles";
|
import { StyleSheet, useUnistyles, withUnistyles } from "react-native-unistyles";
|
||||||
import { useIsCompactFormFactor } from "@/constants/layout";
|
import { useIsCompactFormFactor } from "@/constants/layout";
|
||||||
import {
|
import { getOverlayRoot, OverlayLayerProvider, useGlobalOverlayLayer } from "../lib/overlay-root";
|
||||||
getOverlayRoot,
|
|
||||||
OverlayLayerProvider,
|
|
||||||
useGlobalWebOverlayLayer,
|
|
||||||
useWebOverlayRegistration,
|
|
||||||
} from "../lib/overlay-root";
|
|
||||||
import {
|
import {
|
||||||
BottomSheetHandle,
|
BottomSheetHandle,
|
||||||
useBottomSheetGestureHandlers,
|
useBottomSheetGestureHandlers,
|
||||||
@@ -99,7 +95,7 @@ const styles = StyleSheet.create((theme) => ({
|
|||||||
maxHeight: "85%",
|
maxHeight: "85%",
|
||||||
flexShrink: 1,
|
flexShrink: 1,
|
||||||
minHeight: 0,
|
minHeight: 0,
|
||||||
backgroundColor: theme.colors.surface1,
|
backgroundColor: theme.colors.surface0,
|
||||||
borderRadius: theme.borderRadius.xl,
|
borderRadius: theme.borderRadius.xl,
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderColor: theme.colors.surface2,
|
borderColor: theme.colors.surface2,
|
||||||
@@ -140,6 +136,12 @@ const styles = StyleSheet.create((theme) => ({
|
|||||||
padding: theme.spacing[SHEET_HEADER_CLOSE_PADDING_SCALE],
|
padding: theme.spacing[SHEET_HEADER_CLOSE_PADDING_SCALE],
|
||||||
borderRadius: theme.borderRadius.lg,
|
borderRadius: theme.borderRadius.lg,
|
||||||
},
|
},
|
||||||
|
// Without a header the close button floats over the card's top-right corner.
|
||||||
|
floatingClose: {
|
||||||
|
position: "absolute",
|
||||||
|
top: theme.spacing[4],
|
||||||
|
right: theme.spacing[4],
|
||||||
|
},
|
||||||
searchRow: {
|
searchRow: {
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
@@ -493,8 +495,27 @@ export function InlineHeaderView({ header }: { header: SheetHeader }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The sheet's action row: a top border, the sheet's side inset, and children spread across it.
|
||||||
|
* The sheet draws it for `footer`; a body that splits into panes renders it at the bottom of one.
|
||||||
|
*/
|
||||||
|
export function SheetFooter({
|
||||||
|
style,
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
style?: StyleProp<ViewStyle>;
|
||||||
|
children: ReactNode;
|
||||||
|
}) {
|
||||||
|
return <View style={[styles.footer, style]}>{children}</View>;
|
||||||
|
}
|
||||||
|
|
||||||
export interface AdaptiveModalSheetProps {
|
export interface AdaptiveModalSheetProps {
|
||||||
header: SheetHeader;
|
/**
|
||||||
|
* The title row with the close button. Leave it out when the body draws its own chrome, such as
|
||||||
|
* a full-height side rail: the desktop card then floats the close button over its top-right
|
||||||
|
* corner, and the compact sheet closes from its handle.
|
||||||
|
*/
|
||||||
|
header?: SheetHeader;
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
onDismiss?: () => void;
|
onDismiss?: () => void;
|
||||||
@@ -534,7 +555,7 @@ function CompactSheetBody({
|
|||||||
contentStyle,
|
contentStyle,
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
header: SheetHeader;
|
header?: SheetHeader;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
testID?: string;
|
testID?: string;
|
||||||
footer: ReactNode;
|
footer: ReactNode;
|
||||||
@@ -564,7 +585,7 @@ function CompactSheetBody({
|
|||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<SheetVisibleFrame footer={footerView}>
|
<SheetVisibleFrame footer={footerView}>
|
||||||
<SheetHeaderView header={header} onClose={onClose} testID={testID} />
|
{header ? <SheetHeaderView header={header} onClose={onClose} testID={testID} /> : null}
|
||||||
<View style={[styles.compactStaticContent, bodyStyle]}>
|
<View style={[styles.compactStaticContent, bodyStyle]}>
|
||||||
{scrollable ? (
|
{scrollable ? (
|
||||||
<ScrollView
|
<ScrollView
|
||||||
@@ -612,7 +633,7 @@ export function AdaptiveModalSheet({
|
|||||||
const isKeyboardVisible = useKeyboardVisibility(visible);
|
const isKeyboardVisible = useKeyboardVisibility(visible);
|
||||||
const resolvedSnapPoints = useMemo(() => snapPoints ?? ["65%", "90%"], [snapPoints]);
|
const resolvedSnapPoints = useMemo(() => snapPoints ?? ["65%", "90%"], [snapPoints]);
|
||||||
const footerView = useMemo(
|
const footerView = useMemo(
|
||||||
() => (footer ? <View style={[styles.footer, footerContainerStyle]}>{footer}</View> : null),
|
() => (footer ? <SheetFooter style={footerContainerStyle}>{footer}</SheetFooter> : null),
|
||||||
[footer, footerContainerStyle],
|
[footer, footerContainerStyle],
|
||||||
);
|
);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -630,7 +651,7 @@ export function AdaptiveModalSheet({
|
|||||||
});
|
});
|
||||||
const [shouldRenderWeb, setShouldRenderWeb] = useState(visible);
|
const [shouldRenderWeb, setShouldRenderWeb] = useState(visible);
|
||||||
const [isWebClosing, setIsWebClosing] = useState(false);
|
const [isWebClosing, setIsWebClosing] = useState(false);
|
||||||
const modalLayer = useGlobalWebOverlayLayer("modal", isWeb && !isMobile && shouldRenderWeb);
|
const modalLayer = useGlobalOverlayLayer("modal", visible || shouldRenderWeb);
|
||||||
const handleDismiss = useCallback(() => {
|
const handleDismiss = useCallback(() => {
|
||||||
handleSheetDismiss();
|
handleSheetDismiss();
|
||||||
onDismiss?.();
|
onDismiss?.();
|
||||||
@@ -658,8 +679,8 @@ export function AdaptiveModalSheet({
|
|||||||
[isWebClosing, modalLayer],
|
[isWebClosing, modalLayer],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleWebOverlayKeyDown = useCallback(
|
const handleOverlayKeyDown = useCallback(
|
||||||
(event: KeyboardEvent) => {
|
(event: KeyboardInputEvent) => {
|
||||||
if (event.key !== "Escape") return false;
|
if (event.key !== "Escape") return false;
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@@ -668,10 +689,11 @@ export function AdaptiveModalSheet({
|
|||||||
},
|
},
|
||||||
[onClose],
|
[onClose],
|
||||||
);
|
);
|
||||||
const setWebOverlayScope = useWebOverlayRegistration({
|
const setOverlayScope = useOverlayRegistration({
|
||||||
active: isWeb && !isMobile && visible,
|
keys: ["Escape"],
|
||||||
|
active: visible,
|
||||||
layer: modalLayer,
|
layer: modalLayer,
|
||||||
onKeyDown: handleWebOverlayKeyDown,
|
onKeyDown: handleOverlayKeyDown,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -710,18 +732,20 @@ export function AdaptiveModalSheet({
|
|||||||
accessible={false}
|
accessible={false}
|
||||||
presentation={presentation}
|
presentation={presentation}
|
||||||
>
|
>
|
||||||
<CompactSheetBody
|
<OverlayLayerProvider layer={modalLayer}>
|
||||||
header={header}
|
<CompactSheetBody
|
||||||
onClose={onClose}
|
header={header}
|
||||||
testID={testID}
|
onClose={onClose}
|
||||||
footer={footerView}
|
testID={testID}
|
||||||
isKeyboardVisible={isKeyboardVisible}
|
footer={footerView}
|
||||||
scrollable={scrollable}
|
isKeyboardVisible={isKeyboardVisible}
|
||||||
bodyStyle={bodyStyle}
|
scrollable={scrollable}
|
||||||
contentStyle={contentStyle}
|
bodyStyle={bodyStyle}
|
||||||
>
|
contentStyle={contentStyle}
|
||||||
{children}
|
>
|
||||||
</CompactSheetBody>
|
{children}
|
||||||
|
</CompactSheetBody>
|
||||||
|
</OverlayLayerProvider>
|
||||||
</IsolatedBottomSheetModal>
|
</IsolatedBottomSheetModal>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -730,7 +754,7 @@ export function AdaptiveModalSheet({
|
|||||||
desktopHeight == null ? styles.desktopStaticContent : styles.compactStaticContent;
|
desktopHeight == null ? styles.desktopStaticContent : styles.compactStaticContent;
|
||||||
const cardInner = (
|
const cardInner = (
|
||||||
<OverlayLayerProvider layer={modalLayer}>
|
<OverlayLayerProvider layer={modalLayer}>
|
||||||
<SheetHeaderView header={header} onClose={onClose} />
|
{header ? <SheetHeaderView header={header} onClose={onClose} /> : null}
|
||||||
<View style={[scrollable ? styles.desktopScrollContainer : desktopStaticStyle, bodyStyle]}>
|
<View style={[scrollable ? styles.desktopScrollContainer : desktopStaticStyle, bodyStyle]}>
|
||||||
{scrollable ? (
|
{scrollable ? (
|
||||||
<ScrollView
|
<ScrollView
|
||||||
@@ -746,6 +770,15 @@ export function AdaptiveModalSheet({
|
|||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
{footerView}
|
{footerView}
|
||||||
|
{header ? null : (
|
||||||
|
<View style={styles.floatingClose}>
|
||||||
|
<SheetHeaderIconButton
|
||||||
|
icon={X}
|
||||||
|
accessibilityLabel={t("common.actions.close")}
|
||||||
|
onPress={onClose}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
</OverlayLayerProvider>
|
</OverlayLayerProvider>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -756,13 +789,7 @@ export function AdaptiveModalSheet({
|
|||||||
style={ABSOLUTE_FILL_STYLE}
|
style={ABSOLUTE_FILL_STYLE}
|
||||||
onPress={onClose}
|
onPress={onClose}
|
||||||
/>
|
/>
|
||||||
<View
|
<View ref={setOverlayScope} style={desktopCardStyle} role="dialog" aria-modal tabIndex={-1}>
|
||||||
ref={setWebOverlayScope}
|
|
||||||
style={desktopCardStyle}
|
|
||||||
role="dialog"
|
|
||||||
aria-modal
|
|
||||||
tabIndex={-1}
|
|
||||||
>
|
|
||||||
{cardInner}
|
{cardInner}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { useOverlayRegistration, type KeyboardInputEvent } from "@/keyboard";
|
||||||
|
import { useAddHost } from "@/hosts/add-host";
|
||||||
import { Modal } from "@/components/ui/modal";
|
import { Modal } from "@/components/ui/modal";
|
||||||
import { usePanelStore } from "@/stores/panel-store";
|
import { usePanelStore } from "@/stores/panel-store";
|
||||||
import { getHostRuntimeStore } from "@/runtime/host-runtime";
|
import { getHostRuntimeStore } from "@/runtime/host-runtime";
|
||||||
@@ -68,19 +70,15 @@ import {
|
|||||||
} from "@/components/project-picker-options";
|
} from "@/components/project-picker-options";
|
||||||
import { Shortcut } from "@/components/ui/shortcut";
|
import { Shortcut } from "@/components/ui/shortcut";
|
||||||
import { useRevealActiveItem } from "@/components/ui/scroll-reveal";
|
import { useRevealActiveItem } from "@/components/ui/scroll-reveal";
|
||||||
import { useKeyboardShortcutsAvailable } from "@/keyboard/availability";
|
import { useHardwareKeyboardPresent } from "@/keyboard";
|
||||||
import { getIsElectronRuntime } from "@/constants/layout";
|
import { getIsElectronRuntime } from "@/constants/layout";
|
||||||
import { isNative, isWeb } from "@/constants/platform";
|
import { isWeb } from "@/constants/platform";
|
||||||
import { pickDirectory } from "@/desktop/pick-directory";
|
import { pickDirectory } from "@/desktop/pick-directory";
|
||||||
import { useFetchQuery } from "@/data/query";
|
import { useFetchQuery } from "@/data/query";
|
||||||
import { getOpenProjectFailureReason, registerProjectDescriptor } from "@/hooks/open-project";
|
import { getOpenProjectFailureReason, registerProjectDescriptor } from "@/hooks/open-project";
|
||||||
import { useIsLocalDaemon, useLocalDaemonServerId } from "@/hooks/use-is-local-daemon";
|
import { useIsLocalDaemon, useLocalDaemonServerId } from "@/hooks/use-is-local-daemon";
|
||||||
import { useCloneGithubProject, useOpenProject } from "@/hooks/use-open-project";
|
import { useCloneGithubProject, useOpenProject } from "@/hooks/use-open-project";
|
||||||
import {
|
import { OverlayLayerProvider, useGlobalOverlayLayer } from "@/lib/overlay-root";
|
||||||
OverlayLayerProvider,
|
|
||||||
useGlobalWebOverlayLayer,
|
|
||||||
useWebOverlayRegistration,
|
|
||||||
} from "@/lib/overlay-root";
|
|
||||||
import {
|
import {
|
||||||
useHosts,
|
useHosts,
|
||||||
useHostRuntimeClient,
|
useHostRuntimeClient,
|
||||||
@@ -92,7 +90,7 @@ import { useRecommendedProjectPaths } from "@/stores/session-store-hooks";
|
|||||||
import type { AddProjectFlowRequest } from "@/stores/add-project-flow-store";
|
import type { AddProjectFlowRequest } from "@/stores/add-project-flow-store";
|
||||||
import type { Theme } from "@/styles/theme";
|
import type { Theme } from "@/styles/theme";
|
||||||
import { shortenPath } from "@/utils/shorten-path";
|
import { shortenPath } from "@/utils/shorten-path";
|
||||||
import { buildNewWorkspaceRoute, buildSettingsAddHostRoute } from "@/utils/host-routes";
|
import { buildNewWorkspaceRoute } from "@/utils/host-routes";
|
||||||
|
|
||||||
interface AddProjectFlowProps {
|
interface AddProjectFlowProps {
|
||||||
request: AddProjectFlowRequest;
|
request: AddProjectFlowRequest;
|
||||||
@@ -301,7 +299,7 @@ function FlowRow({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function FlowHint({ keys, action }: { keys: string[]; action: string }) {
|
function FlowHint({ keys, action }: { keys: string[]; action: string }) {
|
||||||
const shortcutsAvailable = useKeyboardShortcutsAvailable();
|
const shortcutsAvailable = useHardwareKeyboardPresent();
|
||||||
if (!shortcutsAvailable) return null;
|
if (!shortcutsAvailable) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -325,6 +323,7 @@ function setPageStatus(
|
|||||||
// The product flow is intentionally one cohesive page-stack state machine.
|
// The product flow is intentionally one cohesive page-stack state machine.
|
||||||
// eslint-disable-next-line complexity
|
// eslint-disable-next-line complexity
|
||||||
export function AddProjectFlow({ request, onClose }: AddProjectFlowProps) {
|
export function AddProjectFlow({ request, onClose }: AddProjectFlowProps) {
|
||||||
|
const addHost = useAddHost();
|
||||||
const hosts = useHosts();
|
const hosts = useHosts();
|
||||||
const hostIds = useMemo(() => hosts.map((host) => host.serverId), [hosts]);
|
const hostIds = useMemo(() => hosts.map((host) => host.serverId), [hosts]);
|
||||||
const connectionStatuses = useHostRuntimeConnectionStatuses(hostIds);
|
const connectionStatuses = useHostRuntimeConnectionStatuses(hostIds);
|
||||||
@@ -458,13 +457,10 @@ export function AddProjectFlow({ request, onClose }: AddProjectFlowProps) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleBack = useCallback(() => {
|
const handleBack = useCallback(() => {
|
||||||
setState((current) => {
|
const previous = backAddProjectPage(state);
|
||||||
const previous = backAddProjectPage(current);
|
if (previous) setState(previous);
|
||||||
if (previous) return previous;
|
else onClose();
|
||||||
onClose();
|
}, [onClose, state]);
|
||||||
return current;
|
|
||||||
});
|
|
||||||
}, [onClose]);
|
|
||||||
|
|
||||||
const openNewWorkspaceForProject = useCallback(
|
const openNewWorkspaceForProject = useCallback(
|
||||||
(serverId: string, project: WorkspaceProjectDescriptorPayload) => {
|
(serverId: string, project: WorkspaceProjectDescriptorPayload) => {
|
||||||
@@ -616,9 +612,9 @@ export function AddProjectFlow({ request, onClose }: AddProjectFlowProps) {
|
|||||||
icon: Plus,
|
icon: Plus,
|
||||||
testID: "add-project-flow-add-host",
|
testID: "add-project-flow-add-host",
|
||||||
select: () => {
|
select: () => {
|
||||||
|
// The native project Modal must release its window before the root sheet opens.
|
||||||
onClose();
|
onClose();
|
||||||
usePanelStore.getState().showMobileAgent();
|
addHost();
|
||||||
router.push(buildSettingsAddHostRoute(Date.now()));
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -717,6 +713,7 @@ export function AddProjectFlow({ request, onClose }: AddProjectFlowProps) {
|
|||||||
directoryPaths,
|
directoryPaths,
|
||||||
githubQuery.data,
|
githubQuery.data,
|
||||||
host,
|
host,
|
||||||
|
addHost,
|
||||||
onClose,
|
onClose,
|
||||||
openAddedProject,
|
openAddedProject,
|
||||||
page,
|
page,
|
||||||
@@ -812,30 +809,22 @@ export function AddProjectFlow({ request, onClose }: AddProjectFlowProps) {
|
|||||||
[activeIndex, handleBack, rows, submitActive],
|
[activeIndex, handleBack, rows, submitActive],
|
||||||
);
|
);
|
||||||
|
|
||||||
const modalLayer = useGlobalWebOverlayLayer("modal", isWeb);
|
const modalLayer = useGlobalOverlayLayer("modal", true);
|
||||||
const handleWebOverlayKeyDown = useCallback(
|
const handleOverlayKeyDown = useCallback(
|
||||||
(event: KeyboardEvent) => {
|
(event: KeyboardInputEvent) => {
|
||||||
if (!handleKey(event.key)) return false;
|
if (!handleKey(event.key)) return false;
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
[handleKey],
|
[handleKey],
|
||||||
);
|
);
|
||||||
const setWebOverlayScope = useWebOverlayRegistration({
|
const setOverlayScope = useOverlayRegistration({
|
||||||
active: isWeb,
|
keys: ["Escape", "Enter", "ArrowUp", "ArrowDown"],
|
||||||
|
active: true,
|
||||||
layer: modalLayer,
|
layer: modalLayer,
|
||||||
onKeyDown: handleWebOverlayKeyDown,
|
onKeyDown: handleOverlayKeyDown,
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleNativeKeyPress = useCallback(
|
|
||||||
({ nativeEvent: { key } }: { nativeEvent: { key: string } }) => {
|
|
||||||
if (key === "ArrowDown" || key === "ArrowUp" || key === "Escape") {
|
|
||||||
handleKey(key);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[handleKey],
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleInputChange = useCallback((value: string) => {
|
const handleInputChange = useCallback((value: string) => {
|
||||||
setState((current) =>
|
setState((current) =>
|
||||||
currentAddProjectPage(current).kind === "new-directory-name"
|
currentAddProjectPage(current).kind === "new-directory-name"
|
||||||
@@ -870,7 +859,7 @@ export function AddProjectFlow({ request, onClose }: AddProjectFlowProps) {
|
|||||||
<View style={styles.overlay} testID="add-project-flow">
|
<View style={styles.overlay} testID="add-project-flow">
|
||||||
<Pressable style={styles.backdrop} onPress={onClose} testID="add-project-flow-backdrop" />
|
<Pressable style={styles.backdrop} onPress={onClose} testID="add-project-flow-backdrop" />
|
||||||
<View
|
<View
|
||||||
ref={setWebOverlayScope}
|
ref={setOverlayScope}
|
||||||
style={styles.panel}
|
style={styles.panel}
|
||||||
testID={`add-project-flow-page-${page.kind}`}
|
testID={`add-project-flow-page-${page.kind}`}
|
||||||
accessibilityLabel={`Add project: ${page.kind}`}
|
accessibilityLabel={`Add project: ${page.kind}`}
|
||||||
@@ -889,29 +878,11 @@ export function AddProjectFlow({ request, onClose }: AddProjectFlowProps) {
|
|||||||
) : null}
|
) : null}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{page.kind === "method" && isNative ? (
|
|
||||||
// Native hardware-keyboard events need a focused responder even without a visible field.
|
|
||||||
<TextInput
|
|
||||||
ref={inputRef}
|
|
||||||
onKeyPress={handleNativeKeyPress}
|
|
||||||
onSubmitEditing={submitActive}
|
|
||||||
showSoftInputOnFocus={false}
|
|
||||||
caretHidden
|
|
||||||
contextMenuHidden
|
|
||||||
accessible={false}
|
|
||||||
accessibilityElementsHidden
|
|
||||||
importantForAccessibility="no-hide-descendants"
|
|
||||||
pointerEvents="none"
|
|
||||||
style={styles.keyboardCapture}
|
|
||||||
testID="add-project-flow-keyboard-capture"
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
{page.kind !== "method" ? (
|
{page.kind !== "method" ? (
|
||||||
<ThemedTextInput
|
<ThemedTextInput
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
initialValue={pageInput(page)}
|
initialValue={pageInput(page)}
|
||||||
onChangeText={handleInputChange}
|
onChangeText={handleInputChange}
|
||||||
onKeyPress={isWeb ? undefined : handleNativeKeyPress}
|
|
||||||
onSubmitEditing={isWeb ? undefined : submitActive}
|
onSubmitEditing={isWeb ? undefined : submitActive}
|
||||||
placeholder={pagePlaceholder(page)}
|
placeholder={pagePlaceholder(page)}
|
||||||
style={styles.input}
|
style={styles.input}
|
||||||
@@ -993,7 +964,7 @@ export function AddProjectFlow({ request, onClose }: AddProjectFlowProps) {
|
|||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|
||||||
return createElement(OverlayLayerProvider, { layer: isWeb ? modalLayer : 0 }, modal);
|
return createElement(OverlayLayerProvider, { layer: modalLayer }, modal);
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create((theme) => ({
|
const styles = StyleSheet.create((theme) => ({
|
||||||
@@ -1067,12 +1038,6 @@ const styles = StyleSheet.create((theme) => ({
|
|||||||
paddingVertical: theme.spacing[1],
|
paddingVertical: theme.spacing[1],
|
||||||
outlineStyle: "none",
|
outlineStyle: "none",
|
||||||
} as object,
|
} as object,
|
||||||
keyboardCapture: {
|
|
||||||
position: "absolute",
|
|
||||||
width: 1,
|
|
||||||
height: 1,
|
|
||||||
opacity: 0,
|
|
||||||
},
|
|
||||||
results: { flexGrow: 0, flexShrink: 1, minHeight: 0 },
|
results: { flexGrow: 0, flexShrink: 1, minHeight: 0 },
|
||||||
resultsContent: { paddingVertical: theme.spacing[2] },
|
resultsContent: { paddingVertical: theme.spacing[2] },
|
||||||
row: {
|
row: {
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ export function ArchivedAgentCallout({ serverId, agentId }: ArchivedAgentCallout
|
|||||||
<View style={styles.callout}>
|
<View style={styles.callout}>
|
||||||
<Text style={styles.calloutText}>{t("agentPanel.archived.callout")}</Text>
|
<Text style={styles.calloutText}>{t("agentPanel.archived.callout")}</Text>
|
||||||
<Button
|
<Button
|
||||||
size="sm"
|
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
onPress={handleUnarchive}
|
onPress={handleUnarchive}
|
||||||
disabled={!isConnected || isUnarchiving}
|
disabled={!isConnected || isUnarchiving}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { useOverlayRegistration, type KeyboardInputEvent } from "@/keyboard";
|
||||||
import { Modal } from "@/components/ui/modal";
|
import { Modal } from "@/components/ui/modal";
|
||||||
import { type ReactNode, useCallback, useEffect, useMemo, useState } from "react";
|
import { type ReactNode, useCallback, useEffect, useMemo, useState } from "react";
|
||||||
import { Pressable, Text, View } from "react-native";
|
import { Pressable, Text, View } from "react-native";
|
||||||
@@ -8,12 +9,12 @@ import { X } from "lucide-react-native";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import type { AttachmentMetadata } from "@/attachments/types";
|
import type { AttachmentMetadata } from "@/attachments/types";
|
||||||
import { useAttachmentPreviewUrl } from "@/attachments/use-attachment-preview-url";
|
import { useAttachmentPreviewUrl } from "@/attachments/use-attachment-preview-url";
|
||||||
import { isNative, isWeb } from "@/constants/platform";
|
import { isNative } from "@/constants/platform";
|
||||||
import { SPACING } from "@/styles/theme";
|
import { SPACING } from "@/styles/theme";
|
||||||
import { WindowChromeRootRegion } from "@/utils/desktop-window";
|
import { WindowChromeRootRegion } from "@/utils/desktop-window";
|
||||||
import { ZoomableImage } from "@/components/zoomable-viewport/image";
|
import { ZoomableImage } from "@/components/zoomable-viewport/image";
|
||||||
import type { ViewportSize } from "@/components/zoomable-viewport/geometry";
|
import type { ViewportSize } from "@/components/zoomable-viewport/geometry";
|
||||||
import { useGlobalWebOverlayLayer, useWebOverlayRegistration } from "@/lib/overlay-root";
|
import { useGlobalOverlayLayer } from "@/lib/overlay-root";
|
||||||
|
|
||||||
export type ImageLightboxSource =
|
export type ImageLightboxSource =
|
||||||
| { type: "attachment"; metadata: AttachmentMetadata }
|
| { type: "attachment"; metadata: AttachmentMetadata }
|
||||||
@@ -34,14 +35,14 @@ export function AttachmentLightbox({ source, onClose }: AttachmentLightboxProps)
|
|||||||
const url = source?.type === "uri" ? source.uri : attachmentUrl;
|
const url = source?.type === "uri" ? source.uri : attachmentUrl;
|
||||||
const contentSize = source?.type === "uri" ? source.contentSize : undefined;
|
const contentSize = source?.type === "uri" ? source.contentSize : undefined;
|
||||||
const [errored, setErrored] = useState(false);
|
const [errored, setErrored] = useState(false);
|
||||||
const modalLayer = useGlobalWebOverlayLayer("modal", isWeb && source !== null);
|
const modalLayer = useGlobalOverlayLayer("modal", source !== null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setErrored(false);
|
setErrored(false);
|
||||||
}, [metadata?.id, url]);
|
}, [metadata?.id, url]);
|
||||||
|
|
||||||
const handleWebOverlayKeyDown = useCallback(
|
const handleOverlayKeyDown = useCallback(
|
||||||
(event: KeyboardEvent) => {
|
(event: KeyboardInputEvent) => {
|
||||||
if (event.key !== "Escape") return false;
|
if (event.key !== "Escape") return false;
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@@ -50,10 +51,11 @@ export function AttachmentLightbox({ source, onClose }: AttachmentLightboxProps)
|
|||||||
},
|
},
|
||||||
[onClose],
|
[onClose],
|
||||||
);
|
);
|
||||||
const setWebOverlayScope = useWebOverlayRegistration({
|
const setOverlayScope = useOverlayRegistration({
|
||||||
active: isWeb && source !== null,
|
keys: ["Escape"],
|
||||||
|
active: source !== null,
|
||||||
layer: modalLayer,
|
layer: modalLayer,
|
||||||
onKeyDown: handleWebOverlayKeyDown,
|
onKeyDown: handleOverlayKeyDown,
|
||||||
});
|
});
|
||||||
|
|
||||||
const actions = useMemo(
|
const actions = useMemo(
|
||||||
@@ -83,7 +85,7 @@ export function AttachmentLightbox({ source, onClose }: AttachmentLightboxProps)
|
|||||||
image was opened (inside a sheet tab, the bottom one is already spent). */}
|
image was opened (inside a sheet tab, the bottom one is already spent). */}
|
||||||
<SafeAreaProvider>
|
<SafeAreaProvider>
|
||||||
<WindowChromeRootRegion corners="both">
|
<WindowChromeRootRegion corners="both">
|
||||||
<View ref={setWebOverlayScope} style={styles.root}>
|
<View ref={setOverlayScope} style={styles.root}>
|
||||||
<Pressable
|
<Pressable
|
||||||
testID="attachment-lightbox-backdrop"
|
testID="attachment-lightbox-backdrop"
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user