mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-27 03:32:55 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56f4af0436 | ||
|
|
9072bce0c3 |
@@ -169,34 +169,6 @@ jobs:
|
||||
NODE_OPTIONS: --max-old-space-size=${{ matrix.node_heap_mb }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
export PASEO_REAL_XCRUN="$(command -v xcrun)"
|
||||
stapler_bin="$(mktemp -d)"
|
||||
trap 'rm -rf "$stapler_bin"' EXIT
|
||||
cat > "$stapler_bin/xcrun" <<'STAPLER'
|
||||
#!/bin/bash
|
||||
if [[ "${1:-}" != stapler || "${2:-}" != staple ]]; then
|
||||
exec "$PASEO_REAL_XCRUN" "$@"
|
||||
fi
|
||||
output="$(mktemp)"
|
||||
trap 'rm -f "$output"' EXIT
|
||||
for attempt in 1 2 3 4; do
|
||||
if "$PASEO_REAL_XCRUN" "$@" >"$output" 2>&1; then
|
||||
cat "$output"
|
||||
exit 0
|
||||
else
|
||||
status=$?
|
||||
fi
|
||||
cat "$output"
|
||||
if [[ "$status" != 68 || "$attempt" == 4 ]] ||
|
||||
! grep -Fq 'NSURLErrorDomain Code=-1005' "$output"; then
|
||||
exit "$status"
|
||||
fi
|
||||
echo "::warning::Apple staple connection lost; retrying the same signed app ($attempt/4)" >&2
|
||||
sleep 30
|
||||
done
|
||||
STAPLER
|
||||
chmod +x "$stapler_bin/xcrun"
|
||||
export PATH="$stapler_bin:$PATH"
|
||||
build_args=(-- --publish never --mac --${{ matrix.electron_arch }})
|
||||
build_args+=("-c.publish.releaseType=$RELEASE_TYPE")
|
||||
build_args+=("-c.publish.channel=$RELEASE_CHANNEL")
|
||||
|
||||
@@ -1,20 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## 0.13.2 - 2026-10-26
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed repeated Android animation exceptions for views that have already unmounted ([#7907](https://github.com/getpaseo/paseo/pull/7907))
|
||||
- Fixed the Android animation run loop continuing while the app is in the background ([#7914](https://github.com/getpaseo/paseo/pull/7914))
|
||||
- Fixed finished Android chat messages being remeasured during streaming updates ([#7914](https://github.com/getpaseo/paseo/pull/7914))
|
||||
- Fixed bottom sheets retaining window-size listeners after closing ([#7914](https://github.com/getpaseo/paseo/pull/7914))
|
||||
|
||||
## 0.13.1 - 2026-10-26
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed a startup crash with Show background enabled and eight or more workspaces in a project ([#7896](https://github.com/getpaseo/paseo/pull/7896) by [@budivoogt](https://github.com/budivoogt))
|
||||
|
||||
## 0.13.0 - 2026-10-24
|
||||
|
||||
Foldable phone layouts, agents that delegate work to other machines, plugin file panels, and plugin translations.
|
||||
|
||||
@@ -1,20 +1,5 @@
|
||||
# 更新日志
|
||||
|
||||
## 0.13.2 - 2026-10-26
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复 Android 对已卸载视图反复抛出动画异常的问题 ([#7907](https://github.com/getpaseo/paseo/pull/7907))
|
||||
- 修复 Android 应用进入后台后动画运行循环仍持续执行的问题 ([#7914](https://github.com/getpaseo/paseo/pull/7914))
|
||||
- 修复 Android 在流式更新时反复测量已完成聊天消息的问题 ([#7914](https://github.com/getpaseo/paseo/pull/7914))
|
||||
- 修复底部面板关闭后仍保留窗口尺寸监听器的问题 ([#7914](https://github.com/getpaseo/paseo/pull/7914))
|
||||
|
||||
## 0.13.1 - 2026-10-26
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复开启“显示后台工作区”且项目包含至少八个工作区时的启动崩溃([#7896](https://github.com/getpaseo/paseo/pull/7896),由 [@budivoogt](https://github.com/budivoogt) 贡献)
|
||||
|
||||
## 0.13.0 - 2026-10-24
|
||||
|
||||
折叠屏手机布局、可将工作委派给其他机器的 Agent、插件文件面板,以及插件翻译。
|
||||
|
||||
+41
-20
@@ -221,6 +221,12 @@ snapshot so a mixed edit can apply its live subset and still name the paths that
|
||||
}
|
||||
},
|
||||
providers: {
|
||||
openai: {
|
||||
apiKey?: string,
|
||||
baseUrl?: string,
|
||||
stt?: { apiKey?: string, baseUrl?: string },
|
||||
tts?: { apiKey?: string, baseUrl?: string }
|
||||
},
|
||||
local: { modelsDir: string }
|
||||
},
|
||||
agents: {
|
||||
@@ -238,8 +244,8 @@ snapshot so a mixed edit can apply its live subset and still name the paths that
|
||||
pluginsEnabled: boolean,
|
||||
plugins: Record<pluginId, { source: "directory", path: string, enabled?: boolean }>,
|
||||
features: {
|
||||
dictation: { enabled, stt: SpeechSttConfig },
|
||||
voiceMode: { enabled, llm, stt: SpeechSttConfig, turnDetection, tts: SpeechTtsConfig }
|
||||
dictation: { enabled, stt: { provider, model, language, confidenceThreshold } },
|
||||
voiceMode: { enabled, llm, stt: { provider, model, language }, turnDetection, tts: { provider, model, voice, speakerId, speed } }
|
||||
},
|
||||
log: {
|
||||
level, format,
|
||||
@@ -347,27 +353,42 @@ Environment variables override `config.json`:
|
||||
after changing `config.json`. Environment changes require a daemon restart; the launch environment
|
||||
remains authoritative during reload.
|
||||
|
||||
### Speech configuration
|
||||
Local speech model ids are intentionally narrow: STT uses `parakeet-tdt-0.6b-v2-int8`, TTS uses `kokoro-en-v0_19`, and turn detection uses the bundled Silero VAD model.
|
||||
|
||||
Each use site owns its provider settings: `features.dictation.stt`,
|
||||
`features.voiceMode.stt`, and `features.voiceMode.tts`. `provider` selects a strict
|
||||
`local` or `openai` variant. Both STT variants carry `language`; normalization preserves
|
||||
it regardless of provider. `providers.local.modelsDir` remains shared storage.
|
||||
See [Voice configuration](../public-docs/voice.md) for fields, examples and env precedence.
|
||||
Set these to select OpenAI instead of local speech:
|
||||
|
||||
On load, `persisted-config.ts` folds legacy `providers.openai` credentials and URLs
|
||||
into OpenAI sites that lack their own values, using endpoint settings before shared
|
||||
settings. A provider-less site becomes local; provider names are lower-cased, and
|
||||
fields ignored by the selected speech provider are discarded. The next save writes only the
|
||||
inline shape. A legacy key with no site to receive it is discarded with a warning
|
||||
that names its path, without logging its value.
|
||||
| Env var | Applies to |
|
||||
| ------------------------------ | ------------------------------- |
|
||||
| `PASEO_VOICE_STT_PROVIDER` | Voice mode STT provider |
|
||||
| `PASEO_DICTATION_STT_PROVIDER` | Composer dictation STT provider |
|
||||
| `PASEO_VOICE_TTS_PROVIDER` | Voice mode TTS provider |
|
||||
|
||||
`speech-settings.ts` owns mutable config reads and patches. The wire uses the same
|
||||
`features` structure. Reads replace OpenAI keys with `hasApiKey` (saved in config)
|
||||
and report effective env sources in `envOverrides`. A site patch that changes
|
||||
`provider` replaces the entire object. The same or omitted `provider` merges fields
|
||||
into the current variant, preserving the write-only key when a form re-saves it. `null` clears a value. Switching providers discards credentials and
|
||||
options from the previous variant.
|
||||
OpenAI speech can be configured under `providers.openai`. STT and TTS resolve independently, so they can point at different endpoints:
|
||||
|
||||
```json
|
||||
{
|
||||
"providers": {
|
||||
"openai": {
|
||||
"stt": {
|
||||
"apiKey": "sk-...",
|
||||
"baseUrl": "https://stt.example.com/v1"
|
||||
},
|
||||
"tts": {
|
||||
"apiKey": "sk-...",
|
||||
"baseUrl": "https://api.openai.com/v1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`providers.openai.stt` is used for both composer dictation and voice mode speech-to-text; `providers.openai.tts` is used for voice mode text-to-speech. The equivalent env vars are `OPENAI_STT_API_KEY`/`OPENAI_STT_BASE_URL` and `OPENAI_TTS_API_KEY`/`OPENAI_TTS_BASE_URL`. Each feature falls back to `providers.openai.apiKey`/`providers.openai.baseUrl`, then `OPENAI_API_KEY`/`OPENAI_BASE_URL`, when its own fields are unset. These settings apply only to Paseo OpenAI speech features, not to Codex or other OpenAI-backed tools.
|
||||
|
||||
Paseo uses these paths under the configured OpenAI base URL:
|
||||
|
||||
- dictation STT: `/v1/audio/transcriptions`
|
||||
- voice mode STT: `/v1/audio/transcriptions`
|
||||
- voice mode TTS: `/v1/audio/speech`
|
||||
|
||||
---
|
||||
|
||||
|
||||
+1
-3
@@ -70,7 +70,7 @@ the sidebar. Apply it as `backgroundColor`; setting `opacity` on the control als
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
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. Thin chrome such as the file toolbar uses `xs`; settings rows use `sm`. 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`.
|
||||
|
||||
@@ -126,8 +126,6 @@ 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 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.
|
||||
|
||||
The whitespace is the design.
|
||||
|
||||
---
|
||||
|
||||
@@ -94,12 +94,6 @@ and its Claude provider available. Set `PASEO_COMPOSER_KEYBOARD_SERVER_ID`,
|
||||
`_AGENT_ID` (an idle mock chat), and `_WORKSPACE_ID` (its workspace); `_DEVICE`,
|
||||
`_SESSION`, and `_DRAFT_ID` are optional. Artifacts go to
|
||||
`.dev/agent-device-artifacts/composer-keyboard-ios`.
|
||||
With a Codex draft selected, set `_SCENARIO=growth` on a 402pt-wide iPhone to
|
||||
check live wrapping, shrinking, the 12pt anchor gap, and command insertion. Set
|
||||
`_SCENARIO=previews` on an SE-sized iPhone to check long and short descriptions
|
||||
under an eight-line draft, selection with the keyboard shown and hidden, and
|
||||
file mentions. These scenarios only need `_SERVER_ID` and `_WORKSPACE_ID`;
|
||||
`_UDID` selects an exact simulator and `_ARTIFACTS_DIR` overrides the output path.
|
||||
|
||||
The Android sidebar scroll-retention flow requires a connected host with enough
|
||||
workspaces to overflow the compact sidebar. Pass `TOP_WORKSPACE` and
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 59 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 58 KiB |
@@ -1,4 +0,0 @@
|
||||
Fixed
|
||||
- Fixed a startup crash with Show background enabled and eight or more workspaces in a project
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -1,4 +0,0 @@
|
||||
Fixed
|
||||
- Fixed a startup crash with Show background enabled and eight or more workspaces in a project
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -1,4 +0,0 @@
|
||||
Fixed
|
||||
- Fixed a startup crash with Show background enabled and eight or more workspaces in a project
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -1,4 +0,0 @@
|
||||
Fixed
|
||||
- Fixed a startup crash with Show background enabled and eight or more workspaces in a project
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -1,7 +0,0 @@
|
||||
Fixed
|
||||
- Fixed repeated Android animation exceptions for views that have already unmounted
|
||||
- Fixed the Android animation run loop continuing while the app is in the background
|
||||
- Fixed finished Android chat messages being remeasured during streaming updates
|
||||
- Fixed bottom sheets retaining window-size listeners after closing
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -1,7 +0,0 @@
|
||||
Fixed
|
||||
- Fixed repeated Android animation exceptions for views that have already unmounted
|
||||
- Fixed the Android animation run loop continuing while the app is in the background
|
||||
- Fixed finished Android chat messages being remeasured during streaming updates
|
||||
- Fixed bottom sheets retaining window-size listeners after closing
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -1,7 +0,0 @@
|
||||
Fixed
|
||||
- Fixed repeated Android animation exceptions for views that have already unmounted
|
||||
- Fixed the Android animation run loop continuing while the app is in the background
|
||||
- Fixed finished Android chat messages being remeasured during streaming updates
|
||||
- Fixed bottom sheets retaining window-size listeners after closing
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
@@ -1,7 +0,0 @@
|
||||
Fixed
|
||||
- Fixed repeated Android animation exceptions for views that have already unmounted
|
||||
- Fixed the Android animation run loop continuing while the app is in the background
|
||||
- Fixed finished Android chat messages being remeasured during streaming updates
|
||||
- Fixed bottom sheets retaining window-size listeners after closing
|
||||
|
||||
Full notes: https://paseo.sh/changelog
|
||||
+1
-1
@@ -1 +1 @@
|
||||
sha256-eNiKmiZ3XXZMRZRSoGxUbMn2RtY6AX079vUatBYM+qE=
|
||||
sha256-DZOPOf81PkUxdD65BrfkTZhs6/DkfDWCFZ/SU+QrZbg=
|
||||
|
||||
Generated
+70
-37
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "paseo",
|
||||
"version": "0.13.2",
|
||||
"version": "0.13.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "paseo",
|
||||
"version": "0.13.2",
|
||||
"version": "0.13.0",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"workspaces": [
|
||||
@@ -30269,9 +30269,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/react-native-reanimated": {
|
||||
"version": "4.5.5",
|
||||
"resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-4.5.5.tgz",
|
||||
"integrity": "sha512-xtJXZRZ1vkec1AIUVG02St2sbyZS5jc7227TlDu/HonqUYPeZAfiC4RI2jqL1dVMNBu1+7oBx/c9QkjF2kg6Lg==",
|
||||
"version": "4.5.1",
|
||||
"resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-4.5.1.tgz",
|
||||
"integrity": "sha512-RnMvtDuR+68ig864gAvZCOdZehqhC5rFmMo0kn+ARfgVSTvFeF6IFLBVgMPUu0KwihaapEyW24WRi6nEyy1kSA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"react-native-is-edge-to-edge": "^1.3.1",
|
||||
@@ -30280,7 +30280,7 @@
|
||||
"peerDependencies": {
|
||||
"react": "*",
|
||||
"react-native": "0.83 - 0.86",
|
||||
"react-native-worklets": "0.10.x - 0.11.x"
|
||||
"react-native-worklets": "0.10.x"
|
||||
}
|
||||
},
|
||||
"node_modules/react-native-safe-area-context": {
|
||||
@@ -30406,9 +30406,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/react-native-worklets": {
|
||||
"version": "0.10.4",
|
||||
"resolved": "https://registry.npmjs.org/react-native-worklets/-/react-native-worklets-0.10.4.tgz",
|
||||
"integrity": "sha512-gbk0CxMrGywEp3SJAHO+2JVaCWtl4WyAYBIxLZy6Y113+mHHuq3FuT6iV+VcaBuJzuuN34mtdZ4j5JIlBDzmeA==",
|
||||
"version": "0.10.1",
|
||||
"resolved": "https://registry.npmjs.org/react-native-worklets/-/react-native-worklets-0.10.1.tgz",
|
||||
"integrity": "sha512-62mRM19bDpfpdI8HLkEErcdOsrAPDtE9lA/sw+5lLRpzBHNhxaoj9QyY2KjXqUmirelxkX4zuPGTC3VdA0feJA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/plugin-transform-arrow-functions": "^7.27.1",
|
||||
@@ -35695,7 +35695,7 @@
|
||||
},
|
||||
"packages/app": {
|
||||
"name": "@getpaseo/app",
|
||||
"version": "0.13.2",
|
||||
"version": "0.13.0",
|
||||
"dependencies": {
|
||||
"@codemirror/commands": "6.10.4",
|
||||
"@codemirror/language": "6.12.4",
|
||||
@@ -35780,14 +35780,14 @@
|
||||
"react-native-gesture-handler": "~2.32.0",
|
||||
"react-native-keyboard-controller": "1.21.12",
|
||||
"react-native-nitro-modules": "0.35.5",
|
||||
"react-native-reanimated": "4.5.5",
|
||||
"react-native-reanimated": "4.5.1",
|
||||
"react-native-safe-area-context": "~5.7.0",
|
||||
"react-native-screens": "~4.26.0",
|
||||
"react-native-svg": "15.15.4",
|
||||
"react-native-unistyles": "^3.2.4",
|
||||
"react-native-web": "~0.21.0",
|
||||
"react-native-webview": "13.16.1",
|
||||
"react-native-worklets": "0.10.4",
|
||||
"react-native-worklets": "0.10.1",
|
||||
"tiny-invariant": "^1.3.3",
|
||||
"turndown": "^7.2.4",
|
||||
"turndown-plugin-gfm": "^1.0.2",
|
||||
@@ -37961,12 +37961,12 @@
|
||||
},
|
||||
"packages/cli": {
|
||||
"name": "@getpaseo/cli",
|
||||
"version": "0.13.2",
|
||||
"version": "0.13.0",
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^1.0.0",
|
||||
"@getpaseo/client": "0.13.2",
|
||||
"@getpaseo/protocol": "0.13.2",
|
||||
"@getpaseo/server": "0.13.2",
|
||||
"@getpaseo/client": "0.13.0",
|
||||
"@getpaseo/protocol": "0.13.0",
|
||||
"@getpaseo/server": "0.13.0",
|
||||
"chalk": "^5.3.0",
|
||||
"commander": "^12.0.0",
|
||||
"mime-types": "^2.1.35",
|
||||
@@ -38213,10 +38213,10 @@
|
||||
},
|
||||
"packages/client": {
|
||||
"name": "@getpaseo/client",
|
||||
"version": "0.13.2",
|
||||
"version": "0.13.0",
|
||||
"dependencies": {
|
||||
"@getpaseo/protocol": "0.13.2",
|
||||
"@getpaseo/relay": "0.13.2",
|
||||
"@getpaseo/protocol": "0.13.0",
|
||||
"@getpaseo/relay": "0.13.0",
|
||||
"ws": "^8.20.0",
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
@@ -38228,7 +38228,7 @@
|
||||
},
|
||||
"packages/desktop": {
|
||||
"name": "@getpaseo/desktop",
|
||||
"version": "0.13.2",
|
||||
"version": "0.13.0",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@getpaseo/cli": "*",
|
||||
@@ -38472,7 +38472,7 @@
|
||||
},
|
||||
"packages/expo-two-way-audio": {
|
||||
"name": "@getpaseo/expo-two-way-audio",
|
||||
"version": "0.13.2",
|
||||
"version": "0.13.0",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.14",
|
||||
@@ -41012,6 +41012,39 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"packages/expo-two-way-audio/node_modules/expo-module-scripts/node_modules/react-native-worklets": {
|
||||
"version": "0.13.0",
|
||||
"resolved": "https://registry.npmjs.org/react-native-worklets/-/react-native-worklets-0.13.0.tgz",
|
||||
"integrity": "sha512-1OrhAeAKaZF4XrBa4YbPQbKzNOpjh52HDlId8e6ete1OCHNdAlrQHzG4gznJ225EAj3dgQXHViJvK51M9B52jQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/generator": "^7.27.1",
|
||||
"@babel/plugin-transform-arrow-functions": "^7.27.1",
|
||||
"@babel/plugin-transform-class-properties": "^7.28.6",
|
||||
"@babel/plugin-transform-classes": "^7.28.6",
|
||||
"@babel/plugin-transform-nullish-coalescing-operator": "^7.28.6",
|
||||
"@babel/plugin-transform-optional-chaining": "^7.28.6",
|
||||
"@babel/plugin-transform-shorthand-properties": "^7.27.1",
|
||||
"@babel/plugin-transform-template-literals": "^7.27.1",
|
||||
"@babel/plugin-transform-unicode-regex": "^7.27.1",
|
||||
"@babel/preset-typescript": "^7.28.5",
|
||||
"@babel/traverse": "^7.27.1",
|
||||
"@babel/types": "^7.27.1",
|
||||
"@jridgewell/remapping": "^2.3.5",
|
||||
"convert-source-map": "^2.0.0",
|
||||
"semver": "^7.7.4",
|
||||
"whatwg-fetch": "^3.6.20"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "*",
|
||||
"@react-native/metro-config": "*",
|
||||
"react": "*",
|
||||
"react-native": "0.86 - 0.88"
|
||||
}
|
||||
},
|
||||
"packages/expo-two-way-audio/node_modules/expo-module-scripts/node_modules/react-native/node_modules/pretty-format": {
|
||||
"version": "29.7.0",
|
||||
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz",
|
||||
@@ -42091,7 +42124,7 @@
|
||||
},
|
||||
"packages/highlight": {
|
||||
"name": "@getpaseo/highlight",
|
||||
"version": "0.13.2",
|
||||
"version": "0.13.0",
|
||||
"dependencies": {
|
||||
"@codemirror/language": "6.12.4",
|
||||
"@codemirror/legacy-modes": "^6.5.3",
|
||||
@@ -42120,15 +42153,15 @@
|
||||
},
|
||||
"packages/plugin": {
|
||||
"name": "@getpaseo/plugin",
|
||||
"version": "0.13.2",
|
||||
"version": "0.13.0",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "^1.4.0",
|
||||
"i18next": "^26.3.0",
|
||||
"use-sync-external-store": "^1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@getpaseo/client": "0.13.2",
|
||||
"@getpaseo/protocol": "0.13.2",
|
||||
"@getpaseo/client": "0.13.0",
|
||||
"@getpaseo/protocol": "0.13.0",
|
||||
"@types/node": "^20.9.0",
|
||||
"@types/react": "~19.2.0",
|
||||
"react": "19.2.3",
|
||||
@@ -42138,8 +42171,8 @@
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@getpaseo/client": "0.13.2",
|
||||
"@getpaseo/protocol": "0.13.2",
|
||||
"@getpaseo/client": "0.13.0",
|
||||
"@getpaseo/protocol": "0.13.0",
|
||||
"react": ">=19.1.0 <20",
|
||||
"react-native": ">=0.81.5",
|
||||
"zod": "^4.4.3"
|
||||
@@ -42161,7 +42194,7 @@
|
||||
},
|
||||
"packages/protocol": {
|
||||
"name": "@getpaseo/protocol",
|
||||
"version": "0.13.2",
|
||||
"version": "0.13.0",
|
||||
"dependencies": {
|
||||
"semver": "^7.8.5",
|
||||
"zod": "^4.4.3"
|
||||
@@ -42188,7 +42221,7 @@
|
||||
},
|
||||
"packages/relay": {
|
||||
"name": "@getpaseo/relay",
|
||||
"version": "0.13.2",
|
||||
"version": "0.13.0",
|
||||
"dependencies": {
|
||||
"@noble/ciphers": "^2.4.0",
|
||||
"@noble/curves": "^2.4.0",
|
||||
@@ -42409,16 +42442,16 @@
|
||||
},
|
||||
"packages/server": {
|
||||
"name": "@getpaseo/server",
|
||||
"version": "0.13.2",
|
||||
"version": "0.13.0",
|
||||
"dependencies": {
|
||||
"@agentclientprotocol/sdk": "^0.17.1",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.3.246",
|
||||
"@anthropic-ai/sdk": "^0.104.2",
|
||||
"@getpaseo/client": "0.13.2",
|
||||
"@getpaseo/highlight": "0.13.2",
|
||||
"@getpaseo/plugin": "0.13.2",
|
||||
"@getpaseo/protocol": "0.13.2",
|
||||
"@getpaseo/relay": "0.13.2",
|
||||
"@getpaseo/client": "0.13.0",
|
||||
"@getpaseo/highlight": "0.13.0",
|
||||
"@getpaseo/plugin": "0.13.0",
|
||||
"@getpaseo/protocol": "0.13.0",
|
||||
"@getpaseo/relay": "0.13.0",
|
||||
"@isaacs/ttlcache": "^2.1.4",
|
||||
"@modelcontextprotocol/sdk": "1.29.0",
|
||||
"@opencode-ai/sdk": "1.14.46",
|
||||
@@ -43339,7 +43372,7 @@
|
||||
},
|
||||
"packages/website": {
|
||||
"name": "@getpaseo/website",
|
||||
"version": "0.13.2",
|
||||
"version": "0.13.0",
|
||||
"dependencies": {
|
||||
"@cloudflare/vite-plugin": "^1.29.1",
|
||||
"@cloudflare/workers-types": "^4.20260317.1",
|
||||
@@ -44949,7 +44982,7 @@
|
||||
},
|
||||
"plugins": {
|
||||
"name": "@getpaseo/builtin-plugins",
|
||||
"version": "0.13.2",
|
||||
"version": "0.13.0",
|
||||
"dependencies": {
|
||||
"@getpaseo/plugin": "*",
|
||||
"zod": "^4.4.3"
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "paseo",
|
||||
"version": "0.13.2",
|
||||
"version": "0.13.0",
|
||||
"private": true,
|
||||
"description": "Paseo: voice-controlled development environment for local AI coding agents",
|
||||
"keywords": [
|
||||
@@ -154,7 +154,7 @@
|
||||
"react-dom": "19.2.3",
|
||||
"react-native": "0.86.3",
|
||||
"react-native-gesture-handler": "~2.32.0",
|
||||
"react-native-reanimated": "4.5.5",
|
||||
"react-native-worklets": "0.10.4"
|
||||
"react-native-reanimated": "4.5.1",
|
||||
"react-native-worklets": "0.10.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,7 @@ import {
|
||||
expectComposerVisible,
|
||||
cancelAgent,
|
||||
composerLocator,
|
||||
expectQueuedMessageButton,
|
||||
fillComposerDraft,
|
||||
holdSendButton,
|
||||
sendDraftToQueue,
|
||||
startRunningMockAgent,
|
||||
submitMessage,
|
||||
@@ -1292,49 +1290,6 @@ test.describe("Agent message submission", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("queues a draft by holding Send while a tap still steers", async ({ page }, testInfo) => {
|
||||
test.setTimeout(120_000);
|
||||
const gate = await gateNextAgentMessage(page);
|
||||
const agent = await startRunningMockAgent(page, {
|
||||
prefix: `hold-send-queue-${testInfo.workerIndex}-`,
|
||||
model: "one-minute-stream",
|
||||
prompt: "Keep this turn active while the user holds Send.",
|
||||
});
|
||||
try {
|
||||
await expectComposerVisible(page);
|
||||
await expectAgentReadyToInterrupt(page);
|
||||
|
||||
const queuedPrompt = "Queue this follow-up by holding Send.";
|
||||
await test.step("holding Send queues the draft", async () => {
|
||||
await fillComposerDraft(page, queuedPrompt);
|
||||
await holdSendButton(page, "Send and steer");
|
||||
await expectQueuedMessageButton(page);
|
||||
await expectComposerDraft(page, "");
|
||||
await expectAgentReadyToInterrupt(page);
|
||||
await expect(
|
||||
page.getByTestId("user-message").filter({ hasText: queuedPrompt }),
|
||||
).toHaveCount(0);
|
||||
});
|
||||
|
||||
await test.step("tapping Send still steers", async () => {
|
||||
const steeredPrompt = "Steer this turn with a tap.";
|
||||
await fillComposerDraft(page, steeredPrompt);
|
||||
await page.getByRole("button", { name: "Send and steer", exact: true }).click();
|
||||
|
||||
const request = await gate.waitForRequest();
|
||||
expect(request.text).toBe(steeredPrompt);
|
||||
expect(request.activeTurnBehavior).toBe("steer");
|
||||
gate.accept();
|
||||
await expect(
|
||||
page.getByTestId("user-message").filter({ hasText: steeredPrompt }),
|
||||
).toHaveCount(1);
|
||||
await expectQueuedMessageButton(page);
|
||||
});
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("replays Claude-shaped steering inside one active turn", async ({ page }, testInfo) => {
|
||||
test.setTimeout(120_000);
|
||||
await replaySteeredSleepTurnInBrowser(page, testInfo, "claude");
|
||||
|
||||
@@ -42,14 +42,6 @@ const test = base.extend<{ agent: MockAgentSession }>({
|
||||
},
|
||||
});
|
||||
|
||||
// The outer meter owns the accessible usage label; its SVG is decorative.
|
||||
async function expectDecorativeContextRing(meter: Locator): Promise<void> {
|
||||
const ring = meter.locator("svg");
|
||||
await expect(ring).toHaveAttribute("aria-hidden", "true");
|
||||
await expect(ring).not.toHaveAttribute("accessibilityElementsHidden");
|
||||
await expect(ring).not.toHaveAttribute("importantForAccessibility");
|
||||
}
|
||||
|
||||
// Where the progress arc is painted, as its centroid relative to the ring's centre in pixels.
|
||||
// Reads the rendered pixels, so any rotation that does not reach the screen counts as none.
|
||||
async function progressArcCentroid(meter: Locator): Promise<{ x: number; y: number }> {
|
||||
@@ -108,7 +100,6 @@ test.describe("context window meter", () => {
|
||||
const meter = page.getByTestId("context-window-meter");
|
||||
await expect(meter).toHaveAccessibleName(/25%/, { timeout: 30_000 });
|
||||
|
||||
await expectDecorativeContextRing(meter);
|
||||
const centroid = await progressArcCentroid(meter);
|
||||
expect(centroid.x).toBeGreaterThan(1);
|
||||
expect(centroid.y).toBeLessThan(-1);
|
||||
|
||||
@@ -10,15 +10,6 @@ import { gotoAppShell, openSettings } from "../support/helpers/app";
|
||||
import { getE2EDaemonPort } from "../support/helpers/daemon-port";
|
||||
import {
|
||||
closeCompactSettings,
|
||||
scrollSettingsSidebarToEnd,
|
||||
revealSettingsSidebarSection,
|
||||
expectSettingsSidebarScrollSettled,
|
||||
scrollSettingsSidebarUp,
|
||||
changeSettingsInterfaceFontSize,
|
||||
selectSettingsHostSectionsRapidly,
|
||||
expectSettingsSidebarScrollOffset,
|
||||
scrollSettingsDetailDown,
|
||||
expectSettingsDetailScrollOffset,
|
||||
openSettingsSection,
|
||||
expectSettingsHeader,
|
||||
openAddHostFlow,
|
||||
@@ -63,98 +54,6 @@ async function openWorkspace(
|
||||
await expect(page.getByTestId("menu-button")).toBeVisible();
|
||||
}
|
||||
|
||||
test.describe("Settings sidebar scroll position", () => {
|
||||
test.use({ viewport: { width: 1000, height: 500 } });
|
||||
|
||||
test("clamps after resizing and starts a fresh visit at the top", async ({ page }) => {
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await scrollSettingsSidebarToEnd(page);
|
||||
await page.setViewportSize({ width: 1000, height: 1100 });
|
||||
await expectSettingsSidebarScrollOffset(page, 0);
|
||||
await page.setViewportSize({ width: 1000, height: 500 });
|
||||
await openSettingsSection(page, "appearance");
|
||||
await expectSettingsSidebarScrollOffset(page, 0);
|
||||
await scrollSettingsSidebarToEnd(page);
|
||||
await clickSettingsBackToWorkspace(page);
|
||||
await openSettings(page);
|
||||
await expectSettingsSidebarScrollOffset(page, 0);
|
||||
});
|
||||
|
||||
test("keeps the sidebar position through interface font changes", async ({ page }) => {
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await openSettingsSection(page, "appearance");
|
||||
const offset = await scrollSettingsSidebarToEnd(page);
|
||||
await changeSettingsInterfaceFontSize(page, 20);
|
||||
await expectSettingsSidebarScrollOffset(page, offset);
|
||||
await openSettingsHostSection(page, getServerId(), "providers");
|
||||
await expectSettingsSidebarScrollOffset(page, offset);
|
||||
});
|
||||
|
||||
test("scrolls the sidebar and detail pane independently", async ({ page }) => {
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
const sidebarOffset = await scrollSettingsSidebarToEnd(page);
|
||||
await openSettingsHostSection(page, getServerId(), "providers");
|
||||
await expect(page.getByTestId("host-page-providers-card")).toBeVisible();
|
||||
const detailOffset = await scrollSettingsDetailDown(page);
|
||||
await expectSettingsSidebarScrollOffset(page, sidebarOffset);
|
||||
|
||||
await scrollSettingsSidebarUp(page, 60);
|
||||
await expectSettingsSidebarScrollOffset(page, sidebarOffset - 60);
|
||||
await expectSettingsDetailScrollOffset(page, detailOffset);
|
||||
});
|
||||
|
||||
test("keeps the sidebar position after rapid consecutive selections", async ({ page }) => {
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
|
||||
const scrollTop = await scrollSettingsSidebarToEnd(page);
|
||||
|
||||
await selectSettingsHostSectionsRapidly(page);
|
||||
await expectSettingsSidebarScrollOffset(page, scrollTop);
|
||||
|
||||
await expectSettingsSidebarScrollSettled(page, scrollTop);
|
||||
});
|
||||
|
||||
test("keeps the sidebar position when switching between app and host sections", async ({
|
||||
page,
|
||||
}) => {
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
|
||||
const hostScrollTop = await scrollSettingsSidebarToEnd(page);
|
||||
await expect(page.getByTestId("settings-host-section-providers")).toBeInViewport();
|
||||
|
||||
for (const section of [
|
||||
"providers",
|
||||
"terminals",
|
||||
"providers",
|
||||
"terminals",
|
||||
"providers",
|
||||
] as const) {
|
||||
await openSettingsHostSection(page, getServerId(), section);
|
||||
await expect(page.getByTestId("page-title")).toHaveText(
|
||||
section === "providers" ? "Providers" : "Terminals",
|
||||
);
|
||||
await expectSettingsSidebarScrollOffset(page, hostScrollTop);
|
||||
}
|
||||
|
||||
const sidebar = page.getByTestId("settings-sidebar");
|
||||
const appScrollTop = await revealSettingsSidebarSection(page, "diagnostics");
|
||||
await expect(sidebar.getByRole("button", { name: "About", exact: true })).toBeInViewport();
|
||||
|
||||
await openSettingsSection(page, "about");
|
||||
await expectAboutContent(page);
|
||||
await expectSettingsSidebarScrollOffset(page, appScrollTop);
|
||||
|
||||
await openSettingsSection(page, "diagnostics");
|
||||
await expectDiagnosticsContent(page);
|
||||
await expectSettingsSidebarScrollOffset(page, appScrollTop);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("Settings sidebar navigation", () => {
|
||||
test("opening Settings closes the composer model selector until it is opened again", async ({
|
||||
page,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { getActiveTabTestId } from "../support/helpers/launcher";
|
||||
import type { Page } from "@playwright/test";
|
||||
import { test, expect } from "../support/fixtures";
|
||||
import { expectComposerVisible } from "../support/helpers/composer";
|
||||
@@ -20,10 +19,7 @@ async function seedAnsweredAgent(title: string) {
|
||||
initialPrompt: "Why does the chat stop following new output?",
|
||||
});
|
||||
await agent.client.waitForFinish(agent.agentId, 30_000);
|
||||
await agent.client.sendAgentMessage(
|
||||
agent.agentId,
|
||||
"Make the fix and run the burst script.\n" + "Keep the previous response visible.\n".repeat(40),
|
||||
);
|
||||
await agent.client.sendAgentMessage(agent.agentId, "Make the fix and run the burst script.");
|
||||
await agent.client.waitForFinish(agent.agentId, 30_000);
|
||||
return agent;
|
||||
}
|
||||
@@ -40,67 +36,17 @@ async function rowsBetweenLatestSummaryAndReply(page: Page): Promise<number> {
|
||||
});
|
||||
}
|
||||
|
||||
async function groupedToolsInsideLatestTurn(page: Page): Promise<string[]> {
|
||||
return page.evaluate(() => {
|
||||
const rows = [...document.querySelectorAll("[data-message-id]")];
|
||||
const start = rows.findLastIndex((row) => row.querySelector("[data-testid=turn-summary]"));
|
||||
const end = rows.findLastIndex((row) => row.querySelector("[data-testid=assistant-message]"));
|
||||
return rows
|
||||
.slice(start + 1, end)
|
||||
.flatMap((row) =>
|
||||
[...row.querySelectorAll("[data-testid=tool-call-group]")].map(
|
||||
(group) => group.textContent ?? "",
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
async function expandAndCollapseLongPrompt(page: Page) {
|
||||
const prompt = page.getByTestId("user-message").last();
|
||||
const before = await prompt.boundingBox();
|
||||
const text = prompt.locator('[data-message-text="true"]');
|
||||
const messageLeft = (await text.boundingBox())!.x;
|
||||
await expect
|
||||
.poll(async () => (await prompt.getByText("Show more", { exact: true }).boundingBox())!.x)
|
||||
.toBe(messageLeft);
|
||||
await prompt.getByRole("button", { name: "Show more", exact: true }).click();
|
||||
await expect(prompt.getByRole("button", { name: "Show less", exact: true })).toBeVisible();
|
||||
await expect
|
||||
.poll(async () => (await prompt.getByText("Show less", { exact: true }).boundingBox())!.x)
|
||||
.toBe(messageLeft);
|
||||
await expect
|
||||
.poll(async () => (await prompt.boundingBox())?.height ?? 0)
|
||||
.toBeGreaterThan(before!.height);
|
||||
await prompt.getByRole("button", { name: "Show less", exact: true }).click();
|
||||
await expect.poll(async () => (await prompt.boundingBox())?.height ?? 0).toBe(before!.height);
|
||||
await prompt.scrollIntoViewIfNeeded();
|
||||
const bounds = (await prompt.boundingBox())!;
|
||||
const body = (await text.boundingBox())!;
|
||||
await page.screenshot({
|
||||
path: "/tmp/message-toggle-aligned.png",
|
||||
clip: {
|
||||
x: body.x - 16,
|
||||
y: bounds.y,
|
||||
width: bounds.x + bounds.width - body.x + 16,
|
||||
height: bounds.height,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
test.describe("Turn collapse", () => {
|
||||
test("folds each answered turn behind a summary line that opens it", async ({ page }) => {
|
||||
test.setTimeout(120_000);
|
||||
await page.setViewportSize({ width: 1280, height: 1000 });
|
||||
await useChatDisplay(page, "collapseTurns");
|
||||
const agent = await seedAnsweredAgent("Turn collapse");
|
||||
try {
|
||||
await openAgentRoute(page, agent);
|
||||
await expectComposerVisible(page);
|
||||
|
||||
await expandAndCollapseLongPrompt(page);
|
||||
|
||||
const summary = page.getByTestId("turn-summary").last().getByRole("button");
|
||||
await expect(summary).toHaveText(/^Edited 1 file/);
|
||||
await expect(summary).toHaveText(/^Wrote \d+ messages?, edited 1 file/);
|
||||
// Text chunks that stream back to back merge into one message, so the reply holds
|
||||
// at least the stream's last chunk.
|
||||
await expect(page.getByTestId("assistant-message").last()).toHaveText(
|
||||
@@ -111,9 +57,6 @@ test.describe("Turn collapse", () => {
|
||||
await summary.click();
|
||||
await expect.poll(() => rowsBetweenLatestSummaryAndReply(page)).toBeGreaterThan(0);
|
||||
await expect(summary).toBeInViewport();
|
||||
await summary.evaluate((element) => element.scrollIntoView({ block: "start" }));
|
||||
await page.screenshot({ path: "/tmp/turn-rail-aligned.png" });
|
||||
await expect.poll(() => groupedToolsInsideLatestTurn(page)).toEqual([]);
|
||||
|
||||
await summary.click();
|
||||
await expect.poll(() => rowsBetweenLatestSummaryAndReply(page)).toBe(0);
|
||||
@@ -122,38 +65,3 @@ test.describe("Turn collapse", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test("received messages show their sender and open that agent", async ({ page }) => {
|
||||
const recipient = await seedMockAgentWorkspace({
|
||||
repoPrefix: "sender-attribution-",
|
||||
title: "Implementation",
|
||||
});
|
||||
try {
|
||||
const sender = await recipient.client.createAgent({
|
||||
provider: "mock",
|
||||
cwd: recipient.cwd,
|
||||
workspaceId: recipient.workspaceId,
|
||||
title: "Reviewer",
|
||||
model: "e2e-fast-stream",
|
||||
modeId: "load-test",
|
||||
});
|
||||
await recipient.client.sendAgentMessage(
|
||||
recipient.agentId,
|
||||
"I reviewed the turn-grouping changes. Heartbeats now keep their own timing footer, and the previous response stays visible.",
|
||||
{ sourceAgentId: sender.id },
|
||||
);
|
||||
await openAgentRoute(page, recipient);
|
||||
await expectComposerVisible(page);
|
||||
const attribution = page.getByRole("button", { name: "Sent by Reviewer", exact: true });
|
||||
await expect(attribution).toBeVisible();
|
||||
await expect(page.getByTestId("user-message").filter({ has: attribution })).toContainText(
|
||||
"I reviewed the turn-grouping changes.",
|
||||
);
|
||||
await attribution.scrollIntoViewIfNeeded();
|
||||
await page.screenshot({ path: "/tmp/sender-attribution.png" });
|
||||
await attribution.click();
|
||||
await expect.poll(() => getActiveTabTestId(page)).toContain(sender.id);
|
||||
} finally {
|
||||
await recipient.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
import { expect, test } from "../support/fixtures";
|
||||
import {
|
||||
apiKeyInput,
|
||||
baseUrlInput,
|
||||
expectSheetClosed,
|
||||
expectSpeechSiteSummary,
|
||||
openSpeechSite,
|
||||
openVoiceSettings,
|
||||
providerOption,
|
||||
readSpeechSite,
|
||||
resetSpeechSite,
|
||||
saveSpeechSite,
|
||||
withUnwritableDaemonConfig,
|
||||
} from "../support/helpers/voice-settings";
|
||||
|
||||
// E2E daemons pin every speech provider to OpenAI through env vars so no test starts a model
|
||||
// download. That makes the provider picker read-only here; the env key covers the key fallback.
|
||||
const ENV_API_KEY = "sk-e2e-env-fallback";
|
||||
const SAVED_API_KEY = "sk-e2e-saved-key";
|
||||
const BASE_URL = "http://127.0.0.1:9/v1";
|
||||
|
||||
test.use({ e2eDaemonEnvironment: { OPENAI_API_KEY: ENV_API_KEY } });
|
||||
|
||||
test("configures an env-pinned OpenAI site and keeps the saved key on later saves", async ({
|
||||
page,
|
||||
}) => {
|
||||
try {
|
||||
await openVoiceSettings(page);
|
||||
await expectSpeechSiteSummary(page, "Listening", "OpenAI · whisper-1");
|
||||
|
||||
const sheet = await test.step("the env var decides the provider", async () => {
|
||||
const opened = await openSpeechSite(page, "Listening");
|
||||
await expect(opened.getByText("Set by PASEO_VOICE_STT_PROVIDER")).toBeVisible();
|
||||
await expect(providerOption(opened, "Local")).toBeDisabled();
|
||||
await expect(providerOption(opened, "OpenAI")).toHaveAttribute("aria-selected", "true");
|
||||
await expect(opened.getByText("Set by OPENAI_API_KEY")).toBeVisible();
|
||||
return opened;
|
||||
});
|
||||
|
||||
await test.step("a saved key and base URL win over the env key", async () => {
|
||||
await apiKeyInput(sheet).fill(SAVED_API_KEY);
|
||||
await baseUrlInput(sheet).fill(BASE_URL);
|
||||
await saveSpeechSite(sheet);
|
||||
await expectSheetClosed(page);
|
||||
await expect
|
||||
.poll(() => readSpeechSite("voiceMode.stt"))
|
||||
.toMatchObject({ provider: "openai", hasApiKey: true, baseUrl: BASE_URL });
|
||||
});
|
||||
|
||||
await test.step("reopening shows the key as saved without revealing it", async () => {
|
||||
const reopened = await openSpeechSite(page, "Listening");
|
||||
await expect(apiKeyInput(reopened)).toHaveValue("");
|
||||
await expect(apiKeyInput(reopened)).toHaveAttribute("placeholder", "Saved");
|
||||
await expect(reopened.getByText("Set by OPENAI_API_KEY")).toHaveCount(0);
|
||||
await expect(baseUrlInput(reopened)).toHaveValue(BASE_URL);
|
||||
await expect(reopened.getByRole("button", { name: "Save", exact: true })).toBeDisabled();
|
||||
});
|
||||
|
||||
await test.step("clearing the base URL keeps the saved key", async () => {
|
||||
const sheetAgain = page.getByRole("dialog");
|
||||
await baseUrlInput(sheetAgain).fill("");
|
||||
await saveSpeechSite(sheetAgain);
|
||||
await expectSheetClosed(page);
|
||||
const site = await readSpeechSite("voiceMode.stt");
|
||||
expect(site).toMatchObject({ provider: "openai", hasApiKey: true });
|
||||
expect(site).not.toHaveProperty("baseUrl");
|
||||
});
|
||||
} finally {
|
||||
await resetSpeechSite("voiceMode.stt");
|
||||
}
|
||||
});
|
||||
|
||||
test("a failed save keeps the sheet open with the user's input", async ({ page }) => {
|
||||
try {
|
||||
await openVoiceSettings(page);
|
||||
const sheet = await openSpeechSite(page, "Speaking");
|
||||
await baseUrlInput(sheet).fill(BASE_URL);
|
||||
|
||||
await withUnwritableDaemonConfig(async () => {
|
||||
await saveSpeechSite(sheet);
|
||||
await expect(page.getByText(/^Unable to update voice settings: /)).toBeVisible();
|
||||
});
|
||||
|
||||
await expect(baseUrlInput(sheet)).toHaveValue(BASE_URL);
|
||||
await saveSpeechSite(sheet);
|
||||
await expectSheetClosed(page);
|
||||
await expect
|
||||
.poll(() => readSpeechSite("voiceMode.tts"))
|
||||
.toMatchObject({ provider: "openai", baseUrl: BASE_URL });
|
||||
} finally {
|
||||
await resetSpeechSite("voiceMode.tts");
|
||||
}
|
||||
});
|
||||
@@ -11,10 +11,7 @@ import {
|
||||
expectWorkspaceTabVisible,
|
||||
openWorkspaceWithAgents,
|
||||
} from "../support/helpers/archive-tab";
|
||||
import {
|
||||
expectAgentAbsentFromWorkspaceLayout,
|
||||
seedForeignPinnedAgentTab,
|
||||
} from "../support/helpers/workspace-layout";
|
||||
import { expectAgentAbsentFromWorkspaceLayout } from "../support/helpers/workspace-layout";
|
||||
import { clickNewChat } from "../support/helpers/launcher";
|
||||
import { expectComposerVisible } from "../support/helpers/composer";
|
||||
import { daemonWsRoutePattern } from "../support/helpers/daemon-port";
|
||||
@@ -108,83 +105,6 @@ async function openWorkspaceTabUrl(page: Page, route: string): Promise<void> {
|
||||
test.describe("Workspace navigation regression", () => {
|
||||
test.describe.configure({ timeout: 240_000 });
|
||||
|
||||
test("removes a foreign pinned agent when restoring a saved workspace layout", async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
const serverId = getServerId();
|
||||
const firstWorkspace = await seedWorkspace({
|
||||
repoPrefix: "workspace-owner-",
|
||||
title: "Original workspace",
|
||||
});
|
||||
const secondWorkspace = await seedWorkspace({
|
||||
repoPrefix: "workspace-restored-",
|
||||
title: "Restored workspace",
|
||||
});
|
||||
try {
|
||||
const firstAgent = await createMockIdleAgent(firstWorkspace.client, {
|
||||
cwd: firstWorkspace.repoPath,
|
||||
workspaceId: firstWorkspace.workspaceId,
|
||||
title: "Original workspace agent",
|
||||
});
|
||||
const secondAgent = await createMockIdleAgent(secondWorkspace.client, {
|
||||
cwd: secondWorkspace.repoPath,
|
||||
workspaceId: secondWorkspace.workspaceId,
|
||||
title: "Restored workspace agent",
|
||||
});
|
||||
await gotoAppShell(page);
|
||||
await openWorkspaceWithAgents(page, [firstAgent, secondAgent]);
|
||||
await seedForeignPinnedAgentTab(page, {
|
||||
serverId,
|
||||
workspaceId: secondWorkspace.workspaceId,
|
||||
agentId: firstAgent.id,
|
||||
});
|
||||
|
||||
await page.reload();
|
||||
await waitForSidebarHydration(page);
|
||||
await waitForWorkspaceTabsVisible(page);
|
||||
await expectWorkspaceHeader(page, {
|
||||
title: secondWorkspace.workspaceName,
|
||||
subtitle: secondWorkspace.projectDisplayName,
|
||||
});
|
||||
await testInfo.attach("hydrated-workspace", {
|
||||
body: await page.screenshot({ path: testInfo.outputPath("hydrated-workspace.png") }),
|
||||
contentType: "image/png",
|
||||
});
|
||||
await expectAgentAbsentFromWorkspaceLayout(page, {
|
||||
serverId,
|
||||
workspaceId: secondWorkspace.workspaceId,
|
||||
agentId: firstAgent.id,
|
||||
});
|
||||
await expectOnlyWorkspaceAgentTabsVisible(page, [secondAgent.id]);
|
||||
await testInfo.attach("restored-workspace", {
|
||||
body: await page.screenshot({ path: testInfo.outputPath("restored-workspace.png") }),
|
||||
contentType: "image/png",
|
||||
});
|
||||
|
||||
await switchWorkspaceViaSidebar({
|
||||
page,
|
||||
serverId,
|
||||
workspaceId: firstWorkspace.workspaceId,
|
||||
});
|
||||
await waitForWorkspaceTabsVisible(page);
|
||||
await expectOnlyWorkspaceAgentTabsVisible(page, [firstAgent.id]);
|
||||
const agents = await firstWorkspace.client.fetchAgents();
|
||||
expect(
|
||||
agents.entries.find(({ agent }) => agent.id === firstAgent.id)?.agent.workspaceId,
|
||||
).toBe(firstWorkspace.workspaceId);
|
||||
expect(
|
||||
agents.entries.find(({ agent }) => agent.id === secondAgent.id)?.agent.workspaceId,
|
||||
).toBe(secondWorkspace.workspaceId);
|
||||
await testInfo.attach("original-workspace", {
|
||||
body: await page.screenshot({ path: testInfo.outputPath("original-workspace.png") }),
|
||||
contentType: "image/png",
|
||||
});
|
||||
} finally {
|
||||
await secondWorkspace.cleanup();
|
||||
await firstWorkspace.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("keeps an offline notification on the agent route until the host connects", async ({
|
||||
page,
|
||||
}) => {
|
||||
|
||||
@@ -28,10 +28,7 @@ function contains(outer, inner) {
|
||||
* while suggestions are open, so its callers read the composer from `reference`: a
|
||||
* snapshot in the same keyboard state with an empty input.
|
||||
*/
|
||||
export function resolveAutocompletePlacement(
|
||||
snapshot,
|
||||
{ expected, keyboardTop, reference, anchorGap },
|
||||
) {
|
||||
export function resolveAutocompletePlacement(snapshot, { expected, keyboardTop, reference }) {
|
||||
if (!snapshot.success || !snapshot.data?.nodes?.length) throw new Error("Empty device snapshot");
|
||||
const nodes = snapshot.data.nodes;
|
||||
const popover = findById(nodes, "composer-autocomplete-popover").rect;
|
||||
@@ -43,10 +40,6 @@ export function resolveAutocompletePlacement(
|
||||
const keyboardY =
|
||||
keyboardTop ?? nodes.find((node) => node.type === "Keyboard" && node.rect)?.rect.y;
|
||||
const popoverBottom = bottomOf(popover);
|
||||
const gap = composer.y - popoverBottom;
|
||||
if (anchorGap !== undefined && Math.abs(gap - anchorGap) > 1) {
|
||||
throw new Error(`Autocomplete lost its anchor gap: gap=${gap}, expected=${anchorGap}`);
|
||||
}
|
||||
if (popoverBottom > composer.y + 1) {
|
||||
throw new Error(
|
||||
`Autocomplete overlaps the composer: popover bottom=${popoverBottom}, composer top=${composer.y}`,
|
||||
|
||||
@@ -14,8 +14,7 @@ const env = (name, fallback) => process.env[`PASEO_COMPOSER_KEYBOARD_${name}`] ?
|
||||
const serverId = env("SERVER_ID");
|
||||
const agentId = env("AGENT_ID");
|
||||
const workspaceId = env("WORKSPACE_ID");
|
||||
const scenario = env("SCENARIO", "all");
|
||||
if (!serverId || !workspaceId || (scenario === "all" && !agentId)) {
|
||||
if (!serverId || !agentId || !workspaceId) {
|
||||
throw new Error(
|
||||
"Set PASEO_COMPOSER_KEYBOARD_SERVER_ID, _AGENT_ID (an idle chat) and _WORKSPACE_ID (its workspace)",
|
||||
);
|
||||
@@ -23,12 +22,7 @@ if (!serverId || !workspaceId || (scenario === "all" && !agentId)) {
|
||||
const draftId = env("DRAFT_ID", "composer-keyboard");
|
||||
const session = env("SESSION", "composer-keyboard-ios");
|
||||
const device = env("DEVICE", "iPhone 16 Pro");
|
||||
const udid = env("UDID");
|
||||
const deviceArgs = udid ? ["--udid", udid] : ["--device", device];
|
||||
const artifactsDir = env(
|
||||
"ARTIFACTS_DIR",
|
||||
path.join(repoRoot, ".dev/agent-device-artifacts/composer-keyboard-ios"),
|
||||
);
|
||||
const artifactsDir = path.join(repoRoot, ".dev/agent-device-artifacts/composer-keyboard-ios");
|
||||
const grownPrefix = "grown line one\ngrown line two\ngrown line three\n";
|
||||
// Partial queries with known best matches. `inserted` is the composer text after
|
||||
// tapping the best match.
|
||||
@@ -41,7 +35,7 @@ const chatCommandCase = { text: "/mo", expected: "/mock", inserted: "/mock " };
|
||||
fs.mkdirSync(artifactsDir, { recursive: true });
|
||||
|
||||
function ad(...args) {
|
||||
return execFileSync("agent-device", [args[0], "--session", session, ...args.slice(1)], {
|
||||
return execFileSync("agent-device", [...args, "--session", session], {
|
||||
encoding: "utf8",
|
||||
maxBuffer: 64 * 1024 * 1024,
|
||||
});
|
||||
@@ -83,7 +77,7 @@ async function settledPlacement(name, keyboard) {
|
||||
}
|
||||
|
||||
function assertPlacement(name, snap, expected) {
|
||||
const placement = resolveAutocompletePlacement(snap, { expected, anchorGap: 12 });
|
||||
const placement = resolveAutocompletePlacement(snap, { expected });
|
||||
process.stdout.write(
|
||||
`PASS ${name}: popover ${Math.round(placement.popover.y)}-${Math.round(
|
||||
placement.popover.y + placement.popover.height,
|
||||
@@ -129,34 +123,21 @@ async function clearInput(name) {
|
||||
)?.rect;
|
||||
if (!deleteKey) throw new Error("Missing keyboard delete key");
|
||||
const length = composerText(keyboard).length;
|
||||
for (let remaining = length + 2; remaining > 0; remaining -= 100) {
|
||||
ad(
|
||||
"press",
|
||||
String(Math.round(deleteKey.x + deleteKey.width / 2)),
|
||||
String(Math.round(deleteKey.y + deleteKey.height / 2)),
|
||||
"--count",
|
||||
String(Math.min(remaining, 100)),
|
||||
"--interval-ms",
|
||||
"40",
|
||||
);
|
||||
}
|
||||
ad(
|
||||
"press",
|
||||
String(Math.round(deleteKey.x + deleteKey.width / 2)),
|
||||
String(Math.round(deleteKey.y + deleteKey.height / 2)),
|
||||
"--count",
|
||||
String(length + 2),
|
||||
"--interval-ms",
|
||||
"40",
|
||||
);
|
||||
}
|
||||
|
||||
// The accessibility value drops a trailing space.
|
||||
const sameText = (actual, expected) => actual.trimEnd() === expected.trimEnd();
|
||||
|
||||
async function selectRow(name, row, inserted) {
|
||||
ad("press", String(row.x), String(row.y));
|
||||
const selected = await waitFor(`${name}-selected`, (snap) =>
|
||||
sameText(composerText(snap), inserted),
|
||||
);
|
||||
if (!keyboardShown(selected)) throw new Error(`Selecting ${row.label} closed the keyboard`);
|
||||
process.stdout.write(
|
||||
`PASS ${name}: tapped ${row.label}, composer now ${JSON.stringify(inserted)}\n`,
|
||||
);
|
||||
}
|
||||
|
||||
async function runCase(host, kind, { text, expected, inserted, selectionKeyboard = "reopened" }) {
|
||||
async function runCase(host, kind, { text, expected, inserted }) {
|
||||
const name = `${host}-${kind}`;
|
||||
await clearInput(name);
|
||||
await dismissKeyboard(snapshot(`${name}-empty`));
|
||||
@@ -170,32 +151,31 @@ async function runCase(host, kind, { text, expected, inserted, selectionKeyboard
|
||||
await clearInput(`${name}-settled`);
|
||||
await waitFor(`${name}-settled-empty`, (snap) => composerText(snap) === "");
|
||||
ad("type", text);
|
||||
const opened = assertPlacement(
|
||||
assertPlacement(
|
||||
`${name} opened after keyboard settled`,
|
||||
await settledPlacement(`${name}-open`, true),
|
||||
expected,
|
||||
);
|
||||
if (selectionKeyboard === "shown") {
|
||||
await selectRow(name, opened, inserted);
|
||||
return;
|
||||
}
|
||||
await dismissKeyboard(snapshot(`${name}-before-close`));
|
||||
const closed = assertPlacement(
|
||||
assertPlacement(
|
||||
`${name} keyboard closed`,
|
||||
await settledPlacement(`${name}-closed`, false),
|
||||
expected,
|
||||
);
|
||||
if (selectionKeyboard === "hidden") {
|
||||
await selectRow(name, closed, inserted);
|
||||
return;
|
||||
}
|
||||
focusAtEnd(snapshot(`${name}-before-reopen`));
|
||||
const reopened = assertPlacement(
|
||||
`${name} keyboard opened under open suggestions`,
|
||||
await settledPlacement(`${name}-reopened`, true),
|
||||
expected,
|
||||
);
|
||||
await selectRow(name, reopened, inserted);
|
||||
ad("press", String(reopened.x), String(reopened.y));
|
||||
const selected = await waitFor(`${name}-selected`, (snap) =>
|
||||
sameText(composerText(snap), inserted),
|
||||
);
|
||||
if (!keyboardShown(selected)) throw new Error(`Selecting ${expected} closed the keyboard`);
|
||||
process.stdout.write(
|
||||
`PASS ${name}: tapped ${expected}, composer now ${JSON.stringify(inserted)}\n`,
|
||||
);
|
||||
}
|
||||
|
||||
// Drafts list commands for their selected provider, and a fresh install selects none.
|
||||
@@ -236,104 +216,13 @@ async function runHost(host) {
|
||||
await dismissKeyboard(snapshot(`${host}-done`));
|
||||
}
|
||||
|
||||
// These cases use the selected draft provider's real skills. Run on a 402pt-wide
|
||||
// iPhone for growth and a small phone (SE) for previews, with Codex selected.
|
||||
async function runLiveGrowth() {
|
||||
await clearInput("live-growth");
|
||||
ad("type", "Please do the following now /paseo");
|
||||
const before = await settledPlacement("live-growth-before", true);
|
||||
assertPlacement("before growth", before, "/paseo");
|
||||
const inputHeight = (snap) =>
|
||||
snap.data.nodes.find((node) => node.type === "TextView").rect.height;
|
||||
ad("type", "--", "-committee");
|
||||
const grown = await settledPlacement("live-growth-after", true);
|
||||
if (inputHeight(grown) <= inputHeight(before))
|
||||
throw new Error("Draft did not wrap onto a new line");
|
||||
assertPlacement("live growth without reopening", grown, "/paseo-committee");
|
||||
const deleteKey = grown.data.nodes.find(
|
||||
(node) => node.type === "Key" && node.label === "delete",
|
||||
).rect;
|
||||
ad(
|
||||
"press",
|
||||
String(deleteKey.x + deleteKey.width / 2),
|
||||
String(deleteKey.y + deleteKey.height / 2),
|
||||
"--count",
|
||||
"10",
|
||||
"--interval-ms",
|
||||
"40",
|
||||
);
|
||||
const shrunk = await settledPlacement("live-growth-shrunk", true);
|
||||
if (inputHeight(shrunk) !== inputHeight(before))
|
||||
throw new Error("Draft did not shrink back to one line");
|
||||
assertPlacement("live shrink without reopening", shrunk, "/paseo");
|
||||
ad("type", "--", "-committ");
|
||||
const partial = await settledPlacement("live-growth-partial", true);
|
||||
if (!sameText(composerText(partial), "Please do the following now /paseo-committ")) {
|
||||
throw new Error("Could not prepare a partial command for selection");
|
||||
}
|
||||
const row = assertPlacement("partial command after growth", partial, "/paseo-committee");
|
||||
ad("press", String(row.x), String(row.y));
|
||||
await waitFor("live-growth-selected", (snap) =>
|
||||
sameText(composerText(snap), "Please do the following now /paseo-committee "),
|
||||
);
|
||||
await clearInput("live-growth-done");
|
||||
}
|
||||
|
||||
async function runBoundedPreview() {
|
||||
const prefix =
|
||||
"Please do the following / testing inline selection.\n" +
|
||||
"Line two with details.\nLine three with details.\nLine four with details.\n" +
|
||||
"Line five with details.\nLine six with details.\nLine seven with details.\nPlease use ";
|
||||
await runCase("preview", "long", {
|
||||
text: `${prefix}/openai`,
|
||||
expected: "/openai-docs",
|
||||
inserted: `${prefix}/openai-docs `,
|
||||
selectionKeyboard: "shown",
|
||||
});
|
||||
await runCase("preview", "long-hidden", {
|
||||
text: `${prefix}/openai`,
|
||||
expected: "/openai-docs",
|
||||
inserted: `${prefix}/openai-docs `,
|
||||
selectionKeyboard: "hidden",
|
||||
});
|
||||
await runCase("preview", "longest", {
|
||||
text: `${prefix}/paseo-plug`,
|
||||
expected: "/paseo-plugin",
|
||||
inserted: `${prefix}/paseo-plugin `,
|
||||
selectionKeyboard: "shown",
|
||||
});
|
||||
await runCase("preview", "short", {
|
||||
text: `${prefix}/com`,
|
||||
expected: "/commit",
|
||||
inserted: `${prefix}/commit `,
|
||||
selectionKeyboard: "shown",
|
||||
});
|
||||
await runCase("preview", "files", fileCase);
|
||||
}
|
||||
|
||||
if (scenario !== "all") {
|
||||
ad(
|
||||
"open",
|
||||
`paseo://h/${serverId}/workspace/${workspaceId}?open=draft%3A${draftId}`,
|
||||
"--platform",
|
||||
"ios",
|
||||
...deviceArgs,
|
||||
);
|
||||
await waitFor("draft", (snap) => Boolean(nodeById(snap, "message-input-root")), 60_000);
|
||||
if (scenario === "growth") await runLiveGrowth();
|
||||
else if (scenario === "previews") await runBoundedPreview();
|
||||
else throw new Error(`Unknown scenario: ${scenario}`);
|
||||
process.stdout.write(`Composer ${scenario} regression passed. Artifacts: ${artifactsDir}\n`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const hosts = [
|
||||
["chat", `paseo://h/${serverId}/agent/${agentId}`],
|
||||
["workspace-draft", `paseo://h/${serverId}/workspace/${workspaceId}?open=draft%3A${draftId}`],
|
||||
["new-workspace", `paseo://new?serverId=${serverId}`],
|
||||
];
|
||||
for (const [host, url] of hosts) {
|
||||
ad("open", url, "--platform", "ios", ...deviceArgs);
|
||||
ad("open", url, "--platform", "ios", "--device", device);
|
||||
await waitFor(host, (snap) => Boolean(nodeById(snap, "message-input-root")), 60_000);
|
||||
await runHost(host);
|
||||
}
|
||||
|
||||
@@ -87,14 +87,6 @@ export async function sendDraftToQueue(page: Page): Promise<void> {
|
||||
await composerInput(page).press("Control+Enter");
|
||||
}
|
||||
|
||||
/** Long-press the Send button: the composer takes the draft while the pointer is still down. */
|
||||
export async function holdSendButton(page: Page, label: string): Promise<void> {
|
||||
await page.getByRole("button", { name: label, exact: true }).hover();
|
||||
await page.mouse.down();
|
||||
await expect(composerInput(page)).toHaveValue("", { timeout: 5_000 });
|
||||
await page.mouse.up();
|
||||
}
|
||||
|
||||
export async function expectQueuedMessageButton(page: Page): Promise<void> {
|
||||
await expect(page.getByRole("button", { name: "Send queued message now" })).toBeVisible({
|
||||
timeout: 10_000,
|
||||
|
||||
@@ -149,11 +149,7 @@ export interface SeedDaemonClient {
|
||||
timeout?: number,
|
||||
): Promise<{ status: string }>;
|
||||
cancelAgent(agentId: string): Promise<void>;
|
||||
sendAgentMessage(
|
||||
agentId: string,
|
||||
text: string,
|
||||
options?: { sourceAgentId?: string },
|
||||
): Promise<void>;
|
||||
sendAgentMessage(agentId: string, text: string): Promise<void>;
|
||||
waitForFinish(
|
||||
agentId: string,
|
||||
timeout?: number,
|
||||
|
||||
@@ -42,7 +42,6 @@ type HostSection =
|
||||
| "pair-device"
|
||||
| "agents"
|
||||
| "metadata"
|
||||
| "voice"
|
||||
| "workspaces"
|
||||
| "providers"
|
||||
| "usage"
|
||||
@@ -58,92 +57,6 @@ export async function openSettingsSection(page: Page, section: SettingsSection):
|
||||
await expectAppRoute(page, buildSettingsSectionRoute(section));
|
||||
}
|
||||
|
||||
export async function revealSettingsSidebarSection(
|
||||
page: Page,
|
||||
section: SettingsSection,
|
||||
): Promise<number> {
|
||||
await page
|
||||
.getByRole("navigation", { name: "Settings" })
|
||||
.getByRole("button", { name: SECTION_LABELS[section], exact: true })
|
||||
.scrollIntoViewIfNeeded();
|
||||
const offset = await page
|
||||
.getByTestId("settings-sidebar-scroll-body")
|
||||
.evaluate((node) => node.scrollTop);
|
||||
expect(offset).toBeGreaterThan(0);
|
||||
return offset;
|
||||
}
|
||||
|
||||
export async function expectSettingsSidebarScrollSettled(
|
||||
page: Page,
|
||||
offset: number,
|
||||
): Promise<void> {
|
||||
// RN Web emits its final scroll callback 100 ms after scrolling stops.
|
||||
await page.waitForTimeout(200);
|
||||
await expectSettingsSidebarScrollOffset(page, offset);
|
||||
}
|
||||
|
||||
export async function selectSettingsHostSectionsRapidly(page: Page): Promise<void> {
|
||||
for (let selection = 0; selection < 5; selection += 1) {
|
||||
await page
|
||||
.getByRole("navigation", { name: "Settings" })
|
||||
.getByRole("button", { name: "Providers", exact: true })
|
||||
.click();
|
||||
await page
|
||||
.getByRole("navigation", { name: "Settings" })
|
||||
.getByRole("button", { name: "Terminals", exact: true })
|
||||
.click();
|
||||
await expectSettingsHeader(page, "Terminals");
|
||||
}
|
||||
}
|
||||
|
||||
export async function scrollSettingsSidebarUp(page: Page, pixels: number): Promise<void> {
|
||||
await page.getByTestId("settings-sidebar-scroll-body").hover();
|
||||
await page.mouse.wheel(0, -pixels);
|
||||
}
|
||||
|
||||
export async function changeSettingsInterfaceFontSize(page: Page, size: number): Promise<void> {
|
||||
const input = page.getByRole("textbox", { name: "Interface font size" });
|
||||
await input.fill(String(size));
|
||||
await input.press("Tab");
|
||||
await expect(input).toHaveValue(String(size));
|
||||
}
|
||||
|
||||
export async function scrollSettingsSidebarToEnd(page: Page): Promise<number> {
|
||||
const scrollBody = page.locator('[data-testid="settings-sidebar-scroll-body"]:visible');
|
||||
await scrollBody.hover();
|
||||
await page.mouse.wheel(0, 2000);
|
||||
await expect
|
||||
.poll(() =>
|
||||
scrollBody.evaluate((node) => node.scrollHeight - node.clientHeight - node.scrollTop),
|
||||
)
|
||||
.toBe(0);
|
||||
const offset = await scrollBody.evaluate((node) => node.scrollTop);
|
||||
expect(offset).toBeGreaterThan(0);
|
||||
return offset;
|
||||
}
|
||||
|
||||
export async function expectSettingsSidebarScrollOffset(page: Page, offset: number): Promise<void> {
|
||||
const scrollBody = page.locator('[data-testid="settings-sidebar-scroll-body"]:visible');
|
||||
await expect.poll(() => scrollBody.evaluate((node) => node.scrollTop)).toBe(offset);
|
||||
}
|
||||
|
||||
export async function scrollSettingsDetailDown(page: Page): Promise<number> {
|
||||
const scrollBody = page.getByTestId("settings-detail-scroll-body");
|
||||
await expect
|
||||
.poll(() => scrollBody.evaluate((node) => node.scrollHeight - node.clientHeight))
|
||||
.toBeGreaterThan(0);
|
||||
await scrollBody.hover();
|
||||
await page.mouse.wheel(0, 1000);
|
||||
await expect.poll(() => scrollBody.evaluate((node) => node.scrollTop)).toBeGreaterThan(0);
|
||||
const offset = await scrollBody.evaluate((node) => node.scrollTop);
|
||||
return offset;
|
||||
}
|
||||
|
||||
export async function expectSettingsDetailScrollOffset(page: Page, offset: number): Promise<void> {
|
||||
const scrollBody = page.getByTestId("settings-detail-scroll-body");
|
||||
await expect.poll(() => scrollBody.evaluate((node) => node.scrollTop)).toBe(offset);
|
||||
}
|
||||
|
||||
export async function openSettingsHost(page: Page, serverId: string): Promise<void> {
|
||||
// Host sections are now flat top-level rows under the Host group. Navigate by
|
||||
// clicking the Connections section row; the picker only matters when >1 host.
|
||||
|
||||
@@ -188,7 +188,7 @@ export async function expectManagedSubagentArchived(
|
||||
}
|
||||
|
||||
export async function archiveFinishedSubagents(page: Page): Promise<void> {
|
||||
await page.getByRole("menuitem", { name: "Archive finished subagents" }).click();
|
||||
await page.getByRole("button", { name: "Archive finished subagents" }).click();
|
||||
}
|
||||
|
||||
export async function expectArchiveFinishedInProgress(
|
||||
@@ -196,7 +196,7 @@ export async function expectArchiveFinishedInProgress(
|
||||
completed: number,
|
||||
total: number,
|
||||
): Promise<void> {
|
||||
await expect(page.getByRole("menuitem", { name: "Archive finished subagents" })).toBeDisabled();
|
||||
await expect(page.getByRole("button", { name: "Archive finished subagents" })).toBeDisabled();
|
||||
await expect(page.getByText(`${completed}/${total}`, { exact: true })).toBeVisible();
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ export async function expectArchiveFinishedRetry(
|
||||
total: number,
|
||||
): Promise<void> {
|
||||
await expect(page.getByText(`Retry (${failed}/${total})`, { exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("menuitem", { name: "Archive finished subagents" })).toBeEnabled();
|
||||
await expect(page.getByRole("button", { name: "Archive finished subagents" })).toBeEnabled();
|
||||
}
|
||||
|
||||
export async function holdManagedSubagentArchiveRequest(
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
import { rename, mkdir, rmdir } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { expect, type Locator, type Page } from "@playwright/test";
|
||||
import { gotoAppShell, openSettings } from "./app";
|
||||
import { connectNewWorkspaceDaemonClient } from "./new-workspace";
|
||||
import { getServerId } from "./server-id";
|
||||
import { expectSettingsHeader, openHostSection, openSettingsHost } from "./settings";
|
||||
|
||||
export type SpeechSiteLabel = "Speech-to-text" | "Listening" | "Speaking";
|
||||
type SpeechSiteId = "dictation.stt" | "voiceMode.stt" | "voiceMode.tts";
|
||||
|
||||
export async function openVoiceSettings(page: Page): Promise<void> {
|
||||
const serverId = getServerId();
|
||||
await gotoAppShell(page);
|
||||
await openSettings(page);
|
||||
await openSettingsHost(page, serverId);
|
||||
await openHostSection(page, serverId, "voice");
|
||||
await expectSettingsHeader(page, "Voice");
|
||||
}
|
||||
|
||||
function speechSiteRow(page: Page, label: SpeechSiteLabel): Locator {
|
||||
return page.getByRole("button", { name: new RegExp(`^${label}, `) });
|
||||
}
|
||||
|
||||
export async function expectSpeechSiteSummary(
|
||||
page: Page,
|
||||
label: SpeechSiteLabel,
|
||||
summary: string,
|
||||
): Promise<void> {
|
||||
await expect(speechSiteRow(page, label)).toHaveAccessibleName(`${label}, ${summary}`);
|
||||
}
|
||||
|
||||
/** Opens the provider sheet for one use site and returns it. */
|
||||
export async function openSpeechSite(page: Page, label: SpeechSiteLabel): Promise<Locator> {
|
||||
await speechSiteRow(page, label).click();
|
||||
const sheet = page.getByRole("dialog");
|
||||
await expect(sheet.getByText(label, { exact: true })).toBeVisible();
|
||||
return sheet;
|
||||
}
|
||||
|
||||
export function providerOption(sheet: Locator, provider: "Local" | "OpenAI"): Locator {
|
||||
return sheet.getByRole("button", { name: provider, exact: true });
|
||||
}
|
||||
|
||||
export function apiKeyInput(sheet: Locator): Locator {
|
||||
return sheet.getByRole("textbox", { name: "API key" });
|
||||
}
|
||||
|
||||
export function baseUrlInput(sheet: Locator): Locator {
|
||||
return sheet.getByRole("textbox", { name: "Base URL" });
|
||||
}
|
||||
|
||||
export async function saveSpeechSite(sheet: Locator): Promise<void> {
|
||||
await sheet.getByRole("button", { name: "Save", exact: true }).click();
|
||||
}
|
||||
|
||||
export async function expectSheetClosed(page: Page): Promise<void> {
|
||||
await expect(page.getByRole("dialog")).toHaveCount(0);
|
||||
}
|
||||
|
||||
/** The speech site as the daemon reports it; the API key itself never leaves the daemon. */
|
||||
export async function readSpeechSite(siteId: SpeechSiteId): Promise<Record<string, unknown>> {
|
||||
const client = await connectNewWorkspaceDaemonClient({ ownProjects: false });
|
||||
try {
|
||||
const { config } = await client.getDaemonConfig();
|
||||
const features = config.features as Record<string, Record<string, unknown>>;
|
||||
const [feature, site] = siteId.split(".");
|
||||
return features[feature][site] as Record<string, unknown>;
|
||||
} finally {
|
||||
await client.close().catch(() => undefined);
|
||||
}
|
||||
}
|
||||
|
||||
/** Puts a speech site back to the default provider so later tests start from a known state. */
|
||||
export async function resetSpeechSite(siteId: SpeechSiteId): Promise<void> {
|
||||
const client = await connectNewWorkspaceDaemonClient({ ownProjects: false });
|
||||
try {
|
||||
const [feature, site] = siteId.split(".");
|
||||
await client.patchDaemonConfig({ features: { [feature]: { [site]: { provider: "local" } } } });
|
||||
} finally {
|
||||
await client.close().catch(() => undefined);
|
||||
}
|
||||
}
|
||||
|
||||
/** Makes the daemon's config file unreadable for the duration of `run`. */
|
||||
export async function withUnwritableDaemonConfig(run: () => Promise<void>): Promise<void> {
|
||||
const paseoHome = process.env.E2E_PASEO_HOME;
|
||||
if (!paseoHome) throw new Error("E2E_PASEO_HOME is required to break the daemon config");
|
||||
const configPath = path.join(paseoHome, "config.json");
|
||||
const asidePath = `${configPath}.aside`;
|
||||
await rename(configPath, asidePath);
|
||||
await mkdir(configPath);
|
||||
try {
|
||||
await run();
|
||||
} finally {
|
||||
await rmdir(configPath);
|
||||
await rename(asidePath, configPath);
|
||||
}
|
||||
}
|
||||
@@ -1,47 +1,12 @@
|
||||
import { expect, type Page } from "@playwright/test";
|
||||
import { z } from "zod";
|
||||
import { WorkspaceLayoutPersistedStateSchema } from "../../../src/stores/workspace-layout-storage";
|
||||
import { openTabInLayoutFocused } from "../../../src/stores/workspace-layout-actions";
|
||||
import {
|
||||
buildWorkspaceTabPersistenceKey,
|
||||
type WorkspaceTab,
|
||||
} from "../../../src/workspace-tabs/model";
|
||||
import { getServerId } from "./server-id";
|
||||
|
||||
export async function seedForeignPinnedAgentTab(
|
||||
page: Page,
|
||||
input: { serverId: string; workspaceId: string; agentId: string },
|
||||
): Promise<void> {
|
||||
const raw = await page.evaluate(() => localStorage.getItem("workspace-layout-state"));
|
||||
if (raw === null) throw new Error("Workspace layout was not persisted");
|
||||
const stored = z
|
||||
.object({ state: WorkspaceLayoutPersistedStateSchema, version: z.number().optional() })
|
||||
.parse(JSON.parse(raw));
|
||||
const key = buildWorkspaceTabPersistenceKey(input);
|
||||
const layout = key ? stored.state.layoutByWorkspace[key] : null;
|
||||
if (!key || !layout) throw new Error(`No persisted layout for workspace ${input.workspaceId}`);
|
||||
const opened = openTabInLayoutFocused({
|
||||
layout,
|
||||
target: { kind: "agent", agentId: input.agentId },
|
||||
now: 1,
|
||||
placement: { mode: "focused" },
|
||||
explorerSidebarPaneId: stored.state.explorerSidebarPaneIdByWorkspace?.[key] ?? null,
|
||||
});
|
||||
if (!opened) throw new Error("Failed to seed foreign agent tab");
|
||||
stored.state = WorkspaceLayoutPersistedStateSchema.parse({
|
||||
...stored.state,
|
||||
layoutByWorkspace: { ...stored.state.layoutByWorkspace, [key]: opened.layout },
|
||||
pinnedAgentIdsByWorkspace: {
|
||||
...stored.state.pinnedAgentIdsByWorkspace,
|
||||
[key]: [...(stored.state.pinnedAgentIdsByWorkspace?.[key] ?? []), input.agentId],
|
||||
},
|
||||
});
|
||||
await page.evaluate(
|
||||
(value) => localStorage.setItem("workspace-layout-state", value),
|
||||
JSON.stringify(stored),
|
||||
);
|
||||
}
|
||||
|
||||
/** Seed the reported hidden Explorer-only layout with 2,250 saved agent draft tabs. */
|
||||
export async function seedCorruptedWorkspaceLayout(page: Page, workspaceId: string): Promise<void> {
|
||||
const raw = await page.evaluate(() => localStorage.getItem("workspace-layout-state"));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@getpaseo/app",
|
||||
"version": "0.13.2",
|
||||
"version": "0.13.0",
|
||||
"private": true,
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
@@ -126,14 +126,14 @@
|
||||
"react-native-gesture-handler": "~2.32.0",
|
||||
"react-native-keyboard-controller": "1.21.12",
|
||||
"react-native-nitro-modules": "0.35.5",
|
||||
"react-native-reanimated": "4.5.5",
|
||||
"react-native-reanimated": "4.5.1",
|
||||
"react-native-safe-area-context": "~5.7.0",
|
||||
"react-native-screens": "~4.26.0",
|
||||
"react-native-svg": "15.15.4",
|
||||
"react-native-unistyles": "^3.2.4",
|
||||
"react-native-web": "~0.21.0",
|
||||
"react-native-webview": "13.16.1",
|
||||
"react-native-worklets": "0.10.4",
|
||||
"react-native-worklets": "0.10.1",
|
||||
"tiny-invariant": "^1.3.3",
|
||||
"turndown": "^7.2.4",
|
||||
"turndown-plugin-gfm": "^1.0.2",
|
||||
@@ -198,14 +198,6 @@
|
||||
],
|
||||
"enableVideo": false
|
||||
},
|
||||
"expo": {
|
||||
"install": {
|
||||
"exclude": [
|
||||
"react-native-reanimated",
|
||||
"react-native-worklets"
|
||||
]
|
||||
}
|
||||
},
|
||||
"reanimated": {
|
||||
"staticFeatureFlags": {
|
||||
"FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS": false
|
||||
|
||||
@@ -71,7 +71,7 @@ function layoutFor(input: { platform: "web" | "native"; isTurnActive: boolean })
|
||||
isTurnActive: input.isTurnActive,
|
||||
history: strategy.orderTail([userMessage("user"), assistant]),
|
||||
liveHead: [],
|
||||
timingByItemId: timingFor(assistant.id),
|
||||
timingByAssistantId: timingFor(assistant.id),
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ function layoutFor(input: {
|
||||
strategy,
|
||||
streamHead: input.head ?? [],
|
||||
}),
|
||||
timingByItemId: timingFor(...(input.timingIds ?? [])),
|
||||
timingByAssistantId: timingFor(...(input.timingIds ?? [])),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ function findLayoutItem(layout: StreamLayout, id: string): StreamLayoutItem {
|
||||
}
|
||||
|
||||
describe("layoutStream", () => {
|
||||
it("keeps separate footers for an assistant turn and an adjacent tool-only turn", () => {
|
||||
it("places one response footer after an adjacent tagged tool-only turn", () => {
|
||||
const priorAssistant = assistantMessage("prior", 1, undefined, "turn-1");
|
||||
const nextTool = toolCall("next-tool", 2, "turn-2");
|
||||
const layout = layoutFor({
|
||||
@@ -157,8 +157,8 @@ describe("layoutStream", () => {
|
||||
timingIds: [priorAssistant.id],
|
||||
});
|
||||
|
||||
expect(layout.auxiliaryTurnFooter?.itemId).toBe(nextTool.id);
|
||||
expect(footerOwners(layout)).toEqual([priorAssistant.id, nextTool.id]);
|
||||
expect(layout.auxiliaryTurnFooter?.itemId).toBe(priorAssistant.id);
|
||||
expect(footerOwners(layout)).toEqual([priorAssistant.id]);
|
||||
});
|
||||
|
||||
it("recomputes cached history layout when only the live boundary turn changes", () => {
|
||||
@@ -171,7 +171,7 @@ describe("layoutStream", () => {
|
||||
isTurnActive: true,
|
||||
history,
|
||||
liveHead,
|
||||
timingByItemId: timingFor(priorAssistant.id),
|
||||
timingByAssistantId: timingFor(priorAssistant.id),
|
||||
});
|
||||
|
||||
liveHead[0] = { ...liveHead[0]!, turnId: "turn-2" };
|
||||
@@ -180,7 +180,7 @@ describe("layoutStream", () => {
|
||||
isTurnActive: true,
|
||||
history,
|
||||
liveHead,
|
||||
timingByItemId: timingFor(priorAssistant.id),
|
||||
timingByAssistantId: timingFor(priorAssistant.id),
|
||||
});
|
||||
|
||||
expect(footerOwners(first)).toEqual([]);
|
||||
|
||||
@@ -39,13 +39,13 @@ export interface StreamLayoutInput {
|
||||
isTurnActive: boolean;
|
||||
history: StreamItem[];
|
||||
liveHead: StreamItem[];
|
||||
timingByItemId: Map<string, TurnTiming>;
|
||||
timingByAssistantId: Map<string, TurnTiming>;
|
||||
}
|
||||
|
||||
interface LayoutSegmentInput {
|
||||
strategy: StreamStrategy;
|
||||
items: StreamItem[];
|
||||
timingByItemId: Map<string, TurnTiming>;
|
||||
timingByAssistantId: Map<string, TurnTiming>;
|
||||
auxiliaryTurnFooter: TurnFooterHost | null;
|
||||
hasAuxiliaryFooter: boolean;
|
||||
frameOrder: StreamFrameChildOrder;
|
||||
@@ -57,8 +57,8 @@ interface LayoutSegmentInput {
|
||||
phase: "streaming" | "complete";
|
||||
}
|
||||
|
||||
interface TurnFooterSource {
|
||||
item: StreamItem;
|
||||
interface AssistantFooterSource {
|
||||
item: Extract<StreamItem, { kind: "assistant_message" }>;
|
||||
items: StreamItem[];
|
||||
index: number;
|
||||
}
|
||||
@@ -67,26 +67,23 @@ function createTurnFooterHost(input: {
|
||||
item: StreamItem;
|
||||
items: StreamItem[];
|
||||
index: number;
|
||||
timingByItemId: Map<string, TurnTiming>;
|
||||
timingByAssistantId: Map<string, TurnTiming>;
|
||||
}): TurnFooterHost {
|
||||
return {
|
||||
itemId: input.item.id,
|
||||
items: input.items,
|
||||
timing: input.timingByItemId.get(input.item.id),
|
||||
timing: input.timingByAssistantId.get(input.item.id),
|
||||
startIndex: input.index,
|
||||
};
|
||||
}
|
||||
|
||||
function findTurnFooterSource(input: {
|
||||
function findLatestAssistantInResponse(input: {
|
||||
strategy: StreamStrategy;
|
||||
items: StreamItem[];
|
||||
startIndex: number;
|
||||
boundaryAboveItems?: StreamItem[] | null;
|
||||
boundaryAboveIndex?: number | null;
|
||||
}): TurnFooterSource | null {
|
||||
const last = input.items[input.startIndex];
|
||||
const toolFallback: TurnFooterSource | null =
|
||||
last?.kind === "tool_call" ? { item: last, items: input.items, index: input.startIndex } : null;
|
||||
}): AssistantFooterSource | null {
|
||||
let items = input.items;
|
||||
let index = input.startIndex;
|
||||
let canCrossBoundary = true;
|
||||
@@ -100,7 +97,7 @@ function findTurnFooterSource(input: {
|
||||
) {
|
||||
const item = items[index];
|
||||
if (!item || (laterItem && !continuesResponse(item, laterItem))) {
|
||||
return toolFallback;
|
||||
return null;
|
||||
}
|
||||
if (item.kind === "assistant_message") {
|
||||
return { item, items, index };
|
||||
@@ -114,7 +111,7 @@ function findTurnFooterSource(input: {
|
||||
input.boundaryAboveIndex === null ||
|
||||
input.boundaryAboveIndex === undefined
|
||||
) {
|
||||
return toolFallback;
|
||||
return null;
|
||||
}
|
||||
|
||||
items = input.boundaryAboveItems;
|
||||
@@ -134,20 +131,20 @@ function resolveAuxiliaryTurnFooter(input: StreamLayoutInput): TurnFooterHost |
|
||||
return null;
|
||||
}
|
||||
|
||||
const source = findTurnFooterSource({
|
||||
const assistant = findLatestAssistantInResponse({
|
||||
strategy: input.strategy,
|
||||
items: footerItems,
|
||||
startIndex: latestIndex,
|
||||
});
|
||||
if (!source) {
|
||||
if (!assistant) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return createTurnFooterHost({
|
||||
item: source.item,
|
||||
items: source.items,
|
||||
index: source.index,
|
||||
timingByItemId: input.timingByItemId,
|
||||
item: assistant.item,
|
||||
items: assistant.items,
|
||||
index: assistant.index,
|
||||
timingByAssistantId: input.timingByAssistantId,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -157,7 +154,7 @@ function resolveCompletedFooter(input: {
|
||||
index: number;
|
||||
item: StreamItem;
|
||||
belowItem: StreamItem | null;
|
||||
timingByItemId: Map<string, TurnTiming>;
|
||||
timingByAssistantId: Map<string, TurnTiming>;
|
||||
auxiliaryTurnFooter: TurnFooterHost | null;
|
||||
boundaryAboveItems: StreamItem[] | null;
|
||||
boundaryAboveIndex: number | null;
|
||||
@@ -166,21 +163,21 @@ function resolveCompletedFooter(input: {
|
||||
return null;
|
||||
}
|
||||
|
||||
const source = findTurnFooterSource({
|
||||
const assistant = findLatestAssistantInResponse({
|
||||
strategy: input.strategy,
|
||||
items: input.items,
|
||||
startIndex: input.index,
|
||||
boundaryAboveItems: input.boundaryAboveItems,
|
||||
boundaryAboveIndex: input.boundaryAboveIndex,
|
||||
});
|
||||
if (!source || input.auxiliaryTurnFooter?.itemId === source.item.id) {
|
||||
if (!assistant || input.auxiliaryTurnFooter?.itemId === assistant.item.id) {
|
||||
return null;
|
||||
}
|
||||
return createTurnFooterHost({
|
||||
item: source.item,
|
||||
items: source.items,
|
||||
index: source.index,
|
||||
timingByItemId: input.timingByItemId,
|
||||
item: assistant.item,
|
||||
items: assistant.items,
|
||||
index: assistant.index,
|
||||
timingByAssistantId: input.timingByAssistantId,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -309,7 +306,7 @@ function layoutSegmentItem(
|
||||
index,
|
||||
item,
|
||||
belowItem,
|
||||
timingByItemId: input.timingByItemId,
|
||||
timingByAssistantId: input.timingByAssistantId,
|
||||
auxiliaryTurnFooter: input.auxiliaryTurnFooter,
|
||||
boundaryAboveItems: input.boundaryAboveItems,
|
||||
boundaryAboveIndex: input.boundaryAboveIndex,
|
||||
@@ -378,7 +375,7 @@ export function layoutStream(input: StreamLayoutInput): StreamLayout {
|
||||
history = layoutSegment({
|
||||
strategy: input.strategy,
|
||||
items: input.history,
|
||||
timingByItemId: input.timingByItemId,
|
||||
timingByAssistantId: input.timingByAssistantId,
|
||||
auxiliaryTurnFooter,
|
||||
hasAuxiliaryFooter,
|
||||
frameOrder,
|
||||
@@ -398,7 +395,7 @@ export function layoutStream(input: StreamLayoutInput): StreamLayout {
|
||||
const liveHead = layoutSegment({
|
||||
strategy: input.strategy,
|
||||
items: input.liveHead,
|
||||
timingByItemId: input.timingByItemId,
|
||||
timingByAssistantId: input.timingByAssistantId,
|
||||
auxiliaryTurnFooter,
|
||||
hasAuxiliaryFooter,
|
||||
frameOrder,
|
||||
|
||||
@@ -69,8 +69,8 @@ describe("buildAgentStreamRenderModel", () => {
|
||||
historyStart: 2,
|
||||
});
|
||||
|
||||
expect(model.turnTiming.byItemId.has("hidden-a")).toBe(false);
|
||||
expect(model.turnTiming.byItemId.get("visible-a")).toEqual({
|
||||
expect(model.turnTiming.byAssistantId.has("hidden-a")).toBe(false);
|
||||
expect(model.turnTiming.byAssistantId.get("visible-a")).toEqual({
|
||||
completedAt: tail[3]?.timestamp,
|
||||
durationMs: 1000,
|
||||
});
|
||||
@@ -184,7 +184,7 @@ describe("buildAgentStreamRenderModel", () => {
|
||||
});
|
||||
|
||||
expect(model.turnTiming.runningStartedAt).toBe(tail[0]?.timestamp);
|
||||
expect(model.turnTiming.byItemId.has("live-a")).toBe(false);
|
||||
expect(model.turnTiming.byAssistantId.has("live-a")).toBe(false);
|
||||
});
|
||||
|
||||
it("maps completed turn timing to assistant ids across committed history and live head", () => {
|
||||
@@ -201,7 +201,7 @@ describe("buildAgentStreamRenderModel", () => {
|
||||
});
|
||||
|
||||
expect(model.turnTiming.runningStartedAt).toBe(null);
|
||||
expect(model.turnTiming.byItemId.get("live-a")).toEqual({
|
||||
expect(model.turnTiming.byAssistantId.get("live-a")).toEqual({
|
||||
completedAt: head[0]?.timestamp,
|
||||
durationMs: 3000,
|
||||
});
|
||||
@@ -220,7 +220,7 @@ describe("buildAgentStreamRenderModel", () => {
|
||||
});
|
||||
|
||||
expect(model.segments.historyMounted.map((item) => item.id)).toEqual(["a1", "u1"]);
|
||||
expect(model.turnTiming.byItemId.get("a1")).toEqual({
|
||||
expect(model.turnTiming.byAssistantId.get("a1")).toEqual({
|
||||
completedAt: tail[1]?.timestamp,
|
||||
durationMs: 3000,
|
||||
});
|
||||
@@ -238,7 +238,7 @@ describe("buildAgentStreamRenderModel", () => {
|
||||
isMobileBreakpoint: false,
|
||||
});
|
||||
|
||||
expect(model.turnTiming.byItemId.size).toBe(0);
|
||||
expect(model.turnTiming.byAssistantId.size).toBe(0);
|
||||
});
|
||||
|
||||
it.each(["web", "native"] as const)(
|
||||
@@ -274,10 +274,10 @@ describe("buildAgentStreamRenderModel", () => {
|
||||
|
||||
expect(second.history).toBe(first.history);
|
||||
expect(second.segments.historyMounted).toBe(first.segments.historyMounted);
|
||||
expect(second.turnTiming.byItemId).toBe(first.turnTiming.byItemId);
|
||||
expect(second.turnTiming.byAssistantId).toBe(first.turnTiming.byAssistantId);
|
||||
expect(first.history).toHaveLength(20);
|
||||
expect(first.turnTiming.byItemId.has("a29")).toBe(false);
|
||||
expect(first.turnTiming.byItemId.get("a38")).toEqual({
|
||||
expect(first.turnTiming.byAssistantId.has("a29")).toBe(false);
|
||||
expect(first.turnTiming.byAssistantId.get("a38")).toEqual({
|
||||
completedAt: tail[77]?.timestamp,
|
||||
durationMs: 1000,
|
||||
});
|
||||
|
||||
@@ -588,69 +588,3 @@ describe("timeline presentation", () => {
|
||||
expect(projectTimelineItems([source], () => [])).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
it("opening a turn reveals individual calls rather than another tool group", () => {
|
||||
const present = createStreamPresentation();
|
||||
const timestamp = new Date();
|
||||
const tail: StreamItem[] = [
|
||||
{ kind: "user_message", id: "prompt", text: "Work", timestamp },
|
||||
toolCall("one", "Bash"),
|
||||
toolCall("two", "Bash"),
|
||||
{ kind: "assistant_message", id: "reply", text: "Done", timestamp },
|
||||
];
|
||||
const result = present({
|
||||
...presentationOptions,
|
||||
transform: undefined,
|
||||
tail,
|
||||
head: [],
|
||||
display: "collapseTurns",
|
||||
isTurnActive: false,
|
||||
expandedTurnHostIds: new Set(["prompt"]),
|
||||
});
|
||||
expect(result.tail.map((item) => item.id)).toEqual(tail.map((item) => item.id));
|
||||
expect(result.groupsByHostId.size).toBe(0);
|
||||
});
|
||||
|
||||
it("presents received agent messages as attributed bubbles with the original turn identity", () => {
|
||||
const call = toolCall("received", "agent_message");
|
||||
if (call.payload.source !== "agent") throw new Error("Expected agent tool");
|
||||
call.turnId = "turn";
|
||||
call.payload.data.agentMessage = {
|
||||
event: "message",
|
||||
sender: { id: "sender", title: "Reviewer" },
|
||||
text: "Ready",
|
||||
};
|
||||
const result = createStreamPresentation()({
|
||||
...presentationOptions,
|
||||
transform: undefined,
|
||||
tail: [call],
|
||||
head: [],
|
||||
});
|
||||
expect(result.tail[0]).toMatchObject({
|
||||
kind: "user_message",
|
||||
id: call.id,
|
||||
turnId: "turn",
|
||||
text: "Ready",
|
||||
sender: { id: "sender", title: "Reviewer" },
|
||||
});
|
||||
});
|
||||
|
||||
it("does not reopen the previous turn while a new run waits for its first row", () => {
|
||||
const timestamp = new Date();
|
||||
const tail: StreamItem[] = [
|
||||
{ kind: "user_message", id: "prompt", text: "Work", timestamp },
|
||||
toolCall("one", "Bash"),
|
||||
{ kind: "assistant_message", id: "reply", text: "Done", timestamp },
|
||||
];
|
||||
for (const item of tail) item.turnId = "completed";
|
||||
const result = createStreamPresentation()({
|
||||
...presentationOptions,
|
||||
transform: undefined,
|
||||
tail,
|
||||
head: [],
|
||||
display: "collapseTurns",
|
||||
isTurnActive: true,
|
||||
activeTurnId: "new",
|
||||
});
|
||||
expect(result.tail.map((item) => item.id)).toEqual(["prompt", "reply"]);
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { isTurnBoundary } from "./turn-membership";
|
||||
import type { ChatDisplay } from "@/hooks/use-settings";
|
||||
import type { TimelineItemTransform } from "@/plugins/timeline/model";
|
||||
import { projectPluginTimelineItems } from "@/plugins/timeline/projection";
|
||||
@@ -20,7 +19,6 @@ interface PresentationInput {
|
||||
/** User messages whose collapsed turn the reader opened. */
|
||||
expandedTurnHostIds: ReadonlySet<string>;
|
||||
isTurnActive: boolean;
|
||||
activeTurnId?: string | null;
|
||||
}
|
||||
|
||||
export interface StreamPresentation extends ToolCallDetailProjection {
|
||||
@@ -65,22 +63,6 @@ export function createStreamPresentation() {
|
||||
let collapsed: TurnCollapse | undefined;
|
||||
|
||||
function presentRows(item: StreamItem): StreamItem[] {
|
||||
if (item.kind === "tool_call" && item.payload.source === "agent") {
|
||||
const message = item.payload.data.agentMessage;
|
||||
if (message?.event === "message") {
|
||||
return [
|
||||
{
|
||||
kind: "user_message",
|
||||
id: item.id,
|
||||
turnId: item.turnId,
|
||||
timelineCursor: item.timelineCursor,
|
||||
timestamp: item.timestamp,
|
||||
text: message.text,
|
||||
sender: message.sender,
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
return [item.kind === "user_message" ? presentUserMessage(item) : item];
|
||||
}
|
||||
|
||||
@@ -93,14 +75,7 @@ export function createStreamPresentation() {
|
||||
}
|
||||
// Live text updates reach the head only, so the folded history is reused until the
|
||||
// retained rows, the latest turn's liveness, or the reader's expanded turns change.
|
||||
const isLatestTurnOpen =
|
||||
(input.isTurnActive || projection.head.length > 0) &&
|
||||
!isTurnBoundary(projection.tail.at(-1) ?? null, projection.head[0] ?? null) &&
|
||||
!(
|
||||
input.activeTurnId &&
|
||||
projection.tail.at(-1)?.turnId &&
|
||||
input.activeTurnId !== projection.tail.at(-1)?.turnId
|
||||
);
|
||||
const isLatestTurnOpen = input.isTurnActive || projection.head.length > 0;
|
||||
if (
|
||||
!collapsed ||
|
||||
collapsedSource !== projection.tail ||
|
||||
@@ -118,20 +93,7 @@ export function createStreamPresentation() {
|
||||
collapsedExpandedHostIds = input.expandedTurnHostIds;
|
||||
}
|
||||
const { tail, ...turns } = collapsed;
|
||||
if (turns.nestedItemIds.size === 0) return { ...projection, tail, turns };
|
||||
// Opening a turn reveals its raw calls; those rows must not become group hosts again.
|
||||
const withoutExpandedRows = (groups: StreamPresentation["groupsByHostId"]) => ({
|
||||
size: groups.size - [...turns.nestedItemIds].filter((id) => groups.has(id)).length,
|
||||
get: (id: string) => (turns.nestedItemIds.has(id) ? undefined : groups.get(id)),
|
||||
has: (id: string) => !turns.nestedItemIds.has(id) && groups.has(id),
|
||||
});
|
||||
return {
|
||||
...projection,
|
||||
tail,
|
||||
turns,
|
||||
groupsByHostId: withoutExpandedRows(projection.groupsByHostId),
|
||||
historyGroupUpdatesByHostId: withoutExpandedRows(projection.historyGroupUpdatesByHostId),
|
||||
};
|
||||
return { ...projection, tail, turns };
|
||||
}
|
||||
|
||||
return (input: PresentationInput): StreamPresentation => {
|
||||
|
||||
@@ -110,7 +110,7 @@ function runTicks(input: { tail: StreamItem[]; historyStart: number; heads: Stre
|
||||
isTurnActive: true,
|
||||
history: model.history,
|
||||
liveHead: model.segments.liveHead,
|
||||
timingByItemId: model.turnTiming.byItemId,
|
||||
timingByAssistantId: model.turnTiming.byAssistantId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ describe("collapseTurns", () => {
|
||||
hostId: "u1",
|
||||
expanded: false,
|
||||
summary: {
|
||||
messageCount: 1,
|
||||
tools: expect.objectContaining({ commandCount: 2 }),
|
||||
},
|
||||
});
|
||||
@@ -120,34 +121,6 @@ describe("collapseTurns", () => {
|
||||
expect(result.turnsByHostId.size).toBe(0);
|
||||
});
|
||||
|
||||
it("keeps a completed response folded when a promptless canonical turn starts", () => {
|
||||
const first = [user("u1"), shell("c1"), reply("r1")].map((item) =>
|
||||
Object.assign(item, { turnId: "first" }),
|
||||
);
|
||||
const next = { ...shell("heartbeat"), turnId: "second" };
|
||||
const result = collapse([...first, next], { isLatestTurnOpen: true });
|
||||
expect(ids(result.tail)).toEqual(["u1", "r1", "heartbeat"]);
|
||||
expect(result.turnsByHostId.has("u1")).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps mid-turn messages visible when work is folded", () => {
|
||||
const tail = [user("prompt"), shell("work"), user("steer"), shell("more"), reply("done")];
|
||||
for (const item of tail) item.turnId = "same-turn";
|
||||
const result = collapse(tail);
|
||||
expect(ids(result.tail)).toEqual(["prompt", "steer", "done"]);
|
||||
expect(result.hostIdByFoldedMessageId.has("steer")).toBe(false);
|
||||
});
|
||||
|
||||
it("reveals every raw call inside an expanded turn", () => {
|
||||
const calls = [shell("one"), shell("two")];
|
||||
const result = collapse([user("prompt"), calls[0]!, reply("done")], {
|
||||
expandedHostIds: new Set(["prompt"]),
|
||||
getGroupedCalls: (id) => (id === "one" ? calls : undefined),
|
||||
});
|
||||
expect(ids(result.tail)).toEqual(["prompt", "one", "two", "done"]);
|
||||
expect([...result.nestedItemIds]).toEqual(["one", "two"]);
|
||||
});
|
||||
|
||||
it("counts every call a tool-call group row stands for", () => {
|
||||
const group = [shell("c1"), shell("c2"), shell("c3")];
|
||||
const result = collapse([user("u1"), group[0]!, reply("final")], {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { isTurnBoundary, isTurnTrigger } from "../turn-membership";
|
||||
import { getStreamItemMessageId, type StreamItem, type ToolCallItem } from "@/types/stream";
|
||||
import { summarizeToolCalls, type OverviewSummary } from "@/tool-calls/detail-level/overview/model";
|
||||
|
||||
export interface TurnSummary {
|
||||
messageCount: number;
|
||||
tools: OverviewSummary;
|
||||
}
|
||||
|
||||
export interface CollapsedTurn {
|
||||
/** The input or first loaded row that carries the turn's summary line. */
|
||||
/** The user message the turn answers. Its row carries the turn's summary line. */
|
||||
hostId: string;
|
||||
expanded: boolean;
|
||||
summary: TurnSummary;
|
||||
@@ -40,15 +40,16 @@ function summarizeTurn(
|
||||
getGroupedCalls: CollapseTurnsInput["getGroupedCalls"],
|
||||
): TurnSummary {
|
||||
const calls: ToolCallItem[] = [];
|
||||
let messageCount = 0;
|
||||
for (const item of items) {
|
||||
if (item.kind === "tool_call" && !isTurnTrigger(item))
|
||||
calls.push(...(getGroupedCalls(item.id) ?? [item]));
|
||||
if (item.kind === "assistant_message") messageCount += 1;
|
||||
else if (item.kind === "tool_call") calls.push(...(getGroupedCalls(item.id) ?? [item]));
|
||||
}
|
||||
return { tools: summarizeToolCalls(calls) };
|
||||
return { messageCount, tools: summarizeToolCalls(calls) };
|
||||
}
|
||||
|
||||
function hasWork(summary: TurnSummary): boolean {
|
||||
return Object.values(summary.tools).some((count) => count > 0);
|
||||
return summary.messageCount > 0 || Object.values(summary.tools).some((count) => count > 0);
|
||||
}
|
||||
|
||||
function findLastAssistantIndex(tail: StreamItem[], start: number, end: number): number {
|
||||
@@ -76,43 +77,28 @@ export function collapseTurns(input: CollapseTurnsInput): TurnCollapse {
|
||||
const host = tail[runStart - 1];
|
||||
const isClosed = runEnd < tail.length || !input.isLatestTurnOpen;
|
||||
const replyIndex = findLastAssistantIndex(tail, runStart, runEnd);
|
||||
if (
|
||||
!host ||
|
||||
(host.kind !== "user_message" && host.kind !== "tool_call") ||
|
||||
!isClosed ||
|
||||
replyIndex <= runStart
|
||||
) {
|
||||
if (host?.kind !== "user_message" || !isClosed || replyIndex <= runStart) {
|
||||
output.push(...tail.slice(runStart, runEnd));
|
||||
return;
|
||||
}
|
||||
const folded = tail.slice(runStart, replyIndex);
|
||||
const summary = summarizeTurn(folded, input.getGroupedCalls);
|
||||
if (!hasWork(summary) && !folded.some((item) => item.kind === "assistant_message")) {
|
||||
if (!hasWork(summary)) {
|
||||
output.push(...tail.slice(runStart, runEnd));
|
||||
return;
|
||||
}
|
||||
const expanded = input.expandedHostIds.has(host.id);
|
||||
turnsByHostId.set(host.id, { hostId: host.id, expanded, summary });
|
||||
const revealed = expanded
|
||||
? folded.flatMap<StreamItem>((item) =>
|
||||
item.kind === "tool_call" ? [...(input.getGroupedCalls(item.id) ?? [item])] : [item],
|
||||
)
|
||||
: folded;
|
||||
for (const item of revealed) {
|
||||
if (isTurnTrigger(item)) continue;
|
||||
for (const item of folded) {
|
||||
hostIdByFoldedMessageId.set(getStreamItemMessageId(item), host.id);
|
||||
if (expanded) nestedItemIds.add(item.id);
|
||||
}
|
||||
output.push(...(expanded ? revealed : folded.filter(isTurnTrigger)));
|
||||
if (expanded) output.push(...folded);
|
||||
output.push(...tail.slice(replyIndex, runEnd));
|
||||
};
|
||||
|
||||
for (let index = 0; index < tail.length; index += 1) {
|
||||
if (
|
||||
!(index === 0 && isTurnTrigger(tail[index]!)) &&
|
||||
!isTurnBoundary(tail[index - 1] ?? null, tail[index] ?? null)
|
||||
)
|
||||
continue;
|
||||
if (tail[index]?.kind !== "user_message") continue;
|
||||
flushRun(index);
|
||||
output.push(tail[index]!);
|
||||
runStart = index + 1;
|
||||
@@ -128,10 +114,7 @@ export function collapseTurns(input: CollapseTurnsInput): TurnCollapse {
|
||||
};
|
||||
}
|
||||
return {
|
||||
tail:
|
||||
output.length === tail.length && output.every((item, index) => item === tail[index])
|
||||
? tail
|
||||
: output,
|
||||
tail: output.length === tail.length ? tail : output,
|
||||
turnsByHostId,
|
||||
nestedItemIds,
|
||||
hostIdByFoldedMessageId,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { memo, useCallback } from "react";
|
||||
import { memo, useCallback, useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Summary } from "lucide-react-native";
|
||||
import { ExpandableBadge } from "@/components/message";
|
||||
@@ -17,7 +17,19 @@ export const TurnSummaryLine = memo(function TurnSummaryLine({
|
||||
onExpandedChange: (hostId: string, expanded: boolean) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const label = useOverviewSummaryLabel(turn.summary.tools) || t("turnSummary.details");
|
||||
const { messageCount, tools } = turn.summary;
|
||||
const messageParts = useMemo(
|
||||
() =>
|
||||
messageCount > 0
|
||||
? [
|
||||
t(`turnSummary.messages.${messageCount === 1 ? "one" : "other"}`, {
|
||||
count: messageCount,
|
||||
}),
|
||||
]
|
||||
: [],
|
||||
[messageCount, t],
|
||||
);
|
||||
const label = useOverviewSummaryLabel(tools, messageParts);
|
||||
const toggle = useCallback(
|
||||
() => onExpandedChange(turn.hostId, !turn.expanded),
|
||||
[onExpandedChange, turn.expanded, turn.hostId],
|
||||
|
||||
@@ -197,7 +197,7 @@ function CompletedTurnFooter({
|
||||
return (
|
||||
<View style={stylesheet.turnFooterSlot}>
|
||||
<AssistantTurnFooter
|
||||
getContent={items[startIndex]?.kind === "assistant_message" ? getContent : undefined}
|
||||
getContent={getContent}
|
||||
completedAt={timing?.completedAt}
|
||||
durationMs={timing?.durationMs}
|
||||
onFork={boundary && onForkAssistantTurn ? handleFork : undefined}
|
||||
|
||||
@@ -53,7 +53,7 @@ function layoutFor(items: StreamItem[], isTurnActive: boolean) {
|
||||
isTurnActive,
|
||||
history: model.segments.historyMounted,
|
||||
liveHead: model.segments.liveHead,
|
||||
timingByItemId: model.turnTiming.byItemId,
|
||||
timingByAssistantId: model.turnTiming.byAssistantId,
|
||||
}),
|
||||
};
|
||||
}
|
||||
@@ -76,7 +76,7 @@ describe("canonical turn membership", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("renders a separate footer for each canonical turn without visible prompts", () => {
|
||||
it("renders adjacent turns without visible prompts as one response", () => {
|
||||
const items = [
|
||||
user("prompt", 1, "turn-1"),
|
||||
assistant("first reply", 2, "turn-1"),
|
||||
@@ -88,11 +88,7 @@ describe("canonical turn membership", () => {
|
||||
|
||||
const completed = layoutFor(items, false);
|
||||
|
||||
expect(completedFooterIds(completed.layout)).toEqual([
|
||||
"first reply",
|
||||
"heartbeat-1-reply",
|
||||
"heartbeat-2-reply",
|
||||
]);
|
||||
expect(completedFooterIds(completed.layout)).toEqual(["heartbeat-2-reply"]);
|
||||
expect(completed.layout.auxiliaryTurnFooter?.timing).toEqual({
|
||||
completedAt: at(6),
|
||||
durationMs: null,
|
||||
@@ -127,7 +123,7 @@ describe("canonical turn membership", () => {
|
||||
const completedItems = [...build(turnId), assistant("done", 9, turnId)];
|
||||
const completed = layoutFor(completedItems, false);
|
||||
expect(completedFooterIds(completed.layout)).toEqual(["done"]);
|
||||
expect(completed.model.turnTiming.byItemId.get("done")).toMatchObject({
|
||||
expect(completed.model.turnTiming.byAssistantId.get("done")).toMatchObject({
|
||||
completedAt: at(9),
|
||||
durationMs: 8000,
|
||||
});
|
||||
|
||||
@@ -9,15 +9,16 @@ export function continuesTurn(previous: StreamItem | null, next: StreamItem | nu
|
||||
if (previous.turnId !== undefined && next.turnId !== undefined) {
|
||||
return previous.turnId === next.turnId;
|
||||
}
|
||||
return !isTurnTrigger(next);
|
||||
return next.kind !== "user_message";
|
||||
}
|
||||
|
||||
/**
|
||||
* Every canonical turn owns its response, including system-triggered runs.
|
||||
* A visible response can span multiple canonical turns when their prompts are
|
||||
* system-injected and therefore absent from the Paseo timeline.
|
||||
*/
|
||||
export function continuesResponse(previous: StreamItem | null, next: StreamItem | null): boolean {
|
||||
if (!previous || !next) return false;
|
||||
return continuesTurn(previous, next);
|
||||
return continuesTurn(previous, next) || next.kind !== "user_message";
|
||||
}
|
||||
|
||||
export function isTurnBoundary(previous: StreamItem | null, next: StreamItem | null): boolean {
|
||||
@@ -36,13 +37,3 @@ export function startsNewTurn(item: StreamItem, previous: StreamItem | null): bo
|
||||
export function belongsToTurn(item: StreamItem, turnId: string | null): boolean {
|
||||
return turnId !== null && item.turnId === turnId;
|
||||
}
|
||||
|
||||
/** Inputs that start a turn when older history has no canonical turn IDs. */
|
||||
export function isTurnTrigger(item: StreamItem): boolean {
|
||||
if (item.kind === "user_message") return true;
|
||||
return (
|
||||
item.kind === "tool_call" &&
|
||||
item.payload.source === "agent" &&
|
||||
(item.payload.data.agentMessage !== undefined || item.payload.data.name === "heartbeat")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { useRetainedPanelActive } from "@/components/retained-panel";
|
||||
import { useSessionStore } from "@/stores/session-store";
|
||||
|
||||
// The view retains its last visible transcript. Selecting a stable value here
|
||||
// also prevents incoming chunks from scheduling React work in a hidden panel.
|
||||
// Revealing the panel reads the current tail directly from the model.
|
||||
export function useAgentStreamTail(serverId: string, agentId: string | undefined) {
|
||||
const active = useRetainedPanelActive();
|
||||
return useSessionStore((state) =>
|
||||
active && agentId ? state.sessions[serverId]?.agentStreamTail.get(agentId) : undefined,
|
||||
);
|
||||
}
|
||||
@@ -526,7 +526,6 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
|
||||
display: chatDisplay,
|
||||
expandedTurnHostIds,
|
||||
isTurnActive,
|
||||
activeTurnId: effectiveTurnPresentation.turnId,
|
||||
}),
|
||||
[
|
||||
presentStream,
|
||||
@@ -536,7 +535,6 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
|
||||
chatDisplay,
|
||||
expandedTurnHostIds,
|
||||
isTurnActive,
|
||||
effectiveTurnPresentation.turnId,
|
||||
],
|
||||
);
|
||||
const {
|
||||
@@ -578,12 +576,12 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
|
||||
isTurnActive,
|
||||
history: baseRenderModel.history,
|
||||
liveHead: baseRenderModel.segments.liveHead,
|
||||
timingByItemId: baseRenderModel.turnTiming.byItemId,
|
||||
timingByAssistantId: baseRenderModel.turnTiming.byAssistantId,
|
||||
}),
|
||||
[
|
||||
baseRenderModel.history,
|
||||
baseRenderModel.segments.liveHead,
|
||||
baseRenderModel.turnTiming.byItemId,
|
||||
baseRenderModel.turnTiming.byAssistantId,
|
||||
isTurnActive,
|
||||
streamRenderStrategy,
|
||||
],
|
||||
@@ -724,7 +722,6 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
|
||||
agentId={agentId}
|
||||
messageId={item.messageId}
|
||||
message={item.text}
|
||||
sender={item.sender}
|
||||
images={item.images}
|
||||
attachments={item.attachments}
|
||||
timestamp={item.timestamp.getTime()}
|
||||
@@ -790,9 +787,6 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
|
||||
[agentId, client, handleInlinePathPress, resolvedServerId, toast, workspaceRoot],
|
||||
);
|
||||
|
||||
const isExpandedTurnItem = useStableEvent((id: string) =>
|
||||
presentation.turns.nestedItemIds.has(id),
|
||||
);
|
||||
const renderThoughtItem = useCallback(
|
||||
(layoutItem: StreamLayoutItem, item: Extract<StreamItem, { kind: "thought" }>) => {
|
||||
return (
|
||||
@@ -802,11 +796,11 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
|
||||
text={item.text}
|
||||
status={item.status}
|
||||
isLastInSequence={layoutItem.isLastInToolSequence}
|
||||
defaultExpanded={autoExpandReasoning || isExpandedTurnItem(item.id)}
|
||||
defaultExpanded={autoExpandReasoning}
|
||||
/>
|
||||
);
|
||||
},
|
||||
[autoExpandReasoning, setInlineDetailsExpanded, isExpandedTurnItem],
|
||||
[autoExpandReasoning, setInlineDetailsExpanded],
|
||||
);
|
||||
|
||||
const renderSingleToolCallItem = useCallback(
|
||||
@@ -836,8 +830,6 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
|
||||
itemId={item.id}
|
||||
onInlineDetailsExpandedChangeByItemId={setInlineDetailsExpanded}
|
||||
toolName={data.name}
|
||||
defaultExpanded={isExpandedTurnItem(item.id)}
|
||||
forceInline={isExpandedTurnItem(item.id)}
|
||||
error={data.error}
|
||||
status={data.status}
|
||||
detail={data.detail}
|
||||
@@ -867,13 +859,7 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
|
||||
/>
|
||||
);
|
||||
},
|
||||
[
|
||||
context.cwd,
|
||||
resolvedServerId,
|
||||
setInlineDetailsExpanded,
|
||||
handleToolCallOpenFile,
|
||||
isExpandedTurnItem,
|
||||
],
|
||||
[context.cwd, resolvedServerId, setInlineDetailsExpanded, handleToolCallOpenFile],
|
||||
);
|
||||
|
||||
// Read through a stable event so live group updates do not change the renderer identity
|
||||
@@ -931,17 +917,7 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
|
||||
return renderThoughtItem(layoutItem, item);
|
||||
|
||||
case "tool_call":
|
||||
return (
|
||||
<>
|
||||
{renderToolCallItem(layoutItem, item)}
|
||||
{getCollapsedTurn(item.id) ? (
|
||||
<TurnSummaryLine
|
||||
turn={getCollapsedTurn(item.id)!}
|
||||
onExpandedChange={setTurnExpanded}
|
||||
/>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
return renderToolCallItem(layoutItem, item);
|
||||
|
||||
case "notification":
|
||||
return <Notification level={item.level} message={item.message} />;
|
||||
@@ -973,8 +949,6 @@ const AgentStreamViewComponent = forwardRef<AgentStreamViewHandle, AgentStreamVi
|
||||
renderAssistantMessageItem,
|
||||
renderThoughtItem,
|
||||
renderToolCallItem,
|
||||
getCollapsedTurn,
|
||||
setTurnExpanded,
|
||||
resolvedServerId,
|
||||
],
|
||||
);
|
||||
|
||||
@@ -72,7 +72,7 @@ import {
|
||||
type StartupBlocker,
|
||||
} from "@/navigation/host-runtime-bootstrap";
|
||||
import { registerWorkspaceRouteNavigationRef } from "@/navigation/workspace-route-navigation";
|
||||
import { useSettingsRouteEntry } from "@/navigation/settings-presentation";
|
||||
import { useSettingsRouteEntry } from "@/navigation/settings-selection";
|
||||
import { ThemedStack } from "@/navigation/themed-stack";
|
||||
import { shouldUseDesktopDaemon } from "@/desktop/daemon/desktop-daemon";
|
||||
import { AgentNavigationListener } from "@/desktop/agent-navigation";
|
||||
|
||||
@@ -5,7 +5,6 @@ import { useFetchQuery } from "@/data/query";
|
||||
import { resolveAgentRoute, type AgentRouteLookup } from "@/navigation/agent-route-resolution";
|
||||
import { AgentRouteResolutionView } from "@/navigation/agent-route-resolution-view";
|
||||
import { useHasHydratedWorkspaces } from "@/stores/session-store-hooks";
|
||||
import { useDirectoryDemand } from "@/hooks/use-directory-demand";
|
||||
import { useWorkspaceLayoutStoreHydrated } from "@/stores/workspace-layout-store";
|
||||
import { useSessionStore } from "@/stores/session-store";
|
||||
import { getHostRuntimeStore, useHostRuntimeSnapshot, useHosts } from "@/runtime/host-runtime";
|
||||
@@ -88,7 +87,11 @@ function HostAgentReadyRouteContent() {
|
||||
]);
|
||||
const hasHydratedWorkspaces = useHasHydratedWorkspaces(serverId);
|
||||
const hasHydratedLayout = useWorkspaceLayoutStoreHydrated();
|
||||
useDirectoryDemand(serverId);
|
||||
useEffect(() => {
|
||||
if (!serverId) return;
|
||||
// A compact app can open this route before its sidebar has demanded the directory.
|
||||
return getHostRuntimeStore().acquireDirectoryDemand(serverId);
|
||||
}, [serverId]);
|
||||
const resolution = resolveAgentRoute({
|
||||
hasHydratedWorkspaces,
|
||||
hasHydratedLayout,
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
useActiveWorkspaceSelection,
|
||||
} from "@/stores/navigation-active-workspace-store";
|
||||
import { useHasHydratedWorkspaces, useWorkspaceExists } from "@/stores/session-store-hooks";
|
||||
import { useDirectoryDemand } from "@/hooks/use-directory-demand";
|
||||
import type { WorkspaceTabTarget } from "@/workspace-tabs/model";
|
||||
import { WorkspaceScreen } from "@/screens/workspace/workspace-screen";
|
||||
import { useWorkspaceLayoutStore } from "@/stores/workspace-layout-store";
|
||||
@@ -111,10 +110,6 @@ function HostWorkspaceRouteContent() {
|
||||
? (decodeWorkspaceIdFromPathSegment(workspaceValue) ?? "")
|
||||
: "";
|
||||
const openValue = getParamValue(params.open);
|
||||
// A restored workspace with no open chat has nothing else demanding its host's directory on a
|
||||
// phone, where the sidebar only demands while its panel is active. Without demand the deck
|
||||
// waits on workspace hydration that never starts.
|
||||
useDirectoryDemand(serverId);
|
||||
useEffect(() => {
|
||||
if (!serverId || !workspaceId) {
|
||||
return;
|
||||
|
||||
@@ -112,9 +112,8 @@ const ContextWindowRing = withUnistyles(function ContextWindowRing({
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox={`0 0 ${size} ${size}`}
|
||||
{...(isNative
|
||||
? { accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants" }
|
||||
: { "aria-hidden": true })}
|
||||
accessibilityElementsHidden
|
||||
importantForAccessibility="no-hide-descendants"
|
||||
>
|
||||
<Circle
|
||||
cx={center}
|
||||
|
||||
@@ -77,7 +77,6 @@ import { useWorkspaceFileDragSource } from "@/attachments/use-workspace-file-dra
|
||||
import { confirmDialog } from "@/utils/confirm-dialog";
|
||||
import { useToast } from "@/contexts/toast-context";
|
||||
import { openDesktopTarget, useDesktopOpenTargets } from "@/workspace/desktop-open-targets";
|
||||
import { useWorkspaceFields } from "@/stores/session-store-hooks";
|
||||
import { useOpenDirectoryInEditor } from "@/workspace/open-in-editor/directory";
|
||||
|
||||
const SORT_OPTIONS: { value: SortOption }[] = [
|
||||
@@ -451,15 +450,9 @@ export function FileExplorerPane({
|
||||
isLocalExecution: isLocalDaemon,
|
||||
});
|
||||
const fileManagerTarget = desktopOpenTargets.find((target) => target.kind === "file-manager");
|
||||
const projectId = useWorkspaceFields(
|
||||
serverId,
|
||||
workspaceId ?? null,
|
||||
(workspace) => workspace.projectId,
|
||||
);
|
||||
const openDirectoryInEditor = useOpenDirectoryInEditor({
|
||||
serverId,
|
||||
workspaceDirectory: normalizedWorkspaceRoot,
|
||||
projectId,
|
||||
});
|
||||
// COMPAT(fsEntryOps): added in v0.3.0, remove gate after 2027-02-08.
|
||||
const fsEntryOpsEnabled = useSessionStore(
|
||||
|
||||
@@ -3,10 +3,11 @@ import { View, type StyleProp, type ViewStyle } from "react-native";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
|
||||
/**
|
||||
* Align the rail with the expanded caret's left edge. Keep the content offset fixed so
|
||||
* expanded tool cards stay in place, with a gap between their border and the rail.
|
||||
* Collapsed chat rows badge their summary with an icon whose center sits 7px into the content
|
||||
* column (`ExpandableBadge` bleeds 13px left, then 1px border, 8px padding, 22px icon). The rail
|
||||
* hangs from that center so opened rows read as children of the line that opened them.
|
||||
*/
|
||||
const RAIL_LEFT = 1;
|
||||
const RAIL_LEFT = 7;
|
||||
const RAIL_WIDTH = 1;
|
||||
export const INDENT_RAIL_CONTENT_OFFSET = 21;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { MessagePreview, MessageSender } from "@/components/user-message";
|
||||
import { useStableEvent } from "@/hooks/use-stable-event";
|
||||
import { getAgentAttachmentPillContent } from "@/attachments/attachment-pill-content";
|
||||
import { AssistantForkMenu, type AssistantForkTarget } from "@/components/assistant-fork-menu";
|
||||
@@ -90,7 +89,6 @@ export type { InlinePathTarget } from "@/assistant-file-links";
|
||||
export type { AssistantForkTarget };
|
||||
|
||||
interface UserMessageProps {
|
||||
sender?: AgentMessage["sender"];
|
||||
serverId?: string;
|
||||
agentId?: string;
|
||||
messageId?: string;
|
||||
@@ -389,7 +387,6 @@ function UserMessageImagePill({ image, onOpen, accessibilityLabel }: UserMessage
|
||||
const MESSAGE_TEXT_DATASET = { messageText: "true" };
|
||||
|
||||
export const UserMessage = memo(function UserMessage({
|
||||
sender,
|
||||
serverId,
|
||||
agentId,
|
||||
messageId,
|
||||
@@ -476,45 +473,42 @@ export const UserMessage = memo(function UserMessage({
|
||||
onPointerEnter={handlePointerEnter}
|
||||
onPointerLeave={handlePointerLeave}
|
||||
>
|
||||
{sender ? <MessageSender sender={sender} serverId={serverId} /> : null}
|
||||
<View style={userMessageStylesheet.bubble}>
|
||||
<MessagePreview>
|
||||
{hasImages ? (
|
||||
<View style={imagePreviewContainerStyle}>
|
||||
{images.map((image) => (
|
||||
<UserMessageImagePill
|
||||
key={image.id}
|
||||
image={image}
|
||||
onOpen={setLightboxMetadata}
|
||||
accessibilityLabel={t("composer.attachments.openImage")}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
) : null}
|
||||
{hasAttachments ? (
|
||||
<View style={attachmentPreviewContainerStyle}>
|
||||
{attachments.map((attachment, index) => {
|
||||
const content = getAgentAttachmentPillContent(attachment, t);
|
||||
return (
|
||||
<AttachmentFrame
|
||||
key={`${attachment.type}:${"number" in attachment ? attachment.number : index}`}
|
||||
>
|
||||
<AttachmentLabel
|
||||
icon={content.icon}
|
||||
title={content.title}
|
||||
subtitle={content.subtitle}
|
||||
/>
|
||||
</AttachmentFrame>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
) : null}
|
||||
{hasText ? (
|
||||
<Text selectable style={userMessageStylesheet.text} dataSet={MESSAGE_TEXT_DATASET}>
|
||||
{message}
|
||||
</Text>
|
||||
) : null}
|
||||
</MessagePreview>
|
||||
{hasImages ? (
|
||||
<View style={imagePreviewContainerStyle}>
|
||||
{images.map((image) => (
|
||||
<UserMessageImagePill
|
||||
key={image.id}
|
||||
image={image}
|
||||
onOpen={setLightboxMetadata}
|
||||
accessibilityLabel={t("composer.attachments.openImage")}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
) : null}
|
||||
{hasAttachments ? (
|
||||
<View style={attachmentPreviewContainerStyle}>
|
||||
{attachments.map((attachment, index) => {
|
||||
const content = getAgentAttachmentPillContent(attachment, t);
|
||||
return (
|
||||
<AttachmentFrame
|
||||
key={`${attachment.type}:${"number" in attachment ? attachment.number : index}`}
|
||||
>
|
||||
<AttachmentLabel
|
||||
icon={content.icon}
|
||||
title={content.title}
|
||||
subtitle={content.subtitle}
|
||||
/>
|
||||
</AttachmentFrame>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
) : null}
|
||||
{hasText ? (
|
||||
<Text selectable style={userMessageStylesheet.text} dataSet={MESSAGE_TEXT_DATASET}>
|
||||
{message}
|
||||
</Text>
|
||||
) : null}
|
||||
</View>
|
||||
{hasText ? (
|
||||
<View
|
||||
@@ -547,7 +541,7 @@ export const UserMessage = memo(function UserMessage({
|
||||
});
|
||||
|
||||
interface AssistantTurnFooterProps {
|
||||
getContent?: () => string;
|
||||
getContent: () => string;
|
||||
completedAt?: Date;
|
||||
durationMs?: number | null;
|
||||
onFork?: (target: AssistantForkTarget) => Promise<void> | void;
|
||||
@@ -647,12 +641,10 @@ export const AssistantTurnFooter = memo(function AssistantTurnFooter({
|
||||
|
||||
return (
|
||||
<View style={assistantTurnFooterStylesheet.container}>
|
||||
{getContent ? (
|
||||
<TurnCopyButton
|
||||
getContent={getContent}
|
||||
containerStyle={assistantTurnFooterStylesheet.copyButton}
|
||||
/>
|
||||
) : null}
|
||||
<TurnCopyButton
|
||||
getContent={getContent}
|
||||
containerStyle={assistantTurnFooterStylesheet.copyButton}
|
||||
/>
|
||||
{canFork ? <AssistantForkMenu onFork={handleFork} /> : null}
|
||||
{primaryLabel ? (
|
||||
<Pressable
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
import { ChevronRight } from "lucide-react-native";
|
||||
import { Children, isValidElement, useCallback, useMemo, useState, type ReactNode } from "react";
|
||||
import { View } from "react-native";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import { Pressable, Text, View, type PressableStateCallbackType } from "react-native";
|
||||
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||
import { mutedIconColorMapping } from "@/components/ui/icon-color";
|
||||
import { isWeb } from "@/constants/platform";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
import { NestedSettingsRows } from "./row-density";
|
||||
import { SettingsRowHeader } from "./row-header";
|
||||
import { ICON_SIZE, type Theme } from "@/styles/theme";
|
||||
|
||||
const ThemedChevron = withUnistyles(ChevronRight);
|
||||
const hoveredIconColorMapping = (theme: Theme) => ({ color: theme.colors.foreground });
|
||||
|
||||
interface SettingsCollapsibleRowProps {
|
||||
label: string;
|
||||
/** A short status shown before the chevron, so the row says something while collapsed. */
|
||||
summary?: string;
|
||||
defaultExpanded?: boolean;
|
||||
testID?: string;
|
||||
/** The rows revealed underneath, separated like the rows of a `SettingsCard` and laid out as nested rows. */
|
||||
/** The rows revealed underneath, separated like the rows of a `SettingsCard`. */
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
@@ -23,7 +25,6 @@ interface SettingsCollapsibleRowProps {
|
||||
*/
|
||||
export function SettingsCollapsibleRow({
|
||||
label,
|
||||
summary,
|
||||
defaultExpanded = false,
|
||||
testID,
|
||||
children,
|
||||
@@ -36,39 +37,66 @@ export function SettingsCollapsibleRow({
|
||||
() => (isWeb ? ({ "aria-expanded": expanded } as const) : null),
|
||||
[expanded],
|
||||
);
|
||||
const headerStyle = useCallback(
|
||||
({ hovered, pressed }: PressableStateCallbackType & { hovered?: boolean }) => [
|
||||
settingsStyles.row,
|
||||
hovered && styles.headerHovered,
|
||||
pressed && styles.headerPressed,
|
||||
],
|
||||
[],
|
||||
);
|
||||
const chevronStyle = useMemo(
|
||||
() => [styles.chevron, expanded && styles.chevronExpanded],
|
||||
[expanded],
|
||||
);
|
||||
|
||||
return (
|
||||
<View testID={testID}>
|
||||
<SettingsRowHeader
|
||||
label={label}
|
||||
summary={summary}
|
||||
onPress={toggle}
|
||||
expanded={expanded}
|
||||
<Pressable
|
||||
{...webExpandedProps}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={label}
|
||||
accessibilityState={accessibilityState}
|
||||
webAccessibilityProps={webExpandedProps}
|
||||
onPress={toggle}
|
||||
style={headerStyle}
|
||||
testID={testID ? `${testID}-toggle` : undefined}
|
||||
/>
|
||||
{expanded ? (
|
||||
<View style={styles.children}>
|
||||
<NestedSettingsRows>
|
||||
{Children.toArray(children).map((child, index) => (
|
||||
<View
|
||||
key={isValidElement(child) ? child.key : index}
|
||||
style={settingsStyles.rowBorder}
|
||||
>
|
||||
{child}
|
||||
</View>
|
||||
))}
|
||||
</NestedSettingsRows>
|
||||
</View>
|
||||
) : null}
|
||||
>
|
||||
{({ hovered }: PressableStateCallbackType & { hovered?: boolean }) => (
|
||||
<>
|
||||
<View style={settingsStyles.rowContent}>
|
||||
<Text style={settingsStyles.rowTitle}>{label}</Text>
|
||||
</View>
|
||||
<View style={chevronStyle}>
|
||||
<ThemedChevron
|
||||
size={ICON_SIZE.sm}
|
||||
uniProps={hovered ? hoveredIconColorMapping : mutedIconColorMapping}
|
||||
/>
|
||||
</View>
|
||||
</>
|
||||
)}
|
||||
</Pressable>
|
||||
{expanded
|
||||
? Children.toArray(children).map((child, index) => (
|
||||
<View key={isValidElement(child) ? child.key : index} style={settingsStyles.rowBorder}>
|
||||
{child}
|
||||
</View>
|
||||
))
|
||||
: null}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
// The revealed rows keep the card's rails; the tint is what groups them under their header.
|
||||
children: {
|
||||
backgroundColor: theme.colors.surface0,
|
||||
headerHovered: {
|
||||
backgroundColor: theme.colors.surface2,
|
||||
},
|
||||
headerPressed: {
|
||||
backgroundColor: theme.colors.surface3,
|
||||
},
|
||||
// Optical: the chevron's ink sits about 4px inside its box whether it points right or down; this
|
||||
// puts the ink on the card's trailing rail, where the switch and the reports' refresh buttons end.
|
||||
chevron: { marginRight: -theme.spacing[1] },
|
||||
chevronExpanded: {
|
||||
transform: [{ rotate: "90deg" }],
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
import { SettingsRowHeader } from "./row-header";
|
||||
|
||||
interface SettingsDetailRowProps {
|
||||
label: string;
|
||||
/** What the detail is set to, so the row says it without being opened. */
|
||||
summary?: string;
|
||||
onPress: () => void;
|
||||
/** A row that cannot be opened keeps its summary and drops the chevron. */
|
||||
disabled?: boolean;
|
||||
testID?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A settings row that opens a detail, such as a sheet, for one setting. The label, a one-line
|
||||
* summary of the current value and a chevron pointing right. Sits inside a `SettingsCard`.
|
||||
*/
|
||||
export function SettingsDetailRow({
|
||||
label,
|
||||
summary,
|
||||
onPress,
|
||||
disabled,
|
||||
testID,
|
||||
}: SettingsDetailRowProps) {
|
||||
return (
|
||||
<SettingsRowHeader
|
||||
label={label}
|
||||
summary={summary}
|
||||
onPress={onPress}
|
||||
disabled={disabled}
|
||||
testID={testID}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ComponentType, ReactNode } from "react";
|
||||
import type { ReactNode } from "react";
|
||||
import { Pressable, Text } from "react-native";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Info } from "lucide-react-native";
|
||||
@@ -6,13 +6,7 @@ import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { ICON_SIZE, type Theme } from "@/styles/theme";
|
||||
|
||||
type TipIconComponent = ComponentType<{ size: number; color: string }>;
|
||||
|
||||
function TipIcon({ icon: Icon, color }: { icon: TipIconComponent; color: string }) {
|
||||
return <Icon size={ICON_SIZE.sm} color={color} />;
|
||||
}
|
||||
|
||||
const ThemedTipIcon = withUnistyles(TipIcon);
|
||||
const ThemedInfo = withUnistyles(Info);
|
||||
|
||||
const mutedIconMapping = (theme: Theme) => ({ color: theme.colors.foregroundMuted });
|
||||
|
||||
@@ -20,37 +14,27 @@ interface SettingsInfoTipProps {
|
||||
/** Header the tip belongs to; used for the accessibility label. */
|
||||
title: string;
|
||||
info: ReactNode;
|
||||
/** Defaults to the info icon. */
|
||||
icon?: TipIconComponent;
|
||||
/** Defaults to "About {title}". */
|
||||
accessibilityLabel?: string;
|
||||
testID?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The one way a settings group or section explains itself: an info icon on the
|
||||
* header that opens a tooltip. Never a paragraph under the header — see
|
||||
* docs/design.md §7. Rows use it the same way to keep secondary details on one line.
|
||||
* docs/design.md §7.
|
||||
*/
|
||||
export function SettingsInfoTip({
|
||||
title,
|
||||
info,
|
||||
icon = Info,
|
||||
accessibilityLabel,
|
||||
testID,
|
||||
}: SettingsInfoTipProps) {
|
||||
export function SettingsInfoTip({ title, info, testID }: SettingsInfoTipProps) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Tooltip delayDuration={0} enabledOnDesktop enabledOnMobile>
|
||||
<TooltipTrigger asChild>
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={accessibilityLabel ?? t("settings.groupInfo", { title })}
|
||||
accessibilityLabel={t("settings.groupInfo", { title })}
|
||||
testID={testID}
|
||||
hitSlop={8}
|
||||
style={styles.button}
|
||||
>
|
||||
<ThemedTipIcon icon={icon} uniProps={mutedIconMapping} />
|
||||
<ThemedInfo size={ICON_SIZE.sm} uniProps={mutedIconMapping} />
|
||||
</Pressable>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top" align="start" offset={8}>
|
||||
|
||||
@@ -24,21 +24,13 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem } from "@/component
|
||||
import { DropdownTrigger } from "@/components/ui/dropdown-trigger";
|
||||
import { useIsCompactFormFactor } from "@/constants/layout";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
import { ControlSizeProvider } from "@/components/ui/control-size";
|
||||
import { useSettingsRowLayout } from "./row-density";
|
||||
export { SettingsGroup } from "./headings/settings-group";
|
||||
export { SettingsSection } from "./headings/settings-section";
|
||||
export { SettingsCollapsibleRow } from "./collapsible-row";
|
||||
export { SettingsDetailRow } from "./detail-row";
|
||||
export { SettingsInfoTip } from "./headings/settings-info-tip";
|
||||
|
||||
/** What app screens can add to a plugin-facing row: an accessory beside the label, such as an info tip. */
|
||||
interface AppRowExtras {
|
||||
labelAccessory?: ReactNode;
|
||||
}
|
||||
|
||||
interface AppSettingsRowProps extends Omit<SettingsRowProps, "hint">, AppRowExtras {
|
||||
interface AppSettingsRowProps extends Omit<SettingsRowProps, "hint"> {
|
||||
hint?: ReactNode;
|
||||
labelAccessory?: ReactNode;
|
||||
}
|
||||
|
||||
export function SettingsCard({ children, testID }: { children: ReactNode; testID?: string }) {
|
||||
@@ -65,32 +57,26 @@ export function SettingsRow({
|
||||
testID,
|
||||
}: AppSettingsRowProps) {
|
||||
const compact = useIsCompactFormFactor();
|
||||
const layout = useSettingsRowLayout();
|
||||
const rowStyle = useMemo(() => [layout.row, compact && styles.compactRow], [compact, layout]);
|
||||
const accessoryTitleStyle = useMemo(() => [layout.title, styles.accessoryLabel], [layout]);
|
||||
const rowStyle = useMemo(() => [settingsStyles.row, compact && styles.compactRow], [compact]);
|
||||
return (
|
||||
<View style={rowStyle} testID={testID}>
|
||||
<View style={styles.label}>
|
||||
{labelAccessory ? (
|
||||
<View style={styles.labelRow}>
|
||||
<Text style={accessoryTitleStyle}>{label}</Text>
|
||||
<Text style={[settingsStyles.rowTitle, styles.accessoryLabel]}>{label}</Text>
|
||||
{labelAccessory}
|
||||
</View>
|
||||
) : (
|
||||
<Text style={layout.title}>{label}</Text>
|
||||
<Text style={settingsStyles.rowTitle}>{label}</Text>
|
||||
)}
|
||||
{typeof hint === "string" ? <Text style={layout.hint}>{hint}</Text> : hint}
|
||||
{typeof hint === "string" ? <Text style={settingsStyles.rowHint}>{hint}</Text> : hint}
|
||||
{error ? (
|
||||
<Text accessibilityRole="alert" style={settingsStyles.rowError}>
|
||||
{error}
|
||||
</Text>
|
||||
) : null}
|
||||
</View>
|
||||
{children ? (
|
||||
<View style={styles.control}>
|
||||
<ControlSizeProvider size={layout.controlSize}>{children}</ControlSizeProvider>
|
||||
</View>
|
||||
) : null}
|
||||
{children ? <View style={styles.control}>{children}</View> : null}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -131,7 +117,7 @@ export function SettingsSelect<Value extends string>({
|
||||
onValueChange,
|
||||
disabled,
|
||||
...row
|
||||
}: SettingsSelectProps<Value> & AppRowExtras) {
|
||||
}: SettingsSelectProps<Value>) {
|
||||
const selectedLabel = options.find((option) => option.value === value)?.label ?? value;
|
||||
return (
|
||||
<SettingsRow {...row}>
|
||||
@@ -166,7 +152,7 @@ export function SettingsInput({
|
||||
secureTextEntry,
|
||||
ref,
|
||||
...row
|
||||
}: SettingsInputProps & AppRowExtras) {
|
||||
}: SettingsInputProps) {
|
||||
const compact = useIsCompactFormFactor();
|
||||
const input = useRef<EditingTextInputHandle>(null);
|
||||
useImperativeHandle(
|
||||
@@ -189,7 +175,7 @@ export function SettingsInput({
|
||||
editable={!disabled}
|
||||
secureTextEntry={secureTextEntry}
|
||||
accessibilityLabel={row.label}
|
||||
size={compact ? "md" : undefined}
|
||||
size={compact ? "md" : "sm"}
|
||||
style={styles.input}
|
||||
/>
|
||||
</SettingsRow>
|
||||
@@ -199,7 +185,7 @@ export function SettingsInput({
|
||||
export function SettingsAction({ actionLabel, onPress, disabled, ...row }: SettingsActionProps) {
|
||||
return (
|
||||
<SettingsRow {...row}>
|
||||
<Button variant="outline" onPress={onPress} disabled={disabled}>
|
||||
<Button variant="outline" size="sm" onPress={onPress} disabled={disabled}>
|
||||
{actionLabel}
|
||||
</Button>
|
||||
</SettingsRow>
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
import React, { act } from "react";
|
||||
import { createRoot, type Root } from "react-dom/client";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { SettingsCard, SettingsCollapsibleRow, SettingsRow } from "@/components/settings";
|
||||
|
||||
let root: Root | null = null;
|
||||
let container: HTMLDivElement | null = null;
|
||||
|
||||
afterEach(() => {
|
||||
act(() => root?.unmount());
|
||||
container?.remove();
|
||||
root = null;
|
||||
container = null;
|
||||
});
|
||||
|
||||
function mountRows() {
|
||||
container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
root = createRoot(container);
|
||||
act(() =>
|
||||
root?.render(
|
||||
<SettingsCard>
|
||||
<SettingsRow label="Card row" testID="card-row">
|
||||
<Button variant="outline" testID="card-button">
|
||||
Download
|
||||
</Button>
|
||||
</SettingsRow>
|
||||
<SettingsCollapsibleRow label="Group" defaultExpanded testID="group">
|
||||
<SettingsRow label="Nested with a button" testID="nested-with-button">
|
||||
<Button variant="outline" testID="nested-button">
|
||||
Download
|
||||
</Button>
|
||||
</SettingsRow>
|
||||
<SettingsRow label="Nested without a button" testID="nested-without-button" />
|
||||
</SettingsCollapsibleRow>
|
||||
</SettingsCard>,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function element(testID: string): HTMLElement {
|
||||
const found = document.querySelector(`[data-testid="${testID}"]`);
|
||||
if (!(found instanceof HTMLElement)) throw new Error(`Nothing rendered as ${testID}`);
|
||||
return found;
|
||||
}
|
||||
|
||||
function heightOf(testID: string): number {
|
||||
return element(testID).getBoundingClientRect().height;
|
||||
}
|
||||
|
||||
function titleFontSize(rowTestID: string, label: string): number {
|
||||
const title = [...element(rowTestID).querySelectorAll("div")].find(
|
||||
(node) => node.textContent === label && node.children.length === 0,
|
||||
);
|
||||
if (!title) throw new Error(`No title ${label}`);
|
||||
return Number.parseFloat(getComputedStyle(title).fontSize);
|
||||
}
|
||||
|
||||
describe("settings row density", () => {
|
||||
it("lines up nested rows with and without a button, tighter than card rows", () => {
|
||||
mountRows();
|
||||
|
||||
expect(heightOf("nested-with-button")).toBe(heightOf("nested-without-button"));
|
||||
expect(heightOf("nested-with-button")).toBeLessThan(heightOf("card-row"));
|
||||
expect(heightOf("group-toggle")).toBeGreaterThan(heightOf("nested-without-button"));
|
||||
});
|
||||
|
||||
it("sizes nested text and controls one step below card rows", () => {
|
||||
mountRows();
|
||||
|
||||
expect(heightOf("nested-button")).toBeLessThan(heightOf("card-button"));
|
||||
expect(titleFontSize("nested-with-button", "Nested with a button")).toBeLessThan(
|
||||
titleFontSize("card-row", "Card row"),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -1,57 +0,0 @@
|
||||
import { createContext, useContext, useMemo, type ReactNode } from "react";
|
||||
import type { StyleProp, TextStyle, ViewStyle } from "react-native";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import { CONTROL_HEIGHTS } from "@/components/ui/control-geometry";
|
||||
import type { ContainedControlSize } from "@/components/ui/control-size";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
|
||||
// Rows revealed under a collapsible row belong to it, so they sit one step smaller than the rows
|
||||
// of the card: tighter padding, smaller text, smaller controls. The container decides; a row
|
||||
// never knows on its own that it is nested.
|
||||
const NestedRowsContext = createContext(false);
|
||||
|
||||
export function NestedSettingsRows({ children }: { children: ReactNode }) {
|
||||
return <NestedRowsContext.Provider value>{children}</NestedRowsContext.Provider>;
|
||||
}
|
||||
|
||||
export interface SettingsRowLayout {
|
||||
row: StyleProp<ViewStyle>;
|
||||
title: StyleProp<TextStyle>;
|
||||
hint: StyleProp<TextStyle>;
|
||||
/** The size of the controls in the row's trailing slot. */
|
||||
controlSize: ContainedControlSize;
|
||||
}
|
||||
|
||||
/** How a row lays out where it is rendered: in a card, or nested under a collapsible row. */
|
||||
export function useSettingsRowLayout(): SettingsRowLayout {
|
||||
const nested = useContext(NestedRowsContext);
|
||||
return useMemo(
|
||||
() =>
|
||||
nested
|
||||
? {
|
||||
row: [settingsStyles.row, styles.nestedRow],
|
||||
title: [settingsStyles.rowTitle, styles.nestedText],
|
||||
hint: [settingsStyles.rowHint, styles.nestedText],
|
||||
controlSize: "xs",
|
||||
}
|
||||
: {
|
||||
row: settingsStyles.row,
|
||||
title: settingsStyles.rowTitle,
|
||||
hint: settingsStyles.rowHint,
|
||||
controlSize: "sm",
|
||||
},
|
||||
[nested],
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
// Every nested row is as tall as one holding an `xs` control, so rows with and without a
|
||||
// trailing button line up.
|
||||
nestedRow: {
|
||||
paddingVertical: theme.spacing[2],
|
||||
minHeight: CONTROL_HEIGHTS.tight + theme.spacing[2] * 2,
|
||||
},
|
||||
nestedText: {
|
||||
fontSize: theme.fontSize.sm,
|
||||
},
|
||||
}));
|
||||
@@ -1,113 +0,0 @@
|
||||
import { ChevronRight } from "lucide-react-native";
|
||||
import { useCallback, useMemo } from "react";
|
||||
import { Text, View, type AccessibilityState, type PressableStateCallbackType } from "react-native";
|
||||
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||
import { mutedIconColorMapping } from "@/components/ui/icon-color";
|
||||
import { PressHighlight } from "@/components/ui/press-highlight";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
import { ICON_SIZE, type Theme } from "@/styles/theme";
|
||||
import { useSettingsRowLayout } from "./row-density";
|
||||
|
||||
const ThemedChevron = withUnistyles(ChevronRight);
|
||||
const hoveredIconColorMapping = (theme: Theme) => ({ color: theme.colors.foreground });
|
||||
|
||||
type HoverState = PressableStateCallbackType & { hovered?: boolean };
|
||||
|
||||
export interface SettingsRowHeaderProps {
|
||||
label: string;
|
||||
/** A short status shown before the chevron. */
|
||||
summary?: string;
|
||||
onPress: () => void;
|
||||
disabled?: boolean;
|
||||
/** Turns the chevron down, for a row whose children are revealed in place. */
|
||||
expanded?: boolean;
|
||||
accessibilityState?: AccessibilityState;
|
||||
/** Props React Native Web does not derive from `accessibilityState`, such as `aria-expanded`. */
|
||||
webAccessibilityProps?: Record<string, unknown> | null;
|
||||
testID?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The pressable line shared by settings rows that lead somewhere: a label, an optional summary and
|
||||
* a trailing chevron. A collapsible row turns the chevron down; a row that opens a sheet keeps it
|
||||
* pointing right.
|
||||
*/
|
||||
export function SettingsRowHeader({
|
||||
label,
|
||||
summary,
|
||||
onPress,
|
||||
disabled,
|
||||
expanded = false,
|
||||
accessibilityState,
|
||||
webAccessibilityProps,
|
||||
testID,
|
||||
}: SettingsRowHeaderProps) {
|
||||
const layout = useSettingsRowLayout();
|
||||
const rowStyle = useCallback(
|
||||
({ hovered, pressed }: HoverState) => [
|
||||
layout.row,
|
||||
!disabled && hovered && styles.hovered,
|
||||
!disabled && pressed && styles.pressed,
|
||||
],
|
||||
[disabled, layout],
|
||||
);
|
||||
const chevronStyle = useMemo(
|
||||
() => [styles.chevron, expanded && styles.chevronExpanded],
|
||||
[expanded],
|
||||
);
|
||||
return (
|
||||
<PressHighlight
|
||||
{...webAccessibilityProps}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={summary ? `${label}, ${summary}` : label}
|
||||
accessibilityState={accessibilityState}
|
||||
disabled={disabled}
|
||||
onPress={onPress}
|
||||
style={rowStyle}
|
||||
highlightStyle={styles.pressed}
|
||||
testID={testID}
|
||||
>
|
||||
{({ hovered }: HoverState) => (
|
||||
<>
|
||||
<View style={settingsStyles.rowContent}>
|
||||
<Text style={layout.title}>{label}</Text>
|
||||
</View>
|
||||
{summary ? (
|
||||
<Text style={styles.summary} numberOfLines={1}>
|
||||
{summary}
|
||||
</Text>
|
||||
) : null}
|
||||
{disabled ? null : (
|
||||
<View style={chevronStyle}>
|
||||
<ThemedChevron
|
||||
size={ICON_SIZE.sm}
|
||||
uniProps={hovered ? hoveredIconColorMapping : mutedIconColorMapping}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</PressHighlight>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
summary: {
|
||||
flexShrink: 1,
|
||||
color: theme.colors.foregroundMuted,
|
||||
fontSize: theme.fontSize.sm,
|
||||
marginRight: theme.spacing[2],
|
||||
},
|
||||
hovered: {
|
||||
backgroundColor: theme.colors.surface2,
|
||||
},
|
||||
pressed: {
|
||||
backgroundColor: theme.colors.surface3,
|
||||
},
|
||||
// Optical: the chevron's ink sits about 4px inside its box whether it points right or down; this
|
||||
// puts the ink on the card's trailing rail, where the switch and the reports' refresh buttons end.
|
||||
chevron: { marginRight: -theme.spacing[1] },
|
||||
chevronExpanded: {
|
||||
transform: [{ rotate: "90deg" }],
|
||||
},
|
||||
}));
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
type ActiveWorkspaceSelection,
|
||||
} from "@/stores/navigation-active-workspace-store";
|
||||
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||
import { density, densityIconBox, densityIconProps } from "@/styles/density";
|
||||
import { density, densityIconBox } from "@/styles/density";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
import type { SidebarSurfaceBackdrop } from "@/styles/surface-backdrop";
|
||||
import { getSidebarRowBackdrop } from "@/components/sidebar/sidebar-row-backdrop";
|
||||
@@ -463,12 +463,12 @@ const openInNewWindowLeadingIcon = (
|
||||
<ThemedExternalLink size={14} uniProps={foregroundMutedColorMapping} />
|
||||
);
|
||||
|
||||
const kebabTriggerIconProps = densityIconProps("sm", foregroundMutedColorMapping);
|
||||
const kebabTriggerIconHoveredProps = densityIconProps("sm", foregroundColorMapping);
|
||||
|
||||
function renderKebabTriggerIcon({ hovered }: { hovered?: boolean }) {
|
||||
return (
|
||||
<ThemedMoreVertical uniProps={hovered ? kebabTriggerIconHoveredProps : kebabTriggerIconProps} />
|
||||
<ThemedMoreVertical
|
||||
size={14}
|
||||
uniProps={hovered ? foregroundColorMapping : foregroundMutedColorMapping}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2705,12 +2705,8 @@ const styles = StyleSheet.create((theme) => ({
|
||||
marginRight: -6,
|
||||
},
|
||||
projectKebabButton: {
|
||||
// Larger on compact so the kebab is an easy tap target. The negative margins keep its
|
||||
// dots on the same rail as the 24px desktop box and the row at its 44px height.
|
||||
width: { xs: 32, md: 24 },
|
||||
height: { xs: 32, md: 24 },
|
||||
marginRight: { xs: -4, md: 0 },
|
||||
marginVertical: { xs: -4, md: 0 },
|
||||
width: 24,
|
||||
height: 24,
|
||||
borderRadius: theme.borderRadius.md,
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
|
||||
@@ -17,7 +17,6 @@ import { isWeb } from "@/constants/platform";
|
||||
import { getForgePresentation, normalizeForge } from "@/git/forge";
|
||||
import type { SidebarWorkspaceEntry } from "@/hooks/use-sidebar-workspaces-list";
|
||||
import { useAppSettings } from "@/hooks/use-settings";
|
||||
import { densityIconProps } from "@/styles/density";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
import type { ShortcutKey } from "@/utils/format-shortcut";
|
||||
import {
|
||||
@@ -71,11 +70,13 @@ const archiveLeadingIcon = <ThemedArchive size={14} uniProps={foregroundMutedCol
|
||||
const pinLeadingIcon = <ThemedPin size={14} uniProps={foregroundMutedColorMapping} />;
|
||||
const unpinLeadingIcon = <ThemedPinOff size={14} uniProps={foregroundMutedColorMapping} />;
|
||||
|
||||
const triggerIconProps = densityIconProps("sm", foregroundMutedColorMapping);
|
||||
const triggerIconHoveredProps = densityIconProps("sm", foregroundColorMapping);
|
||||
|
||||
function renderTriggerIcon({ hovered }: { hovered?: boolean }) {
|
||||
return <ThemedMoreVertical uniProps={hovered ? triggerIconHoveredProps : triggerIconProps} />;
|
||||
return (
|
||||
<ThemedMoreVertical
|
||||
size={14}
|
||||
uniProps={hovered ? foregroundColorMapping : foregroundMutedColorMapping}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export interface SidebarWorkspaceMenuProps {
|
||||
@@ -438,18 +439,12 @@ function triggerStyle({ hovered = false }: PressableStateCallbackType & { hovere
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
trigger: {
|
||||
// Larger on compact so the kebab is an easy tap target.
|
||||
width: { xs: 32, md: 18 },
|
||||
height: { xs: 32, md: 18 },
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
padding: 2,
|
||||
borderRadius: 4,
|
||||
marginLeft: 2,
|
||||
// Center the compact box on the 20px title line it is anchored to.
|
||||
marginTop: { xs: -6, md: 0 },
|
||||
// MoreVertical paints only around the center of its SVG. Keep the padded hit box, but
|
||||
// pull the painted dots through that unused view-box space onto the trailing-content rail.
|
||||
marginRight: { xs: -14, md: -7 },
|
||||
marginRight: -7,
|
||||
},
|
||||
triggerHovered: {
|
||||
backgroundColor: theme.colors.surface2,
|
||||
|
||||
@@ -5,9 +5,9 @@ import {
|
||||
useRef,
|
||||
useState,
|
||||
type ReactElement,
|
||||
type ReactNode,
|
||||
type RefObject,
|
||||
} from "react";
|
||||
import { View, useWindowDimensions, type StyleProp, type ViewStyle } from "react-native";
|
||||
import { View, useWindowDimensions } from "react-native";
|
||||
import { Portal } from "@gorhom/portal";
|
||||
import Animated, { useAnimatedReaction, useAnimatedStyle } from "react-native-reanimated";
|
||||
import { scheduleOnRN } from "react-native-worklets";
|
||||
@@ -32,8 +32,7 @@ interface RelativeAnchorRect {
|
||||
|
||||
interface AutocompletePopoverProps {
|
||||
visible: boolean;
|
||||
children: ReactNode;
|
||||
anchorStyle?: StyleProp<ViewStyle>;
|
||||
anchorRef: RefObject<View | null>;
|
||||
options: readonly AutocompleteOption[];
|
||||
selectedIndex: number;
|
||||
onSelect: (option: AutocompleteOption) => void;
|
||||
@@ -45,8 +44,7 @@ interface AutocompletePopoverProps {
|
||||
|
||||
export function AutocompletePopover({
|
||||
visible,
|
||||
children,
|
||||
anchorStyle,
|
||||
anchorRef,
|
||||
options,
|
||||
selectedIndex,
|
||||
onSelect,
|
||||
@@ -57,7 +55,6 @@ export function AutocompletePopover({
|
||||
}: AutocompletePopoverProps): ReactElement | null {
|
||||
"use no memo";
|
||||
// React Compiler memoizes effect captures by reading SharedValue.value during render.
|
||||
const anchorRef = useRef<View>(null);
|
||||
const [relativeAnchorRect, setRelativeAnchorRect] = useState<RelativeAnchorRect | null>(null);
|
||||
const windowDimensions = useWindowDimensions();
|
||||
const safeAreaInsets = useSafeAreaInsets();
|
||||
@@ -140,29 +137,25 @@ export function AutocompletePopover({
|
||||
[anchorY, reservedLift, safeAreaInsets.top],
|
||||
);
|
||||
|
||||
const showPopover = canMeasure && relativeAnchorRect && baseStyle;
|
||||
if (!visible || !relativeAnchorRect || !baseStyle) return null;
|
||||
if (options.length > 0 && selectedIndex < 0) return null;
|
||||
|
||||
// The translate view is the popover's own frame, so it lifts only the popover.
|
||||
return (
|
||||
<View ref={anchorRef} onLayout={remeasure} style={anchorStyle} collapsable={false}>
|
||||
{children}
|
||||
{showPopover ? (
|
||||
<Portal hostName={portalHostName}>
|
||||
<KeyboardTranslateView {...anchor.translation} style={baseStyle}>
|
||||
<Animated.View testID="composer-autocomplete-popover" style={heightStyle}>
|
||||
<Autocomplete
|
||||
options={options}
|
||||
selectedIndex={selectedIndex}
|
||||
onSelect={onSelect}
|
||||
isLoading={isLoading}
|
||||
errorMessage={errorMessage}
|
||||
loadingText={loadingText}
|
||||
emptyText={emptyText}
|
||||
/>
|
||||
</Animated.View>
|
||||
</KeyboardTranslateView>
|
||||
</Portal>
|
||||
) : null}
|
||||
</View>
|
||||
<Portal hostName={portalHostName}>
|
||||
<KeyboardTranslateView {...anchor.translation} style={baseStyle}>
|
||||
<Animated.View testID="composer-autocomplete-popover" style={heightStyle}>
|
||||
<Autocomplete
|
||||
options={options}
|
||||
selectedIndex={selectedIndex}
|
||||
onSelect={onSelect}
|
||||
isLoading={isLoading}
|
||||
errorMessage={errorMessage}
|
||||
loadingText={loadingText}
|
||||
emptyText={emptyText}
|
||||
/>
|
||||
</Animated.View>
|
||||
</KeyboardTranslateView>
|
||||
</Portal>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -247,16 +247,14 @@ export function Autocomplete({
|
||||
<View style={styles.outerWrapper}>
|
||||
{selectedOption?.kind === "command" && selectedOption.description ? (
|
||||
<View style={styles.detailCard}>
|
||||
<Text style={styles.detailLabel} numberOfLines={1}>
|
||||
<Text style={styles.detailLabel}>
|
||||
{removeBoltGlyphs(selectedOption.label) ?? selectedOption.label}
|
||||
</Text>
|
||||
<Text style={styles.detailDescription} numberOfLines={2} ellipsizeMode="tail">
|
||||
<Text style={styles.detailDescription}>
|
||||
{removeBoltGlyphs(selectedOption.description)}
|
||||
</Text>
|
||||
{selectedOption.detail ? (
|
||||
<Text style={styles.detailHint} numberOfLines={1}>
|
||||
{removeBoltGlyphs(selectedOption.detail)}
|
||||
</Text>
|
||||
<Text style={styles.detailHint}>{removeBoltGlyphs(selectedOption.detail)}</Text>
|
||||
) : null}
|
||||
</View>
|
||||
) : null}
|
||||
@@ -295,9 +293,6 @@ const styles = StyleSheet.create((theme: Theme) => ({
|
||||
gap: theme.spacing[1],
|
||||
},
|
||||
detailCard: {
|
||||
flexShrink: 1,
|
||||
minHeight: 0,
|
||||
overflow: "hidden",
|
||||
backgroundColor: theme.colors.surface1,
|
||||
borderWidth: theme.borderWidth[1],
|
||||
borderColor: theme.colors.borderAccent,
|
||||
@@ -323,8 +318,7 @@ const styles = StyleSheet.create((theme: Theme) => ({
|
||||
},
|
||||
container: {
|
||||
flexShrink: 1,
|
||||
// Keep a complete selectable row (36), list padding (8), and borders (2).
|
||||
minHeight: 46,
|
||||
minHeight: 0,
|
||||
backgroundColor: theme.colors.surface1,
|
||||
borderWidth: theme.borderWidth[1],
|
||||
borderColor: theme.colors.borderAccent,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { LoadingSpinner } from "@/components/ui/loading-spinner";
|
||||
import { useContainedControlSize } from "@/components/ui/control-size";
|
||||
import {
|
||||
default as React,
|
||||
useCallback,
|
||||
@@ -163,7 +162,7 @@ const styles = StyleSheet.create((theme) => {
|
||||
export function Button({
|
||||
children,
|
||||
variant = "secondary",
|
||||
size: sizeProp,
|
||||
size = "md",
|
||||
leftIcon,
|
||||
trailing,
|
||||
style,
|
||||
@@ -186,8 +185,6 @@ export function Button({
|
||||
}
|
||||
>) {
|
||||
const [hovered, setHovered] = useState(false);
|
||||
const containedSize = useContainedControlSize();
|
||||
const size = sizeProp ?? containedSize ?? "md";
|
||||
const isDisabled = disabled || loading;
|
||||
|
||||
let variantStyle: ViewStyle;
|
||||
|
||||
@@ -81,8 +81,6 @@ describe("control geometry", () => {
|
||||
it("keeps field text sizing tied to control size", () => {
|
||||
const geometry = createControlGeometry(theme);
|
||||
|
||||
expect(geometry.fieldTextXs.fontSize).toBe(12);
|
||||
expect(geometry.fieldTextXs.lineHeight).toBe(17);
|
||||
expect(geometry.fieldTextSm.fontSize).toBe(14);
|
||||
expect(geometry.fieldTextSm.lineHeight).toBe(20);
|
||||
expect(geometry.fieldTextMd.fontSize).toBe(14);
|
||||
@@ -97,13 +95,6 @@ describe("control geometry", () => {
|
||||
const geometry = createControlGeometry(theme);
|
||||
const borderWidth = theme.borderWidth[1];
|
||||
|
||||
expect(geometry.fieldControlXs.minHeight).toBe(28);
|
||||
expect(
|
||||
geometry.fieldTextXs.lineHeight +
|
||||
geometry.fieldControlXs.paddingVertical * 2 +
|
||||
borderWidth * 2,
|
||||
).toBe(geometry.fieldControlXs.minHeight);
|
||||
|
||||
expect(geometry.fieldControlSm.minHeight).toBe(32);
|
||||
expect(geometry.fieldControlSm.paddingVertical).toBe(5);
|
||||
expect(
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { StyleProp, ViewStyle } from "react-native";
|
||||
import { ICON_SIZE, type Theme } from "@/styles/theme";
|
||||
|
||||
export type ButtonControlSize = "xs" | "sm" | "md" | "lg";
|
||||
export type FieldControlSize = "xs" | "sm" | "md";
|
||||
export type FieldControlSize = "sm" | "md";
|
||||
export type SegmentedControlSize = "xs" | "sm" | "md";
|
||||
export type ControlInteractionPhase = "rest" | "hover" | "active";
|
||||
|
||||
@@ -188,19 +188,8 @@ export function resolveControlInteractionStyles(
|
||||
|
||||
export function createControlGeometry(theme: Theme) {
|
||||
const controlBorderWidth = theme.borderWidth[1];
|
||||
const fieldTextXsLineHeight = fieldLineHeight(theme.fontSize.sm);
|
||||
const fieldTextSmLineHeight = fieldLineHeight(theme.fontSize.base);
|
||||
const fieldTextMdLineHeight = fieldLineHeight(theme.fontSize.base);
|
||||
const fieldControlXs = {
|
||||
minHeight: CONTROL_HEIGHTS.tight,
|
||||
paddingHorizontal: theme.spacing[2],
|
||||
paddingVertical: fieldVerticalPadding(
|
||||
CONTROL_HEIGHTS.tight,
|
||||
fieldTextXsLineHeight,
|
||||
controlBorderWidth,
|
||||
),
|
||||
borderRadius: theme.borderRadius.md,
|
||||
};
|
||||
const fieldControlSm = {
|
||||
minHeight: CONTROL_HEIGHTS.compact,
|
||||
paddingHorizontal: theme.spacing[3],
|
||||
@@ -221,10 +210,6 @@ export function createControlGeometry(theme: Theme) {
|
||||
),
|
||||
borderRadius: theme.borderRadius.lg,
|
||||
};
|
||||
const fieldTextXs = {
|
||||
fontSize: theme.fontSize.sm,
|
||||
lineHeight: fieldTextXsLineHeight,
|
||||
};
|
||||
const fieldTextSm = {
|
||||
fontSize: theme.fontSize.base,
|
||||
lineHeight: fieldTextSmLineHeight,
|
||||
@@ -267,10 +252,6 @@ export function createControlGeometry(theme: Theme) {
|
||||
fontSize: theme.fontSize.sm,
|
||||
},
|
||||
alert,
|
||||
formTextInputXs: {
|
||||
...fieldControlXs,
|
||||
...fieldTextXs,
|
||||
},
|
||||
formTextInputSm: {
|
||||
...fieldControlSm,
|
||||
...fieldTextSm,
|
||||
@@ -283,10 +264,8 @@ export function createControlGeometry(theme: Theme) {
|
||||
...fieldControlMd,
|
||||
...fieldTextMd,
|
||||
},
|
||||
fieldControlXs,
|
||||
fieldControlSm,
|
||||
fieldControlMd,
|
||||
fieldTextXs,
|
||||
fieldTextSm,
|
||||
fieldTextMd,
|
||||
controlRest: {
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { createContext, useContext, type ReactNode } from "react";
|
||||
|
||||
/** The control sizes a container can ask of the controls placed in it. */
|
||||
export type ContainedControlSize = "xs" | "sm";
|
||||
|
||||
// A row decides how big its controls are, so a button or field placed in it needs no size of
|
||||
// its own. A size passed to the control still wins.
|
||||
const ControlSizeContext = createContext<ContainedControlSize | null>(null);
|
||||
|
||||
export function ControlSizeProvider({
|
||||
size,
|
||||
children,
|
||||
}: {
|
||||
size: ContainedControlSize;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return <ControlSizeContext.Provider value={size}>{children}</ControlSizeContext.Provider>;
|
||||
}
|
||||
|
||||
/** The size the surrounding container asks for, or null outside one. */
|
||||
export function useContainedControlSize(): ContainedControlSize | null {
|
||||
return useContext(ControlSizeContext);
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
} from "@/components/ui/control-geometry";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
import { DropdownMenuTrigger, type DropdownMenuTriggerProps } from "@/components/ui/dropdown-menu";
|
||||
import { useContainedControlSize } from "@/components/ui/control-size";
|
||||
|
||||
const ThemedChevronDown = withUnistyles(ChevronDown);
|
||||
|
||||
@@ -33,12 +32,10 @@ interface DropdownTriggerProps extends Omit<DropdownMenuTriggerProps, "children"
|
||||
export function DropdownTrigger({
|
||||
children,
|
||||
leading,
|
||||
size: sizeProp,
|
||||
size = "sm",
|
||||
disabled,
|
||||
...props
|
||||
}: DropdownTriggerProps): ReactElement {
|
||||
const containedSize = useContainedControlSize();
|
||||
const size = sizeProp ?? containedSize ?? "sm";
|
||||
let sizeStyle: ViewStyle;
|
||||
if (size === "xs") {
|
||||
sizeStyle = styles.xs;
|
||||
|
||||
@@ -4,10 +4,9 @@ import Svg, { Defs, LinearGradient as SvgLinearGradient, Rect, Stop } from "reac
|
||||
import { withUnistyles } from "react-native-unistyles";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
|
||||
type EdgeFadeBackdrop = "surface0" | "surfaceWorkspace" | "surface3";
|
||||
type EdgeFadeBackdrop = "surface0" | "surfaceWorkspace";
|
||||
|
||||
const backdropColorMappings: Record<EdgeFadeBackdrop, (theme: Theme) => { color: string }> = {
|
||||
surface3: (theme) => ({ color: theme.colors.surface3 }),
|
||||
surface0: (theme) => ({ color: theme.colors.surface0 }),
|
||||
surfaceWorkspace: (theme) => ({ color: theme.colors.surfaceWorkspace }),
|
||||
};
|
||||
|
||||
@@ -23,16 +23,6 @@ import {
|
||||
resolveControlInteractionStyles,
|
||||
type FieldControlSize,
|
||||
} from "@/components/ui/control-geometry";
|
||||
import { useContainedControlSize } from "@/components/ui/control-size";
|
||||
|
||||
const FIELD_CHROME = { xs: "chromeXs", sm: "chromeSm", md: "chromeMd" } as const satisfies Record<
|
||||
FieldControlSize,
|
||||
string
|
||||
>;
|
||||
const FIELD_TEXT = { xs: "inputXs", sm: "inputSm", md: "inputMd" } as const satisfies Record<
|
||||
FieldControlSize,
|
||||
string
|
||||
>;
|
||||
|
||||
interface FieldProps {
|
||||
label: string;
|
||||
@@ -169,13 +159,11 @@ function assignTextInputRef(
|
||||
}
|
||||
|
||||
export const FormTextInput = forwardRef<EditingTextInputHandle, FormTextInputProps>(
|
||||
function FormTextInput({ size: sizeProp, style, onFocus, onBlur, editable, ...props }, ref) {
|
||||
function FormTextInput({ size = "md", style, onFocus, onBlur, editable, ...props }, ref) {
|
||||
const [focused, setFocused] = useState(false);
|
||||
const containedSize = useContainedControlSize();
|
||||
const size = sizeProp ?? containedSize ?? "md";
|
||||
const isDisabled = editable === false;
|
||||
const chromeSizeStyle = formInputStyles[FIELD_CHROME[size]];
|
||||
const inputSizeStyle = formInputStyles[FIELD_TEXT[size]];
|
||||
const chromeSizeStyle = size === "sm" ? formInputStyles.chromeSm : formInputStyles.chromeMd;
|
||||
const inputSizeStyle = size === "sm" ? formInputStyles.inputSm : formInputStyles.inputMd;
|
||||
const splitStyle = useMemo(() => splitFormTextInputStyle(style), [style]);
|
||||
const setInputRef = useCallback(
|
||||
(node: EditingTextInputHandle | null) => {
|
||||
@@ -274,9 +262,6 @@ const formInputStyles = StyleSheet.create((theme) => {
|
||||
chrome: {
|
||||
backgroundColor: theme.colors.surface2,
|
||||
},
|
||||
chromeXs: {
|
||||
...geometry.fieldControlXs,
|
||||
},
|
||||
chromeSm: {
|
||||
...geometry.fieldControlSm,
|
||||
},
|
||||
@@ -304,9 +289,6 @@ const formInputStyles = StyleSheet.create((theme) => {
|
||||
outlineColor: "transparent",
|
||||
outlineWidth: 0,
|
||||
},
|
||||
inputXs: {
|
||||
...geometry.fieldTextXs,
|
||||
},
|
||||
inputSm: {
|
||||
...geometry.fieldTextSm,
|
||||
},
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import type { Theme } from "@/styles/theme";
|
||||
|
||||
export const foregroundIconColorMapping = (theme: Theme) => ({
|
||||
color: theme.colors.foreground,
|
||||
});
|
||||
|
||||
export const mutedIconColorMapping = (theme: Theme) => ({
|
||||
color: theme.colors.foregroundMuted,
|
||||
});
|
||||
|
||||
@@ -58,7 +58,6 @@ vi.mock("@gorhom/bottom-sheet", async () => {
|
||||
});
|
||||
|
||||
import { IsolatedBottomSheetModal, type ContextBridge } from ".";
|
||||
import { useAnimatedLayout } from "@gorhom/bottom-sheet/src/hooks/useAnimatedLayout";
|
||||
import { useIsInsideBottomSheet } from "@/components/ui/bottom-sheet-scope";
|
||||
|
||||
/** Renders whatever the portal is currently holding, from its own place in the tree. */
|
||||
@@ -201,35 +200,3 @@ describe("IsolatedBottomSheetModal context bridging", () => {
|
||||
).toEqual(["false", "true"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("bottom sheet layout subscription", () => {
|
||||
it("stops updating a dismissed sheet when the window resizes", () => {
|
||||
const container = document.createElement("div");
|
||||
const root = createRoot(container);
|
||||
let layout: ReturnType<typeof useAnimatedLayout> | undefined;
|
||||
const viewport = document.documentElement;
|
||||
const originalWidth = Object.getOwnPropertyDescriptor(viewport, "clientWidth");
|
||||
function resize(width: number) {
|
||||
Object.defineProperty(viewport, "clientWidth", { configurable: true, value: width });
|
||||
act(() => window.dispatchEvent(new Event("resize")));
|
||||
}
|
||||
function LayoutProbe() {
|
||||
layout = useAnimatedLayout(undefined, 0, 0);
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
act(() => root.render(<LayoutProbe />));
|
||||
if (!layout) throw new Error("Sheet layout did not mount");
|
||||
const mountedLayout = layout;
|
||||
resize(640);
|
||||
expect(mountedLayout.get().window.width).toBe(640);
|
||||
act(() => root.render(null));
|
||||
resize(960);
|
||||
expect(mountedLayout.get().window.width).toBe(640);
|
||||
} finally {
|
||||
act(() => root.unmount());
|
||||
if (originalWidth) Object.defineProperty(viewport, "clientWidth", originalWidth);
|
||||
else Reflect.deleteProperty(viewport, "clientWidth");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
segmentedIconSize,
|
||||
type SegmentedControlSize,
|
||||
} from "@/components/ui/control-geometry";
|
||||
import { useContainedControlSize } from "@/components/ui/control-size";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
|
||||
type SegmentedControlIconRenderer = (props: { color: string; size: number }) => ReactNode;
|
||||
@@ -49,13 +48,11 @@ export function SegmentedControl<T extends string>({
|
||||
options,
|
||||
value,
|
||||
onValueChange,
|
||||
size: sizeProp,
|
||||
size = "md",
|
||||
hideLabels = false,
|
||||
style,
|
||||
testID,
|
||||
}: SegmentedControlProps<T>) {
|
||||
const containedSize = useContainedControlSize();
|
||||
const size = sizeProp ?? containedSize ?? "md";
|
||||
const sizeStyles = {
|
||||
xs: { container: styles.containerXs, segment: styles.segmentXs, label: styles.labelXs },
|
||||
sm: { container: styles.containerSm, segment: styles.segmentSm, label: styles.labelSm },
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
import { useState, useCallback, useMemo, type ReactNode } from "react";
|
||||
import { View, type LayoutChangeEvent } from "react-native";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import type { AgentMessage } from "@getpaseo/protocol/agent-message";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { EdgeFade } from "@/components/ui/edge-fade";
|
||||
import { useProviderIcon } from "@/components/provider-icons";
|
||||
import { useSessionStore } from "@/stores/session-store";
|
||||
import { navigateToAgent } from "@/utils/navigate-to-agent";
|
||||
|
||||
const PREVIEW_HEIGHT = 240;
|
||||
|
||||
export function MessagePreview({ children }: { children: ReactNode }) {
|
||||
const { t } = useTranslation();
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
const [height, setHeight] = useState(0);
|
||||
const overflowing = height > PREVIEW_HEIGHT;
|
||||
const measure = useCallback(
|
||||
(event: LayoutChangeEvent) => setHeight(event.nativeEvent.layout.height),
|
||||
[],
|
||||
);
|
||||
const toggle = useCallback(() => setExpanded((value) => !value), []);
|
||||
const accessibilityState = useMemo(() => ({ expanded }), [expanded]);
|
||||
return (
|
||||
<>
|
||||
<View style={!expanded && styles.preview}>
|
||||
<View style={styles.body} onLayout={measure}>
|
||||
{children}
|
||||
</View>
|
||||
{overflowing && !expanded ? (
|
||||
<EdgeFade edge="bottom" solidFraction={0} backdrop="surface3" style={styles.fade} />
|
||||
) : null}
|
||||
</View>
|
||||
{overflowing ? (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
style={styles.toggle}
|
||||
accessibilityState={accessibilityState}
|
||||
onPress={toggle}
|
||||
>
|
||||
{t(expanded ? "turnSummary.showLess" : "turnSummary.showMore")}
|
||||
</Button>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export function MessageSender({
|
||||
sender,
|
||||
serverId,
|
||||
}: {
|
||||
sender: AgentMessage["sender"];
|
||||
serverId?: string;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const host = sender.serverId ?? serverId;
|
||||
const agent = useSessionStore((state) => {
|
||||
const session = host ? state.sessions[host] : undefined;
|
||||
return session?.agents.get(sender.id) ?? session?.agentDetails.get(sender.id);
|
||||
});
|
||||
const ProviderIcon = useProviderIcon(agent?.provider ?? "", host);
|
||||
const openSender = useCallback(() => {
|
||||
if (host) navigateToAgent({ serverId: host, agentId: sender.id });
|
||||
}, [host, sender.id]);
|
||||
return (
|
||||
<Button variant="ghost" size="sm" leftIcon={ProviderIcon} disabled={!host} onPress={openSender}>
|
||||
{t("turnSummary.sentBy", { name: agent?.title ?? sender.title ?? sender.id })}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
preview: { maxHeight: PREVIEW_HEIGHT, overflow: "hidden" },
|
||||
body: { flexShrink: 0 },
|
||||
toggle: { alignSelf: "flex-start", paddingHorizontal: 0, borderWidth: 0 },
|
||||
fade: { position: "absolute", bottom: 0, left: 0, right: 0, height: theme.spacing[12] },
|
||||
}));
|
||||
@@ -1003,8 +1003,7 @@ function ComposerAutocompleteBinding({
|
||||
recall,
|
||||
configuration,
|
||||
inputRef,
|
||||
children,
|
||||
anchorStyle,
|
||||
anchorRef,
|
||||
show,
|
||||
ref,
|
||||
}: {
|
||||
@@ -1016,8 +1015,7 @@ function ComposerAutocompleteBinding({
|
||||
"userInput" | "cursorIndex" | "onAutocompleteApplied"
|
||||
>;
|
||||
inputRef: React.RefObject<MessageInputRef | null>;
|
||||
children: React.ReactNode;
|
||||
anchorStyle: React.ComponentProps<typeof View>["style"];
|
||||
anchorRef: React.RefObject<View | null>;
|
||||
show: boolean;
|
||||
ref: React.Ref<ComposerAutocompleteHandle>;
|
||||
}) {
|
||||
@@ -1044,7 +1042,7 @@ function ComposerAutocompleteBinding({
|
||||
return (
|
||||
<ComposerAutocomplete
|
||||
visible={autocomplete.isVisible && isShown}
|
||||
anchorStyle={anchorStyle}
|
||||
anchorRef={anchorRef}
|
||||
options={autocomplete.options}
|
||||
selectedIndex={autocomplete.selectedIndex}
|
||||
onSelect={onSelect}
|
||||
@@ -1052,9 +1050,7 @@ function ComposerAutocompleteBinding({
|
||||
errorMessage={autocomplete.errorMessage}
|
||||
loadingText={autocomplete.loadingText}
|
||||
emptyText={autocomplete.emptyText}
|
||||
>
|
||||
{children}
|
||||
</ComposerAutocomplete>
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2383,6 +2379,7 @@ function ComposerContentImpl({
|
||||
pluginClientSlashCommands,
|
||||
],
|
||||
);
|
||||
const messageInputContainerRef = useRef<View>(null);
|
||||
|
||||
const isSubmitLoadingVisible =
|
||||
isProcessing || isSubmitLoading || isUploadingFile || pendingNativeImagePastes > 0;
|
||||
@@ -2441,16 +2438,17 @@ function ComposerContentImpl({
|
||||
{isFullscreen ? null : queueList}
|
||||
{!isFullscreen && sendErrorNode}
|
||||
|
||||
<ComposerAutocompleteBinding
|
||||
text={textSource}
|
||||
cursor={cursor}
|
||||
recall={recall}
|
||||
inputRef={messageInputRef}
|
||||
anchorStyle={messageInputContainerStyle}
|
||||
show={mode.showAutocomplete && !isFullscreen}
|
||||
ref={autocompleteRef}
|
||||
configuration={autocompleteConfiguration}
|
||||
>
|
||||
<View ref={messageInputContainerRef} style={messageInputContainerStyle}>
|
||||
<ComposerAutocompleteBinding
|
||||
text={textSource}
|
||||
cursor={cursor}
|
||||
recall={recall}
|
||||
inputRef={messageInputRef}
|
||||
anchorRef={messageInputContainerRef}
|
||||
show={mode.showAutocomplete && !isFullscreen}
|
||||
ref={autocompleteRef}
|
||||
configuration={autocompleteConfiguration}
|
||||
/>
|
||||
<ComposerForgeBinding
|
||||
text={textSource}
|
||||
configuration={forgeConfiguration}
|
||||
@@ -2530,7 +2528,7 @@ function ComposerContentImpl({
|
||||
renderOption={renderGithubPickerOption}
|
||||
/>
|
||||
{pluginAttachments.picker}
|
||||
</ComposerAutocompleteBinding>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -27,7 +27,6 @@ import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { ICON_SIZE, type Theme } from "@/styles/theme";
|
||||
import { ArrowUp, Mic, MicOff, CornerDownLeft, Plus, Square } from "lucide-react-native";
|
||||
import * as Haptics from "expo-haptics";
|
||||
import { useDictation } from "@/hooks/use-dictation";
|
||||
import { hasFinePointer } from "@/hooks/use-fine-pointer";
|
||||
import { DictationOverlay } from "@/components/dictation-controls";
|
||||
@@ -58,7 +57,7 @@ import { formatShortcut, type ShortcutKey } from "@/utils/format-shortcut";
|
||||
import { getShortcutOs } from "@/utils/shortcut-platform";
|
||||
import type { MessageInputKeyboardActionKind } from "@/keyboard/actions";
|
||||
import { isImeComposingKeyboardEvent } from "@/utils/keyboard-ime";
|
||||
import { isNative, isWeb } from "@/constants/platform";
|
||||
import { isWeb } from "@/constants/platform";
|
||||
import { useIsCompactFormFactor } from "@/constants/layout";
|
||||
import { useComposerKeyboardScope } from "@/composer/keyboard-scope";
|
||||
import { RenderProfile } from "@/utils/render-profiler";
|
||||
@@ -77,7 +76,6 @@ const ComposerTextInput = withUnistyles(EditingTextInput, (theme) => ({
|
||||
}));
|
||||
import {
|
||||
resolveSendTooltipLabel,
|
||||
resolveSubmitAccessibilityHint,
|
||||
resolveSubmitAccessibilityLabel,
|
||||
resolveVoiceAccessibilityLabel,
|
||||
resolveVoiceTooltipText,
|
||||
@@ -85,7 +83,6 @@ import {
|
||||
import {
|
||||
applyDictationTranscript,
|
||||
computeCanStartDictation,
|
||||
resolveAlternateSendAction,
|
||||
resolveComposerSurfacePresentation,
|
||||
resolveComposerSurfaceText,
|
||||
resolveRetainedSelection,
|
||||
@@ -402,6 +399,8 @@ interface DesktopKeyPressContext {
|
||||
onKeyPressCallback: ((event: ComposerKeyPressEvent) => boolean) | undefined;
|
||||
input: ComposerKeyPressEvent["input"];
|
||||
submitOnEnter: boolean;
|
||||
isAgentRunning: boolean;
|
||||
onQueue: ((payload: MessagePayload) => void) | undefined;
|
||||
isSubmitDisabled: boolean;
|
||||
isSubmitLoading: boolean;
|
||||
disabled: boolean;
|
||||
@@ -431,12 +430,15 @@ function handleDesktopKeyPressImpl(
|
||||
if (!ctx.submitOnEnter) return;
|
||||
if (shiftKey) return;
|
||||
|
||||
if (ctx.isSubmitDisabled || ctx.isSubmitLoading || ctx.disabled) return;
|
||||
event.preventDefault();
|
||||
if (metaKey || ctrlKey) {
|
||||
if ((metaKey || ctrlKey) && ctx.isAgentRunning && ctx.onQueue) {
|
||||
if (ctx.isSubmitDisabled || ctx.isSubmitLoading || ctx.disabled) return;
|
||||
event.preventDefault();
|
||||
ctx.handleAlternateSendAction();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx.isSubmitDisabled || ctx.isSubmitLoading || ctx.disabled) return;
|
||||
event.preventDefault();
|
||||
ctx.handleDefaultSendAction();
|
||||
}
|
||||
|
||||
@@ -767,10 +769,8 @@ function SendButtonTooltip({
|
||||
canPressLoadingButton,
|
||||
onSubmitLoadingPress,
|
||||
onDefaultSendAction,
|
||||
onLongPressSend,
|
||||
isSendButtonDisabled,
|
||||
submitAccessibilityLabel,
|
||||
submitAccessibilityHint,
|
||||
sendButtonCombinedStyle,
|
||||
isSubmitLoading,
|
||||
submitIcon,
|
||||
@@ -784,10 +784,8 @@ function SendButtonTooltip({
|
||||
canPressLoadingButton: boolean;
|
||||
onSubmitLoadingPress: (() => void) | undefined;
|
||||
onDefaultSendAction: () => void;
|
||||
onLongPressSend: () => void;
|
||||
isSendButtonDisabled: boolean;
|
||||
submitAccessibilityLabel: string;
|
||||
submitAccessibilityHint: string | undefined;
|
||||
sendButtonCombinedStyle: React.ComponentProps<typeof TooltipTrigger>["style"];
|
||||
isSubmitLoading: boolean;
|
||||
submitIcon: "arrow" | "return";
|
||||
@@ -802,10 +800,8 @@ function SendButtonTooltip({
|
||||
<Tooltip delayDuration={0} enabledOnDesktop enabledOnMobile={false}>
|
||||
<TooltipTrigger
|
||||
onPress={canPressLoadingButton ? onSubmitLoadingPress : onDefaultSendAction}
|
||||
onLongPress={canPressLoadingButton ? undefined : onLongPressSend}
|
||||
disabled={isSendButtonDisabled}
|
||||
accessibilityLabel={submitAccessibilityLabel}
|
||||
accessibilityHint={submitAccessibilityHint}
|
||||
accessibilityRole="button"
|
||||
testID={submitButtonTestID}
|
||||
style={sendButtonCombinedStyle}
|
||||
@@ -1709,19 +1705,6 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
|
||||
});
|
||||
}, [defaultSendBehavior, isAgentRunning, handleSendMessage, handleQueueMessage, onQueue]);
|
||||
|
||||
const alternateSendAction = resolveAlternateSendAction({
|
||||
defaultSendBehavior,
|
||||
isAgentRunning,
|
||||
onQueue,
|
||||
});
|
||||
|
||||
const handleLongPressSend = useCallback(() => {
|
||||
if (alternateSendAction && isNative) {
|
||||
void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium).catch(() => {});
|
||||
}
|
||||
handleAlternateSendAction();
|
||||
}, [alternateSendAction, handleAlternateSendAction]);
|
||||
|
||||
usePasteImagesEffect({
|
||||
textarea: webTextArea,
|
||||
isConnected,
|
||||
@@ -1755,6 +1738,8 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
|
||||
selectionRef.current,
|
||||
),
|
||||
submitOnEnter: shouldSubmitOnEnter,
|
||||
isAgentRunning,
|
||||
onQueue,
|
||||
isSubmitDisabled,
|
||||
isSubmitLoading,
|
||||
disabled,
|
||||
@@ -1766,6 +1751,8 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
|
||||
shouldHandleWebKeyPress,
|
||||
onKeyPressCallback,
|
||||
shouldSubmitOnEnter,
|
||||
isAgentRunning,
|
||||
onQueue,
|
||||
isSubmitDisabled,
|
||||
isSubmitLoading,
|
||||
disabled,
|
||||
@@ -1805,11 +1792,6 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
|
||||
isAgentRunning,
|
||||
t,
|
||||
});
|
||||
const submitAccessibilityHint = resolveSubmitAccessibilityHint({
|
||||
canPressLoadingButton,
|
||||
alternateSendAction,
|
||||
t,
|
||||
});
|
||||
|
||||
const voiceButtonAccessibilityLabel = resolveVoiceAccessibilityLabel({
|
||||
isRealtimeVoiceForCurrentAgent,
|
||||
@@ -1970,10 +1952,8 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
|
||||
canPressLoadingButton={canPressLoadingButton}
|
||||
onSubmitLoadingPress={onSubmitLoadingPress}
|
||||
onDefaultSendAction={handleDefaultSendAction}
|
||||
onLongPressSend={handleLongPressSend}
|
||||
isSendButtonDisabled={isPresentedSendDisabled}
|
||||
submitAccessibilityLabel={submitAccessibilityLabel}
|
||||
submitAccessibilityHint={submitAccessibilityHint}
|
||||
sendButtonCombinedStyle={sendButtonCombinedStyle}
|
||||
isSubmitLoading={isSubmitLoading}
|
||||
submitIcon={submitIcon}
|
||||
@@ -1991,10 +1971,8 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
|
||||
canPressLoadingButton,
|
||||
onSubmitLoadingPress,
|
||||
handleDefaultSendAction,
|
||||
handleLongPressSend,
|
||||
isPresentedSendDisabled,
|
||||
submitAccessibilityLabel,
|
||||
submitAccessibilityHint,
|
||||
sendButtonCombinedStyle,
|
||||
isSubmitLoading,
|
||||
submitIcon,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
resolveSendTooltipLabel,
|
||||
resolveSubmitAccessibilityHint,
|
||||
resolveSubmitAccessibilityLabel,
|
||||
resolveVoiceAccessibilityLabel,
|
||||
resolveVoiceTooltipText,
|
||||
@@ -13,8 +12,6 @@ const translations: Record<string, string> = {
|
||||
"composer.input.sendAndInterrupt": "Send and interrupt",
|
||||
"composer.input.sendAndSteer": "Send and steer",
|
||||
"composer.input.sendMessage": "Send message",
|
||||
"composer.input.longPressToQueue": "Long press to queue",
|
||||
"composer.input.longPressToSendNow": "Long press to send now",
|
||||
"composer.input.queue": "Queue",
|
||||
"composer.input.send": "Send",
|
||||
"composer.voice.unmuteVoiceMode": "Unmute Voice mode",
|
||||
@@ -29,37 +26,6 @@ const translations: Record<string, string> = {
|
||||
const t = ((key: string) => translations[key] ?? key) as never;
|
||||
|
||||
describe("composer input labels", () => {
|
||||
it("names the long-press action in the submit hint only when one exists", () => {
|
||||
expect(
|
||||
resolveSubmitAccessibilityHint({
|
||||
canPressLoadingButton: false,
|
||||
alternateSendAction: "queue",
|
||||
t,
|
||||
}),
|
||||
).toBe("Long press to queue");
|
||||
expect(
|
||||
resolveSubmitAccessibilityHint({
|
||||
canPressLoadingButton: false,
|
||||
alternateSendAction: "send",
|
||||
t,
|
||||
}),
|
||||
).toBe("Long press to send now");
|
||||
expect(
|
||||
resolveSubmitAccessibilityHint({
|
||||
canPressLoadingButton: false,
|
||||
alternateSendAction: null,
|
||||
t,
|
||||
}),
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
resolveSubmitAccessibilityHint({
|
||||
canPressLoadingButton: true,
|
||||
alternateSendAction: "queue",
|
||||
t,
|
||||
}),
|
||||
).toBeUndefined();
|
||||
});
|
||||
|
||||
it("resolves submit accessibility labels from translations", () => {
|
||||
expect(
|
||||
resolveSubmitAccessibilityLabel({
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { TFunction } from "i18next";
|
||||
import type { SendBehavior } from "@/hooks/use-settings/storage";
|
||||
import type { AlternateSendAction } from "./state";
|
||||
|
||||
export function resolveSubmitAccessibilityLabel(input: {
|
||||
submitButtonAccessibilityLabel: string | undefined;
|
||||
@@ -23,19 +22,6 @@ export function resolveSubmitAccessibilityLabel(input: {
|
||||
return input.t("composer.input.sendMessage");
|
||||
}
|
||||
|
||||
export function resolveSubmitAccessibilityHint(input: {
|
||||
canPressLoadingButton: boolean;
|
||||
alternateSendAction: AlternateSendAction | null;
|
||||
t: TFunction;
|
||||
}): string | undefined {
|
||||
if (input.canPressLoadingButton || !input.alternateSendAction) return undefined;
|
||||
return input.t(
|
||||
input.alternateSendAction === "queue"
|
||||
? "composer.input.longPressToQueue"
|
||||
: "composer.input.longPressToSendNow",
|
||||
);
|
||||
}
|
||||
|
||||
export function resolveVoiceAccessibilityLabel(input: {
|
||||
isRealtimeVoiceForCurrentAgent: boolean;
|
||||
isMuted: boolean;
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
resolveComposerSurfaceText,
|
||||
resolveGlyphRailOffset,
|
||||
resolveRetainedSelection,
|
||||
resolveAlternateSendAction,
|
||||
runAlternateSendAction,
|
||||
runDefaultSendAction,
|
||||
runMessageInputKeyboardAction,
|
||||
@@ -277,47 +276,6 @@ describe("composer send behavior", () => {
|
||||
expect(defaultAction.calls).toEqual(["queue"]);
|
||||
expect(alternateAction.calls).toEqual(["send"]);
|
||||
});
|
||||
|
||||
it("sends with the alternate action while no turn is running", () => {
|
||||
for (const defaultSendBehavior of ["steer", "interrupt", "queue"] as const) {
|
||||
const alternateAction = actions();
|
||||
runAlternateSendAction({
|
||||
defaultSendBehavior,
|
||||
isAgentRunning: false,
|
||||
onQueue: alternateAction.onQueue,
|
||||
handleSendMessage: alternateAction.handleSendMessage,
|
||||
handleQueueMessage: alternateAction.handleQueueMessage,
|
||||
});
|
||||
expect(alternateAction.calls).toEqual(["send"]);
|
||||
}
|
||||
});
|
||||
|
||||
it("offers an alternate action only while a turn runs and the composer can queue", () => {
|
||||
const onQueue = () => undefined;
|
||||
expect(
|
||||
resolveAlternateSendAction({ defaultSendBehavior: "steer", isAgentRunning: true, onQueue }),
|
||||
).toBe("queue");
|
||||
expect(
|
||||
resolveAlternateSendAction({
|
||||
defaultSendBehavior: "interrupt",
|
||||
isAgentRunning: true,
|
||||
onQueue,
|
||||
}),
|
||||
).toBe("queue");
|
||||
expect(
|
||||
resolveAlternateSendAction({ defaultSendBehavior: "queue", isAgentRunning: true, onQueue }),
|
||||
).toBe("send");
|
||||
expect(
|
||||
resolveAlternateSendAction({ defaultSendBehavior: "steer", isAgentRunning: false, onQueue }),
|
||||
).toBeNull();
|
||||
expect(
|
||||
resolveAlternateSendAction({
|
||||
defaultSendBehavior: "queue",
|
||||
isAgentRunning: true,
|
||||
onQueue: undefined,
|
||||
}),
|
||||
).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("stopRealtimeVoice", () => {
|
||||
|
||||
@@ -125,30 +125,14 @@ export function runDefaultSendAction(ctx: SendActionContext): void {
|
||||
ctx.handleSendMessage();
|
||||
}
|
||||
|
||||
export type AlternateSendAction = "queue" | "send";
|
||||
|
||||
/**
|
||||
* What Mod+Enter and a long-press on Send do instead of the default send. Null while
|
||||
* no turn is running, where both fall back to the default send.
|
||||
*/
|
||||
export function resolveAlternateSendAction(
|
||||
ctx: Pick<SendActionContext, "defaultSendBehavior" | "isAgentRunning" | "onQueue">,
|
||||
): AlternateSendAction | null {
|
||||
if (!ctx.isAgentRunning || !ctx.onQueue) return null;
|
||||
return ctx.defaultSendBehavior === "queue" ? "send" : "queue";
|
||||
}
|
||||
|
||||
export function runAlternateSendAction(ctx: SendActionContext): void {
|
||||
const action = resolveAlternateSendAction(ctx);
|
||||
if (action === "queue") {
|
||||
ctx.handleQueueMessage();
|
||||
return;
|
||||
}
|
||||
if (action === "send") {
|
||||
if (ctx.defaultSendBehavior === "queue") {
|
||||
ctx.handleSendMessage();
|
||||
return;
|
||||
}
|
||||
runDefaultSendAction(ctx);
|
||||
if (ctx.isAgentRunning && ctx.onQueue) {
|
||||
ctx.handleQueueMessage();
|
||||
}
|
||||
}
|
||||
|
||||
export function runMessageInputKeyboardAction(
|
||||
|
||||
@@ -162,34 +162,12 @@ describe("composer track panel", () => {
|
||||
);
|
||||
|
||||
openPanel();
|
||||
expect(document.querySelector("button button")).toBeNull();
|
||||
expect(row("row")?.getAttribute("role")).toBe("menuitem");
|
||||
click(row("row-archive") as Element);
|
||||
|
||||
expect(onAction).toHaveBeenCalledTimes(1);
|
||||
expect(onPress).not.toHaveBeenCalled();
|
||||
expect(isPanelOpen()).toBe(true);
|
||||
});
|
||||
|
||||
it.each(["Enter", " "])("selects a track row with %j", (key) => {
|
||||
const select = vi.fn();
|
||||
mount(
|
||||
<ComposerTrackPill testID="pill" segments={SUBAGENT_SEGMENTS} panelTitle="Subagents">
|
||||
<ComposerTrackRow accessibilityLabel="Subagent one" testID="row" onPress={select}>
|
||||
<Text>Subagent one</Text>
|
||||
</ComposerTrackRow>
|
||||
</ComposerTrackPill>,
|
||||
);
|
||||
openPanel();
|
||||
const target = row("row") as HTMLElement;
|
||||
act(() => {
|
||||
target.focus();
|
||||
target.dispatchEvent(new KeyboardEvent("keydown", { key, bubbles: true }));
|
||||
target.dispatchEvent(new KeyboardEvent("keyup", { key, bubbles: true }));
|
||||
});
|
||||
expect(select).toHaveBeenCalledTimes(1);
|
||||
expect(isPanelOpen()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("composer track pill status mark", () => {
|
||||
|
||||
@@ -233,11 +233,6 @@ export function ComposerTrackRow({
|
||||
[closeOnSelect, onPress, selectItem],
|
||||
);
|
||||
|
||||
const itemDataSet = useMemo(
|
||||
() => ({ menuItem: "true", menuDisabled: disabled ? "true" : "false" }),
|
||||
[disabled],
|
||||
);
|
||||
|
||||
const renderRow = useCallback(
|
||||
(active: boolean) => (
|
||||
<View style={active ? styles.rowActive : styles.row}>
|
||||
@@ -258,8 +253,7 @@ export function ComposerTrackRow({
|
||||
return (
|
||||
<View onPointerEnter={handlePointerEnter} onPointerLeave={handlePointerLeave}>
|
||||
<Pressable
|
||||
accessibilityRole="menuitem"
|
||||
dataSet={itemDataSet}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={accessibilityLabel}
|
||||
testID={testID}
|
||||
disabled={disabled}
|
||||
|
||||
@@ -80,7 +80,7 @@ export interface DesktopEditorOpenTargetInput {
|
||||
}
|
||||
|
||||
export interface DesktopEditorBridge {
|
||||
listTargets?: (input?: { workspacePath?: string }) => Promise<DesktopEditorTargetDescriptor[]>;
|
||||
listTargets?: () => Promise<DesktopEditorTargetDescriptor[]>;
|
||||
openTarget?: (input: DesktopEditorOpenTargetInput) => Promise<void>;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { isNative } from "@/constants/platform";
|
||||
import Svg, { Circle } from "react-native-svg";
|
||||
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
@@ -76,9 +75,8 @@ function ChecksRingSvg({
|
||||
height={size}
|
||||
viewBox={`0 0 ${VIEW_BOX} ${VIEW_BOX}`}
|
||||
style={ringStyles.svg}
|
||||
{...(isNative
|
||||
? { accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants" }
|
||||
: { "aria-hidden": true })}
|
||||
accessibilityElementsHidden
|
||||
importantForAccessibility="no-hide-descendants"
|
||||
>
|
||||
<Circle
|
||||
cx={CENTER}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
import { act } from "react";
|
||||
import { createRoot, type Root } from "react-dom/client";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { getHostRuntimeStore } from "@/runtime/host-runtime";
|
||||
import { useDirectoryDemand } from "./use-directory-demand";
|
||||
|
||||
function Probe({ serverId }: { serverId: string | null }) {
|
||||
useDirectoryDemand(serverId);
|
||||
return null;
|
||||
}
|
||||
|
||||
describe("useDirectoryDemand", () => {
|
||||
let root: Root | null = null;
|
||||
afterEach(() => {
|
||||
act(() => root?.unmount());
|
||||
root = null;
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it("demands the host directory while mounted and releases it on unmount", () => {
|
||||
const release = vi.fn();
|
||||
const acquire = vi
|
||||
.spyOn(getHostRuntimeStore(), "acquireDirectoryDemand")
|
||||
.mockImplementation(() => release);
|
||||
const container = document.createElement("div");
|
||||
root = createRoot(container);
|
||||
|
||||
act(() => root?.render(<Probe serverId="srv_a" />));
|
||||
expect(acquire).toHaveBeenCalledTimes(1);
|
||||
expect(acquire).toHaveBeenCalledWith("srv_a");
|
||||
expect(release).not.toHaveBeenCalled();
|
||||
|
||||
act(() => root?.render(<Probe serverId={null} />));
|
||||
expect(release).toHaveBeenCalledTimes(1);
|
||||
expect(acquire).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
@@ -1,16 +0,0 @@
|
||||
import { useEffect } from "react";
|
||||
import { getHostRuntimeStore } from "@/runtime/host-runtime";
|
||||
|
||||
/**
|
||||
* Keeps a host's directory demanded while the caller is mounted.
|
||||
*
|
||||
* The sidebar only demands the directory while its panel is active, so a compact app that
|
||||
* restores straight into a workspace or agent route has nothing else asking the host for
|
||||
* workspaces and agents. Without demand the route waits on hydration that never starts.
|
||||
*/
|
||||
export function useDirectoryDemand(serverId: string | null | undefined): void {
|
||||
useEffect(() => {
|
||||
if (!serverId) return;
|
||||
return getHostRuntimeStore().acquireDirectoryDemand(serverId);
|
||||
}, [serverId]);
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { QueryClient } from "@tanstack/react-query";
|
||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
import { createPreferredEditorPreference, resolvePreferredEditorId } from "./use-preferred-editor";
|
||||
import { resolvePreferredEditorId } from "./use-preferred-editor";
|
||||
|
||||
describe("resolvePreferredEditorId", () => {
|
||||
it("keeps the stored editor when it is still available", () => {
|
||||
@@ -32,78 +30,3 @@ describe("resolvePreferredEditorId", () => {
|
||||
expect(resolvePreferredEditorId([], "cursor")).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("project editor preferences", () => {
|
||||
it("changing one project leaves another project's cached and persisted choice unchanged", async () => {
|
||||
await AsyncStorage.clear();
|
||||
await AsyncStorage.setItem("@paseo:preferred-editor", "vscode");
|
||||
const queryClient = new QueryClient();
|
||||
const projectA = createPreferredEditorPreference({
|
||||
scope: { serverId: "host", projectId: "project-a" },
|
||||
queryClient,
|
||||
storage: AsyncStorage,
|
||||
});
|
||||
const projectB = createPreferredEditorPreference({
|
||||
scope: { serverId: "host", projectId: "project-b" },
|
||||
queryClient,
|
||||
storage: AsyncStorage,
|
||||
});
|
||||
expect(await queryClient.fetchQuery(projectA.queryOptions)).toBe("vscode");
|
||||
expect(await queryClient.fetchQuery(projectB.queryOptions)).toBe("vscode");
|
||||
await projectA.update("cursor");
|
||||
expect(await queryClient.fetchQuery(projectA.queryOptions)).toBe("cursor");
|
||||
expect(await queryClient.fetchQuery(projectB.queryOptions)).toBe("vscode");
|
||||
queryClient.clear();
|
||||
expect(await queryClient.fetchQuery(projectA.queryOptions)).toBe("cursor");
|
||||
expect(await queryClient.fetchQuery(projectB.queryOptions)).toBe("vscode");
|
||||
expect(await AsyncStorage.getItem("@paseo:preferred-editor")).toBe("vscode");
|
||||
queryClient.clear();
|
||||
});
|
||||
it("shares a choice across workspaces of the same project while isolating hosts", async () => {
|
||||
await AsyncStorage.clear();
|
||||
const queryClient = new QueryClient();
|
||||
const root = createPreferredEditorPreference({
|
||||
scope: { serverId: "host-a", projectId: "project" },
|
||||
queryClient,
|
||||
storage: AsyncStorage,
|
||||
});
|
||||
const worktree = createPreferredEditorPreference({
|
||||
scope: { serverId: "host-a", projectId: "project" },
|
||||
queryClient,
|
||||
storage: AsyncStorage,
|
||||
});
|
||||
const otherHost = createPreferredEditorPreference({
|
||||
scope: { serverId: "host-b", projectId: "project" },
|
||||
queryClient,
|
||||
storage: AsyncStorage,
|
||||
});
|
||||
await root.update("zed");
|
||||
expect(await queryClient.fetchQuery(worktree.queryOptions)).toBe("zed");
|
||||
expect(await queryClient.fetchQuery(otherHost.queryOptions)).toBeNull();
|
||||
queryClient.clear();
|
||||
expect(await queryClient.fetchQuery(worktree.queryOptions)).toBe("zed");
|
||||
expect(await queryClient.fetchQuery(otherHost.queryOptions)).toBeNull();
|
||||
queryClient.clear();
|
||||
});
|
||||
|
||||
it("preserves the previous choice when saving fails", async () => {
|
||||
await AsyncStorage.clear();
|
||||
await AsyncStorage.setItem("@paseo:preferred-editor", "vscode");
|
||||
const queryClient = new QueryClient();
|
||||
const preference = createPreferredEditorPreference({
|
||||
scope: { serverId: "host", projectId: "project" },
|
||||
queryClient,
|
||||
storage: {
|
||||
getItem: AsyncStorage.getItem,
|
||||
removeItem: AsyncStorage.removeItem,
|
||||
async setItem() {
|
||||
throw new Error("Storage is full");
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(await queryClient.fetchQuery(preference.queryOptions)).toBe("vscode");
|
||||
await expect(preference.update("cursor")).rejects.toThrow("Storage is full");
|
||||
expect(await queryClient.fetchQuery(preference.queryOptions)).toBe("vscode");
|
||||
queryClient.clear();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,57 +1,16 @@
|
||||
import { useMemo } from "react";
|
||||
import { useCallback } from "react";
|
||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
import { QueryClient, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { z } from "zod";
|
||||
import { readValidatedString, type ValidatedStorage } from "@/storage/validated-storage";
|
||||
import { readValidatedString } from "@/storage/validated-storage";
|
||||
|
||||
type EditorTargetId = string;
|
||||
|
||||
const PREFERRED_EDITOR_STORAGE_KEY = "@paseo:preferred-editor";
|
||||
const PREFERRED_EDITOR_QUERY_KEY = ["preferred-editor"];
|
||||
|
||||
interface EditorPreferenceStorage extends ValidatedStorage {
|
||||
setItem(key: string, value: string): Promise<void>;
|
||||
}
|
||||
|
||||
interface ProjectEditorScope {
|
||||
serverId: string;
|
||||
projectId: string | null;
|
||||
}
|
||||
|
||||
export function createPreferredEditorPreference({
|
||||
scope,
|
||||
queryClient,
|
||||
storage,
|
||||
}: {
|
||||
scope: ProjectEditorScope;
|
||||
queryClient: QueryClient;
|
||||
storage: EditorPreferenceStorage;
|
||||
}) {
|
||||
const queryKey = ["preferred-editor", scope.serverId, scope.projectId];
|
||||
const storageKey = `${PREFERRED_EDITOR_STORAGE_KEY}:${JSON.stringify([scope.serverId, scope.projectId])}`;
|
||||
async function load() {
|
||||
if (scope.projectId === null) return null;
|
||||
const projectEditor = await readValidatedString(storage, storageKey, z.string().trim().min(1));
|
||||
if (projectEditor !== null) return projectEditor;
|
||||
return readValidatedString(storage, PREFERRED_EDITOR_STORAGE_KEY, z.string().trim().min(1));
|
||||
}
|
||||
return {
|
||||
queryOptions: {
|
||||
queryKey,
|
||||
queryFn: load,
|
||||
enabled: scope.projectId !== null,
|
||||
staleTime: Infinity,
|
||||
gcTime: Infinity,
|
||||
},
|
||||
async update(editorId: EditorTargetId | null) {
|
||||
if (scope.projectId === null) return;
|
||||
if (editorId) {
|
||||
await storage.setItem(storageKey, editorId);
|
||||
} else {
|
||||
await storage.removeItem(storageKey);
|
||||
}
|
||||
queryClient.setQueryData(queryKey, await load());
|
||||
},
|
||||
};
|
||||
async function loadPreferredEditor(): Promise<EditorTargetId | null> {
|
||||
return readValidatedString(AsyncStorage, PREFERRED_EDITOR_STORAGE_KEY, z.string().trim().min(1));
|
||||
}
|
||||
|
||||
export function resolvePreferredEditorId(
|
||||
@@ -70,24 +29,30 @@ export function resolvePreferredEditorId(
|
||||
return availableEditorIds[0] ?? null;
|
||||
}
|
||||
|
||||
export function usePreferredEditor(scope: ProjectEditorScope) {
|
||||
export function usePreferredEditor() {
|
||||
const queryClient = useQueryClient();
|
||||
const { serverId, projectId } = scope;
|
||||
const preference = useMemo(
|
||||
() =>
|
||||
createPreferredEditorPreference({
|
||||
scope: { serverId, projectId },
|
||||
queryClient,
|
||||
storage: AsyncStorage,
|
||||
}),
|
||||
[queryClient, serverId, projectId],
|
||||
const { data, isPending } = useQuery({
|
||||
queryKey: PREFERRED_EDITOR_QUERY_KEY,
|
||||
queryFn: loadPreferredEditor,
|
||||
staleTime: Infinity,
|
||||
gcTime: Infinity,
|
||||
});
|
||||
|
||||
const updatePreferredEditor = useCallback(
|
||||
async (editorId: EditorTargetId | null) => {
|
||||
queryClient.setQueryData(PREFERRED_EDITOR_QUERY_KEY, editorId);
|
||||
if (editorId) {
|
||||
await AsyncStorage.setItem(PREFERRED_EDITOR_STORAGE_KEY, editorId);
|
||||
return;
|
||||
}
|
||||
await AsyncStorage.removeItem(PREFERRED_EDITOR_STORAGE_KEY);
|
||||
},
|
||||
[queryClient],
|
||||
);
|
||||
const { data, isPending } = useQuery(preference.queryOptions);
|
||||
|
||||
const isLoading = projectId !== null && isPending;
|
||||
return {
|
||||
preferredEditorId: isLoading ? undefined : (data ?? null),
|
||||
isLoading,
|
||||
updatePreferredEditor: preference.update,
|
||||
preferredEditorId: isPending ? undefined : (data ?? null),
|
||||
isLoading: isPending,
|
||||
updatePreferredEditor,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -133,8 +133,6 @@ export const ar: TranslationResources = {
|
||||
sendAndInterrupt: "إرسال ومقاطعة",
|
||||
sendAndSteer: "إرسال وتوجيه",
|
||||
sendMessage: "أرسل رسالة",
|
||||
longPressToQueue: "اضغط مطولًا لإضافتها إلى الطابور",
|
||||
longPressToSendNow: "اضغط مطولًا للإرسال الآن",
|
||||
queue: "طابور",
|
||||
send: "يرسل",
|
||||
},
|
||||
@@ -2018,10 +2016,10 @@ export const ar: TranslationResources = {
|
||||
output: "الإخراج",
|
||||
},
|
||||
turnSummary: {
|
||||
details: "عرض تفاصيل الجولة",
|
||||
sentBy: "أرسلها {{name}}",
|
||||
showMore: "عرض المزيد",
|
||||
showLess: "عرض أقل",
|
||||
messages: {
|
||||
one: "كتب {{count}} رسالة",
|
||||
other: "كتب {{count}} رسائل",
|
||||
},
|
||||
},
|
||||
toolCallGroup: {
|
||||
editedFiles: {
|
||||
@@ -2260,7 +2258,6 @@ export const ar: TranslationResources = {
|
||||
connections: "اتصالات",
|
||||
agents: "Agents",
|
||||
metadata: "البيانات الوصفية",
|
||||
voice: "الصوت",
|
||||
workspaces: "Workspaces",
|
||||
providers: "مقدمي الخدمات",
|
||||
usage: "الاستخدام",
|
||||
@@ -2283,69 +2280,6 @@ export const ar: TranslationResources = {
|
||||
docs: "الوثائق",
|
||||
saveError: "تعذر تحديث إنشاء البيانات الوصفية",
|
||||
},
|
||||
voice: {
|
||||
offline: "اتصل بهذا المضيف لضبط الصوت.",
|
||||
updateHost: "حدّث المضيف لضبط الصوت.",
|
||||
saveError: "تعذّر تحديث إعدادات الصوت",
|
||||
provider: "المزوّد",
|
||||
providers: {
|
||||
local: "محلي",
|
||||
openai: "OpenAI",
|
||||
},
|
||||
voice: "الصوت",
|
||||
save: "حفظ",
|
||||
retry: "إعادة المحاولة",
|
||||
cancel: "إلغاء",
|
||||
model: "النموذج",
|
||||
language: "اللغة",
|
||||
languagePlaceholder: "اكتشاف تلقائي",
|
||||
setBy: "محدد بواسطة {{name}}",
|
||||
unknownProvider: "حدّث التطبيق لإعداد {{provider}}",
|
||||
sites: {
|
||||
dictationStt: "تحويل الكلام إلى نص",
|
||||
voiceModeStt: "الاستماع",
|
||||
voiceModeTts: "التحدث",
|
||||
},
|
||||
dictation: {
|
||||
title: "الإملاء",
|
||||
enabled: "الإملاء",
|
||||
enabledHint: "تحدّث في مربع الرسالة بدلًا من الكتابة",
|
||||
},
|
||||
voiceMode: {
|
||||
title: "وضع الصوت",
|
||||
info: "يحوّل وضع الصوت كلامك إلى نص ويقرأ ردود الوكيل بصوت عالٍ.",
|
||||
enabled: "وضع الصوت",
|
||||
enabledHint: "تحدّث مع وكلائك دون استخدام يديك",
|
||||
},
|
||||
openai: {
|
||||
apiKey: "مفتاح API",
|
||||
apiKeyHint: "يُحفظ على المضيف ولا يُعرض مرة أخرى.",
|
||||
keyPlaceholder: "sk-...",
|
||||
savedKeyPlaceholder: "محفوظ",
|
||||
missingKey: "مفتاح API مفقود",
|
||||
baseUrl: "عنوان URL الأساسي",
|
||||
baseUrlHint: "للخوادم المتوافقة مع OpenAI. اتركه فارغًا لاستخدام OpenAI.",
|
||||
},
|
||||
models: {
|
||||
loading: "جارٍ تحميل النماذج...",
|
||||
loadError: "تعذّر تحميل النماذج المحلية",
|
||||
none: "لا توجد نماذج متاحة",
|
||||
downloaded: "منزّل",
|
||||
inUse: "قيد الاستخدام",
|
||||
recommended: "موصى به",
|
||||
download: "تنزيل",
|
||||
downloadAction: "تنزيل {{label}}",
|
||||
downloading: "جارٍ التنزيل...",
|
||||
downloadingPercent: "جارٍ التنزيل {{percent}}%",
|
||||
extracting: "جارٍ الاستخراج...",
|
||||
delete: "حذف",
|
||||
deleteAction: "حذف {{label}}",
|
||||
deleteTitle: "حذف {{label}}؟",
|
||||
deleteMessage: "سيؤدي هذا إلى تحرير {{size}}. يمكنك تنزيله مرة أخرى لاحقًا.",
|
||||
languages: "لغات {{label}}",
|
||||
moreLanguages: "{{languages}} و{{count}} أخرى",
|
||||
},
|
||||
},
|
||||
general: {
|
||||
title: "عام",
|
||||
sending: "الإرسال",
|
||||
|
||||
@@ -129,8 +129,6 @@ export const en = {
|
||||
sendAndInterrupt: "Send and interrupt",
|
||||
sendAndSteer: "Send and steer",
|
||||
sendMessage: "Send message",
|
||||
longPressToQueue: "Long press to queue",
|
||||
longPressToSendNow: "Long press to send now",
|
||||
queue: "Queue",
|
||||
send: "Send",
|
||||
},
|
||||
@@ -2043,10 +2041,10 @@ export const en = {
|
||||
output: "Output",
|
||||
},
|
||||
turnSummary: {
|
||||
details: "View turn details",
|
||||
sentBy: "Sent by {{name}}",
|
||||
showMore: "Show more",
|
||||
showLess: "Show less",
|
||||
messages: {
|
||||
one: "wrote {{count}} message",
|
||||
other: "wrote {{count}} messages",
|
||||
},
|
||||
},
|
||||
toolCallGroup: {
|
||||
editedFiles: {
|
||||
@@ -2287,7 +2285,6 @@ export const en = {
|
||||
connections: "Connections",
|
||||
agents: "Agents",
|
||||
metadata: "Metadata",
|
||||
voice: "Voice",
|
||||
workspaces: "Workspaces",
|
||||
providers: "Providers",
|
||||
usage: "Usage",
|
||||
@@ -2372,69 +2369,6 @@ export const en = {
|
||||
docs: "Docs",
|
||||
saveError: "Unable to update metadata generation",
|
||||
},
|
||||
voice: {
|
||||
offline: "Connect to this host to configure voice.",
|
||||
updateHost: "Update the host to configure voice.",
|
||||
saveError: "Unable to update voice settings",
|
||||
provider: "Provider",
|
||||
providers: {
|
||||
local: "Local",
|
||||
openai: "OpenAI",
|
||||
},
|
||||
voice: "Voice",
|
||||
save: "Save",
|
||||
retry: "Retry",
|
||||
cancel: "Cancel",
|
||||
model: "Model",
|
||||
language: "Language",
|
||||
languagePlaceholder: "Auto-detect",
|
||||
setBy: "Set by {{name}}",
|
||||
unknownProvider: "Update the app to configure {{provider}}",
|
||||
sites: {
|
||||
dictationStt: "Speech-to-text",
|
||||
voiceModeStt: "Listening",
|
||||
voiceModeTts: "Speaking",
|
||||
},
|
||||
dictation: {
|
||||
title: "Dictation",
|
||||
enabled: "Dictation",
|
||||
enabledHint: "Speak into the message box instead of typing",
|
||||
},
|
||||
voiceMode: {
|
||||
title: "Voice mode",
|
||||
info: "Voice mode transcribes what you say and reads agent replies aloud.",
|
||||
enabled: "Voice mode",
|
||||
enabledHint: "Talk with your agents hands-free",
|
||||
},
|
||||
openai: {
|
||||
apiKey: "API key",
|
||||
apiKeyHint: "Saved on the host and never shown again.",
|
||||
keyPlaceholder: "sk-...",
|
||||
savedKeyPlaceholder: "Saved",
|
||||
missingKey: "API key missing",
|
||||
baseUrl: "Base URL",
|
||||
baseUrlHint: "For OpenAI-compatible servers. Leave empty to use OpenAI.",
|
||||
},
|
||||
models: {
|
||||
loading: "Loading models...",
|
||||
loadError: "Couldn't load local models",
|
||||
none: "No models available",
|
||||
downloaded: "Downloaded",
|
||||
inUse: "In use",
|
||||
recommended: "Recommended",
|
||||
download: "Download",
|
||||
downloadAction: "Download {{label}}",
|
||||
downloading: "Downloading...",
|
||||
downloadingPercent: "Downloading {{percent}}%",
|
||||
extracting: "Extracting...",
|
||||
delete: "Delete",
|
||||
deleteAction: "Delete {{label}}",
|
||||
deleteTitle: "Delete {{label}}?",
|
||||
deleteMessage: "This frees {{size}}. You can download it again later.",
|
||||
languages: "{{label}} languages",
|
||||
moreLanguages: "{{languages}} and {{count}} more",
|
||||
},
|
||||
},
|
||||
general: {
|
||||
title: "General",
|
||||
sending: "Sending",
|
||||
|
||||
@@ -134,8 +134,6 @@ export const es: TranslationResources = {
|
||||
sendAndInterrupt: "Enviar e interrumpir",
|
||||
sendAndSteer: "Enviar y orientar",
|
||||
sendMessage: "enviar mensaje",
|
||||
longPressToQueue: "Mantén pulsado para poner en cola",
|
||||
longPressToSendNow: "Mantén pulsado para enviar ahora",
|
||||
queue: "Cola",
|
||||
send: "Enviar",
|
||||
},
|
||||
@@ -2066,10 +2064,10 @@ export const es: TranslationResources = {
|
||||
output: "Producción",
|
||||
},
|
||||
turnSummary: {
|
||||
details: "Ver detalles del turno",
|
||||
sentBy: "Enviado por {{name}}",
|
||||
showMore: "Mostrar más",
|
||||
showLess: "Mostrar menos",
|
||||
messages: {
|
||||
one: "escribió {{count}} mensaje",
|
||||
other: "escribió {{count}} mensajes",
|
||||
},
|
||||
},
|
||||
toolCallGroup: {
|
||||
editedFiles: {
|
||||
@@ -2272,7 +2270,6 @@ export const es: TranslationResources = {
|
||||
connections: "Conexiones",
|
||||
agents: "Agents",
|
||||
metadata: "Metadatos",
|
||||
voice: "Voz",
|
||||
workspaces: "Workspaces",
|
||||
providers: "Proveedores",
|
||||
usage: "Uso",
|
||||
@@ -2295,69 +2292,6 @@ export const es: TranslationResources = {
|
||||
docs: "Documentación",
|
||||
saveError: "No se pudo actualizar la generación de metadatos",
|
||||
},
|
||||
voice: {
|
||||
offline: "Conéctate a este host para configurar la voz.",
|
||||
updateHost: "Actualiza el host para configurar la voz.",
|
||||
saveError: "No se pudo actualizar la configuración de voz",
|
||||
provider: "Proveedor",
|
||||
providers: {
|
||||
local: "Local",
|
||||
openai: "OpenAI",
|
||||
},
|
||||
voice: "Voz",
|
||||
save: "Guardar",
|
||||
retry: "Reintentar",
|
||||
cancel: "Cancelar",
|
||||
model: "Modelo",
|
||||
language: "Idioma",
|
||||
languagePlaceholder: "Detección automática",
|
||||
setBy: "Definido por {{name}}",
|
||||
unknownProvider: "Actualiza la app para configurar {{provider}}",
|
||||
sites: {
|
||||
dictationStt: "Voz a texto",
|
||||
voiceModeStt: "Escucha",
|
||||
voiceModeTts: "Habla",
|
||||
},
|
||||
dictation: {
|
||||
title: "Dictado",
|
||||
enabled: "Dictado",
|
||||
enabledHint: "Habla en el cuadro de mensaje en lugar de escribir",
|
||||
},
|
||||
voiceMode: {
|
||||
title: "Modo de voz",
|
||||
info: "El modo de voz transcribe lo que dices y lee en voz alta las respuestas del agente.",
|
||||
enabled: "Modo de voz",
|
||||
enabledHint: "Habla con tus agentes sin usar las manos",
|
||||
},
|
||||
openai: {
|
||||
apiKey: "Clave de API",
|
||||
apiKeyHint: "Se guarda en el host y no se vuelve a mostrar.",
|
||||
keyPlaceholder: "sk-...",
|
||||
savedKeyPlaceholder: "Guardada",
|
||||
missingKey: "Falta la clave de API",
|
||||
baseUrl: "URL base",
|
||||
baseUrlHint: "Para servidores compatibles con OpenAI. Déjala vacía para usar OpenAI.",
|
||||
},
|
||||
models: {
|
||||
loading: "Cargando modelos...",
|
||||
loadError: "No se pudieron cargar los modelos locales",
|
||||
none: "No hay modelos disponibles",
|
||||
downloaded: "Descargado",
|
||||
inUse: "En uso",
|
||||
recommended: "Recomendado",
|
||||
download: "Descargar",
|
||||
downloadAction: "Descargar {{label}}",
|
||||
downloading: "Descargando...",
|
||||
downloadingPercent: "Descargando {{percent}} %",
|
||||
extracting: "Extrayendo...",
|
||||
delete: "Eliminar",
|
||||
deleteAction: "Eliminar {{label}}",
|
||||
deleteTitle: "¿Eliminar {{label}}?",
|
||||
deleteMessage: "Esto libera {{size}}. Puedes volver a descargarlo más tarde.",
|
||||
languages: "Idiomas de {{label}}",
|
||||
moreLanguages: "{{languages}} y {{count}} más",
|
||||
},
|
||||
},
|
||||
general: {
|
||||
title: "General",
|
||||
sending: "Envío",
|
||||
|
||||
@@ -135,8 +135,6 @@ export const fr: TranslationResources = {
|
||||
sendAndInterrupt: "Envoyer et interrompre",
|
||||
sendAndSteer: "Envoyer et réorienter",
|
||||
sendMessage: "Envoyer le message",
|
||||
longPressToQueue: "Appui long pour mettre en file d’attente",
|
||||
longPressToSendNow: "Appui long pour envoyer maintenant",
|
||||
queue: "Mettre en file d’attente",
|
||||
send: "Envoyer",
|
||||
},
|
||||
@@ -2065,10 +2063,10 @@ export const fr: TranslationResources = {
|
||||
output: "Sortie",
|
||||
},
|
||||
turnSummary: {
|
||||
details: "Voir les détails du tour",
|
||||
sentBy: "Envoyé par {{name}}",
|
||||
showMore: "Afficher plus",
|
||||
showLess: "Afficher moins",
|
||||
messages: {
|
||||
one: "{{count}} message écrit",
|
||||
other: "{{count}} messages écrits",
|
||||
},
|
||||
},
|
||||
toolCallGroup: {
|
||||
editedFiles: {
|
||||
@@ -2272,7 +2270,6 @@ export const fr: TranslationResources = {
|
||||
connections: "Connexions",
|
||||
agents: "Agents",
|
||||
metadata: "Métadonnées",
|
||||
voice: "Voix",
|
||||
workspaces: "Espaces de travail",
|
||||
providers: "Fournisseurs",
|
||||
usage: "Utilisation",
|
||||
@@ -2295,69 +2292,6 @@ export const fr: TranslationResources = {
|
||||
docs: "Documentation",
|
||||
saveError: "Impossible de mettre à jour la génération de métadonnées",
|
||||
},
|
||||
voice: {
|
||||
offline: "Connectez-vous à cet hôte pour configurer la voix.",
|
||||
updateHost: "Mettez à jour l'hôte pour configurer la voix.",
|
||||
saveError: "Impossible de mettre à jour les réglages vocaux",
|
||||
provider: "Fournisseur",
|
||||
providers: {
|
||||
local: "Local",
|
||||
openai: "OpenAI",
|
||||
},
|
||||
voice: "Voix",
|
||||
save: "Enregistrer",
|
||||
retry: "Réessayer",
|
||||
cancel: "Annuler",
|
||||
model: "Modèle",
|
||||
language: "Langue",
|
||||
languagePlaceholder: "Détection automatique",
|
||||
setBy: "Défini par {{name}}",
|
||||
unknownProvider: "Mettez à jour l'app pour configurer {{provider}}",
|
||||
sites: {
|
||||
dictationStt: "Transcription",
|
||||
voiceModeStt: "Écoute",
|
||||
voiceModeTts: "Parole",
|
||||
},
|
||||
dictation: {
|
||||
title: "Dictée",
|
||||
enabled: "Dictée",
|
||||
enabledHint: "Parlez dans la zone de message au lieu de taper",
|
||||
},
|
||||
voiceMode: {
|
||||
title: "Mode vocal",
|
||||
info: "Le mode vocal transcrit ce que vous dites et lit à voix haute les réponses de l'agent.",
|
||||
enabled: "Mode vocal",
|
||||
enabledHint: "Parlez à vos agents sans les mains",
|
||||
},
|
||||
openai: {
|
||||
apiKey: "Clé d'API",
|
||||
apiKeyHint: "Enregistrée sur l'hôte, jamais réaffichée.",
|
||||
keyPlaceholder: "sk-...",
|
||||
savedKeyPlaceholder: "Enregistrée",
|
||||
missingKey: "Clé d'API manquante",
|
||||
baseUrl: "URL de base",
|
||||
baseUrlHint: "Pour les serveurs compatibles OpenAI. Laissez vide pour utiliser OpenAI.",
|
||||
},
|
||||
models: {
|
||||
loading: "Chargement des modèles...",
|
||||
loadError: "Impossible de charger les modèles locaux",
|
||||
none: "Aucun modèle disponible",
|
||||
downloaded: "Téléchargé",
|
||||
inUse: "Utilisé",
|
||||
recommended: "Recommandé",
|
||||
download: "Télécharger",
|
||||
downloadAction: "Télécharger {{label}}",
|
||||
downloading: "Téléchargement...",
|
||||
downloadingPercent: "Téléchargement {{percent}} %",
|
||||
extracting: "Extraction...",
|
||||
delete: "Supprimer",
|
||||
deleteAction: "Supprimer {{label}}",
|
||||
deleteTitle: "Supprimer {{label}} ?",
|
||||
deleteMessage: "Cela libère {{size}}. Vous pourrez le retélécharger plus tard.",
|
||||
languages: "Langues de {{label}}",
|
||||
moreLanguages: "{{languages}} et {{count}} autres",
|
||||
},
|
||||
},
|
||||
general: {
|
||||
title: "Général",
|
||||
sending: "Envoi",
|
||||
|
||||
@@ -134,8 +134,6 @@ export const ja: TranslationResources = {
|
||||
sendAndInterrupt: "送信して中断",
|
||||
sendAndSteer: "送信して指示を追加",
|
||||
sendMessage: "メッセージを送信",
|
||||
longPressToQueue: "長押しでキューに追加",
|
||||
longPressToSendNow: "長押しで今すぐ送信",
|
||||
queue: "キュー",
|
||||
send: "送信",
|
||||
},
|
||||
@@ -2038,10 +2036,10 @@ export const ja: TranslationResources = {
|
||||
output: "出力",
|
||||
},
|
||||
turnSummary: {
|
||||
details: "ターンの詳細を表示",
|
||||
sentBy: "{{name}} から送信",
|
||||
showMore: "もっと見る",
|
||||
showLess: "折りたたむ",
|
||||
messages: {
|
||||
one: "{{count}}件のメッセージを送信",
|
||||
other: "{{count}}件のメッセージを送信",
|
||||
},
|
||||
},
|
||||
toolCallGroup: {
|
||||
editedFiles: {
|
||||
@@ -2245,7 +2243,6 @@ export const ja: TranslationResources = {
|
||||
connections: "接続",
|
||||
agents: "エージェント",
|
||||
metadata: "メタデータ",
|
||||
voice: "音声",
|
||||
workspaces: "ワークスペース",
|
||||
providers: "プロバイダー",
|
||||
usage: "使用状況",
|
||||
@@ -2268,69 +2265,6 @@ export const ja: TranslationResources = {
|
||||
docs: "ドキュメント",
|
||||
saveError: "メタデータ生成を更新できません",
|
||||
},
|
||||
voice: {
|
||||
offline: "音声を設定するには、このホストに接続してください。",
|
||||
updateHost: "音声を設定するには、ホストを更新してください。",
|
||||
saveError: "音声設定を更新できませんでした",
|
||||
provider: "プロバイダー",
|
||||
providers: {
|
||||
local: "ローカル",
|
||||
openai: "OpenAI",
|
||||
},
|
||||
voice: "ボイス",
|
||||
save: "保存",
|
||||
retry: "再試行",
|
||||
cancel: "キャンセル",
|
||||
model: "モデル",
|
||||
language: "言語",
|
||||
languagePlaceholder: "自動検出",
|
||||
setBy: "{{name}} で設定",
|
||||
unknownProvider: "{{provider}} を設定するにはアプリを更新してください",
|
||||
sites: {
|
||||
dictationStt: "音声入力",
|
||||
voiceModeStt: "聞き取り",
|
||||
voiceModeTts: "読み上げ",
|
||||
},
|
||||
dictation: {
|
||||
title: "音声入力",
|
||||
enabled: "音声入力",
|
||||
enabledHint: "入力する代わりにメッセージ欄に話しかけます",
|
||||
},
|
||||
voiceMode: {
|
||||
title: "ボイスモード",
|
||||
info: "ボイスモードは話した内容を文字起こしし、エージェントの返答を読み上げます。",
|
||||
enabled: "ボイスモード",
|
||||
enabledHint: "ハンズフリーでエージェントと会話します",
|
||||
},
|
||||
openai: {
|
||||
apiKey: "API キー",
|
||||
apiKeyHint: "ホストに保存され、再表示されません。",
|
||||
keyPlaceholder: "sk-...",
|
||||
savedKeyPlaceholder: "保存済み",
|
||||
missingKey: "API キーがありません",
|
||||
baseUrl: "ベース URL",
|
||||
baseUrlHint: "OpenAI 互換サーバー用です。OpenAI を使う場合は空欄のままにします。",
|
||||
},
|
||||
models: {
|
||||
loading: "モデルを読み込み中...",
|
||||
loadError: "ローカルモデルを読み込めませんでした",
|
||||
none: "利用できるモデルがありません",
|
||||
downloaded: "ダウンロード済み",
|
||||
inUse: "使用中",
|
||||
recommended: "おすすめ",
|
||||
download: "ダウンロード",
|
||||
downloadAction: "{{label}} をダウンロード",
|
||||
downloading: "ダウンロード中...",
|
||||
downloadingPercent: "ダウンロード中 {{percent}}%",
|
||||
extracting: "展開中...",
|
||||
delete: "削除",
|
||||
deleteAction: "{{label}} を削除",
|
||||
deleteTitle: "{{label}} を削除しますか?",
|
||||
deleteMessage: "{{size}} が解放されます。後で再ダウンロードできます。",
|
||||
languages: "{{label}} の対応言語",
|
||||
moreLanguages: "{{languages}} ほか {{count}} 言語",
|
||||
},
|
||||
},
|
||||
general: {
|
||||
title: "一般",
|
||||
sending: "送信",
|
||||
|
||||
@@ -133,8 +133,6 @@ export const ko: TranslationResources = {
|
||||
sendAndInterrupt: "보내고 중단",
|
||||
sendAndSteer: "보내고 지시 추가",
|
||||
sendMessage: "메시지 보내기",
|
||||
longPressToQueue: "길게 눌러 대기열에 추가",
|
||||
longPressToSendNow: "길게 눌러 지금 보내기",
|
||||
queue: "대기열",
|
||||
send: "보내기",
|
||||
},
|
||||
@@ -2028,10 +2026,10 @@ export const ko: TranslationResources = {
|
||||
output: "출력",
|
||||
},
|
||||
turnSummary: {
|
||||
details: "턴 세부 정보 보기",
|
||||
sentBy: "{{name}}이(가) 보냄",
|
||||
showMore: "더 보기",
|
||||
showLess: "접기",
|
||||
messages: {
|
||||
one: "{{count}} 메시지를 작성했습니다.",
|
||||
other: "{{count}} 메시지를 작성했습니다.",
|
||||
},
|
||||
},
|
||||
toolCallGroup: {
|
||||
editedFiles: {
|
||||
@@ -2234,7 +2232,6 @@ export const ko: TranslationResources = {
|
||||
connections: "연결",
|
||||
agents: "에이전트",
|
||||
metadata: "메타데이터",
|
||||
voice: "음성",
|
||||
workspaces: "워크스페이스",
|
||||
providers: "프로바이더",
|
||||
usage: "사용량",
|
||||
@@ -2257,69 +2254,6 @@ export const ko: TranslationResources = {
|
||||
docs: "문서",
|
||||
saveError: "메타데이터 생성을 업데이트할 수 없습니다",
|
||||
},
|
||||
voice: {
|
||||
offline: "음성을 설정하려면 이 호스트에 연결하세요.",
|
||||
updateHost: "음성을 설정하려면 호스트를 업데이트하세요.",
|
||||
saveError: "음성 설정을 업데이트할 수 없습니다",
|
||||
provider: "제공자",
|
||||
providers: {
|
||||
local: "로컬",
|
||||
openai: "OpenAI",
|
||||
},
|
||||
voice: "목소리",
|
||||
save: "저장",
|
||||
retry: "다시 시도",
|
||||
cancel: "취소",
|
||||
model: "모델",
|
||||
language: "언어",
|
||||
languagePlaceholder: "자동 감지",
|
||||
setBy: "{{name}}에서 설정됨",
|
||||
unknownProvider: "{{provider}}을(를) 설정하려면 앱을 업데이트하세요",
|
||||
sites: {
|
||||
dictationStt: "음성 텍스트 변환",
|
||||
voiceModeStt: "듣기",
|
||||
voiceModeTts: "말하기",
|
||||
},
|
||||
dictation: {
|
||||
title: "받아쓰기",
|
||||
enabled: "받아쓰기",
|
||||
enabledHint: "입력하는 대신 메시지 상자에 말하세요",
|
||||
},
|
||||
voiceMode: {
|
||||
title: "음성 모드",
|
||||
info: "음성 모드는 말한 내용을 텍스트로 옮기고 에이전트의 답변을 소리 내어 읽어 줍니다.",
|
||||
enabled: "음성 모드",
|
||||
enabledHint: "손을 쓰지 않고 에이전트와 대화하세요",
|
||||
},
|
||||
openai: {
|
||||
apiKey: "API 키",
|
||||
apiKeyHint: "호스트에 저장되며 다시 표시되지 않습니다.",
|
||||
keyPlaceholder: "sk-...",
|
||||
savedKeyPlaceholder: "저장됨",
|
||||
missingKey: "API 키 없음",
|
||||
baseUrl: "기본 URL",
|
||||
baseUrlHint: "OpenAI 호환 서버용입니다. OpenAI를 사용하려면 비워 두세요.",
|
||||
},
|
||||
models: {
|
||||
loading: "모델을 불러오는 중...",
|
||||
loadError: "로컬 모델을 불러올 수 없습니다",
|
||||
none: "사용 가능한 모델 없음",
|
||||
downloaded: "다운로드됨",
|
||||
inUse: "사용 중",
|
||||
recommended: "추천",
|
||||
download: "다운로드",
|
||||
downloadAction: "{{label}} 다운로드",
|
||||
downloading: "다운로드 중...",
|
||||
downloadingPercent: "다운로드 중 {{percent}}%",
|
||||
extracting: "압축 해제 중...",
|
||||
delete: "삭제",
|
||||
deleteAction: "{{label}} 삭제",
|
||||
deleteTitle: "{{label}}을(를) 삭제할까요?",
|
||||
deleteMessage: "{{size}}가 확보됩니다. 나중에 다시 다운로드할 수 있습니다.",
|
||||
languages: "{{label}} 지원 언어",
|
||||
moreLanguages: "{{languages}} 외 {{count}}개",
|
||||
},
|
||||
},
|
||||
general: {
|
||||
title: "일반",
|
||||
sending: "전송",
|
||||
|
||||
@@ -134,8 +134,6 @@ export const ptBR: TranslationResources = {
|
||||
sendAndInterrupt: "Enviar e interromper",
|
||||
sendAndSteer: "Enviar e orientar",
|
||||
sendMessage: "Enviar mensagem",
|
||||
longPressToQueue: "Mantenha pressionado para enfileirar",
|
||||
longPressToSendNow: "Mantenha pressionado para enviar agora",
|
||||
queue: "Fila",
|
||||
send: "Enviar",
|
||||
},
|
||||
@@ -2051,10 +2049,10 @@ export const ptBR: TranslationResources = {
|
||||
output: "Saída",
|
||||
},
|
||||
turnSummary: {
|
||||
details: "Ver detalhes do turno",
|
||||
sentBy: "Enviado por {{name}}",
|
||||
showMore: "Mostrar mais",
|
||||
showLess: "Mostrar menos",
|
||||
messages: {
|
||||
one: "escreveu {{count}} mensagem",
|
||||
other: "escreveu {{count}} mensagens",
|
||||
},
|
||||
},
|
||||
toolCallGroup: {
|
||||
editedFiles: {
|
||||
@@ -2257,7 +2255,6 @@ export const ptBR: TranslationResources = {
|
||||
connections: "Conexões",
|
||||
agents: "Agentes",
|
||||
metadata: "Metadados",
|
||||
voice: "Voz",
|
||||
workspaces: "Workspaces",
|
||||
providers: "Provedores",
|
||||
usage: "Uso",
|
||||
@@ -2280,69 +2277,6 @@ export const ptBR: TranslationResources = {
|
||||
docs: "Documentação",
|
||||
saveError: "Não foi possível atualizar a geração de metadados",
|
||||
},
|
||||
voice: {
|
||||
offline: "Conecte-se a este host para configurar a voz.",
|
||||
updateHost: "Atualize o host para configurar a voz.",
|
||||
saveError: "Não foi possível atualizar as configurações de voz",
|
||||
provider: "Provedor",
|
||||
providers: {
|
||||
local: "Local",
|
||||
openai: "OpenAI",
|
||||
},
|
||||
voice: "Voz",
|
||||
save: "Salvar",
|
||||
retry: "Tentar novamente",
|
||||
cancel: "Cancelar",
|
||||
model: "Modelo",
|
||||
language: "Idioma",
|
||||
languagePlaceholder: "Detecção automática",
|
||||
setBy: "Definido por {{name}}",
|
||||
unknownProvider: "Atualize o app para configurar {{provider}}",
|
||||
sites: {
|
||||
dictationStt: "Fala para texto",
|
||||
voiceModeStt: "Escuta",
|
||||
voiceModeTts: "Fala",
|
||||
},
|
||||
dictation: {
|
||||
title: "Ditado",
|
||||
enabled: "Ditado",
|
||||
enabledHint: "Fale na caixa de mensagem em vez de digitar",
|
||||
},
|
||||
voiceMode: {
|
||||
title: "Modo de voz",
|
||||
info: "O modo de voz transcreve o que você diz e lê em voz alta as respostas do agente.",
|
||||
enabled: "Modo de voz",
|
||||
enabledHint: "Converse com seus agentes sem usar as mãos",
|
||||
},
|
||||
openai: {
|
||||
apiKey: "Chave de API",
|
||||
apiKeyHint: "Salva no host e nunca mostrada novamente.",
|
||||
keyPlaceholder: "sk-...",
|
||||
savedKeyPlaceholder: "Salva",
|
||||
missingKey: "Chave de API ausente",
|
||||
baseUrl: "URL base",
|
||||
baseUrlHint: "Para servidores compatíveis com a OpenAI. Deixe vazio para usar a OpenAI.",
|
||||
},
|
||||
models: {
|
||||
loading: "Carregando modelos...",
|
||||
loadError: "Não foi possível carregar os modelos locais",
|
||||
none: "Nenhum modelo disponível",
|
||||
downloaded: "Baixado",
|
||||
inUse: "Em uso",
|
||||
recommended: "Recomendado",
|
||||
download: "Baixar",
|
||||
downloadAction: "Baixar {{label}}",
|
||||
downloading: "Baixando...",
|
||||
downloadingPercent: "Baixando {{percent}}%",
|
||||
extracting: "Extraindo...",
|
||||
delete: "Excluir",
|
||||
deleteAction: "Excluir {{label}}",
|
||||
deleteTitle: "Excluir {{label}}?",
|
||||
deleteMessage: "Isso libera {{size}}. Você pode baixá-lo de novo depois.",
|
||||
languages: "Idiomas do {{label}}",
|
||||
moreLanguages: "{{languages}} e mais {{count}}",
|
||||
},
|
||||
},
|
||||
general: {
|
||||
title: "Geral",
|
||||
sending: "Envio",
|
||||
|
||||
@@ -134,8 +134,6 @@ export const ru: TranslationResources = {
|
||||
sendAndInterrupt: "Отправить и прервать",
|
||||
sendAndSteer: "Отправить и направить",
|
||||
sendMessage: "Отправить сообщение",
|
||||
longPressToQueue: "Удерживайте, чтобы поставить в очередь",
|
||||
longPressToSendNow: "Удерживайте, чтобы отправить сейчас",
|
||||
queue: "Очередь",
|
||||
send: "Отправить",
|
||||
},
|
||||
@@ -2051,10 +2049,10 @@ export const ru: TranslationResources = {
|
||||
output: "Выходные данные",
|
||||
},
|
||||
turnSummary: {
|
||||
details: "Показать подробности хода",
|
||||
sentBy: "Отправлено агентом {{name}}",
|
||||
showMore: "Показать больше",
|
||||
showLess: "Свернуть",
|
||||
messages: {
|
||||
one: "написано {{count}} сообщение",
|
||||
other: "написаны сообщения ({{count}})",
|
||||
},
|
||||
},
|
||||
toolCallGroup: {
|
||||
editedFiles: {
|
||||
@@ -2257,7 +2255,6 @@ export const ru: TranslationResources = {
|
||||
connections: "Подключения",
|
||||
agents: "Агенты",
|
||||
metadata: "Метаданные",
|
||||
voice: "Голос",
|
||||
workspaces: "Рабочие пространства",
|
||||
providers: "Провайдеры",
|
||||
usage: "Использование",
|
||||
@@ -2281,70 +2278,6 @@ export const ru: TranslationResources = {
|
||||
docs: "Документация",
|
||||
saveError: "Не удалось обновить настройки генерации метаданных",
|
||||
},
|
||||
voice: {
|
||||
offline: "Подключитесь к этому хосту, чтобы настроить голос.",
|
||||
updateHost: "Обновите хост, чтобы настроить голос.",
|
||||
saveError: "Не удалось обновить голосовые настройки",
|
||||
provider: "Провайдер",
|
||||
providers: {
|
||||
local: "Локально",
|
||||
openai: "OpenAI",
|
||||
},
|
||||
voice: "Голос",
|
||||
save: "Сохранить",
|
||||
retry: "Повторить",
|
||||
cancel: "Отмена",
|
||||
model: "Модель",
|
||||
language: "Язык",
|
||||
languagePlaceholder: "Автоопределение",
|
||||
setBy: "Задано через {{name}}",
|
||||
unknownProvider: "Обновите приложение, чтобы настроить {{provider}}",
|
||||
sites: {
|
||||
dictationStt: "Распознавание речи",
|
||||
voiceModeStt: "Прослушивание",
|
||||
voiceModeTts: "Озвучивание",
|
||||
},
|
||||
dictation: {
|
||||
title: "Диктовка",
|
||||
enabled: "Диктовка",
|
||||
enabledHint: "Говорите в поле сообщения вместо набора текста",
|
||||
},
|
||||
voiceMode: {
|
||||
title: "Голосовой режим",
|
||||
info: "Голосовой режим расшифровывает вашу речь и зачитывает ответы агента вслух.",
|
||||
enabled: "Голосовой режим",
|
||||
enabledHint: "Общайтесь с агентами без рук",
|
||||
},
|
||||
openai: {
|
||||
apiKey: "API-ключ",
|
||||
apiKeyHint: "Хранится на хосте и больше не показывается.",
|
||||
keyPlaceholder: "sk-...",
|
||||
savedKeyPlaceholder: "Сохранён",
|
||||
missingKey: "Нет API-ключа",
|
||||
baseUrl: "Базовый URL",
|
||||
baseUrlHint:
|
||||
"Для серверов, совместимых с OpenAI. Оставьте пустым, чтобы использовать OpenAI.",
|
||||
},
|
||||
models: {
|
||||
loading: "Загрузка моделей...",
|
||||
loadError: "Не удалось загрузить локальные модели",
|
||||
none: "Нет доступных моделей",
|
||||
downloaded: "Скачана",
|
||||
inUse: "Используется",
|
||||
recommended: "Рекомендуется",
|
||||
download: "Скачать",
|
||||
downloadAction: "Скачать {{label}}",
|
||||
downloading: "Скачивание...",
|
||||
downloadingPercent: "Скачивание {{percent}}%",
|
||||
extracting: "Распаковка...",
|
||||
delete: "Удалить",
|
||||
deleteAction: "Удалить {{label}}",
|
||||
deleteTitle: "Удалить {{label}}?",
|
||||
deleteMessage: "Освободится {{size}}. Позже её можно скачать снова.",
|
||||
languages: "Языки {{label}}",
|
||||
moreLanguages: "{{languages}} и ещё {{count}}",
|
||||
},
|
||||
},
|
||||
general: {
|
||||
title: "Основные",
|
||||
sending: "Отправка",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user