A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Merge dev into feat/windows-onboarding-m4-start-window
Fei2411660db6abc755
diff --cc .github/ISSUE_TEMPLATE/install.ymlindex f57a25eb,00000000..e00e5651mode 100644,000000..100644--- a/.github/ISSUE_TEMPLATE/install.yml+++ b/.github/ISSUE_TEMPLATE/install.yml@@@ -1,65 -1,0 +1,65 @@@+name: Install problem / 安装问题+description: The desktop app does not download, install or start. / 桌面应用下载不了、装不上或打不开。+labels: [bug]+body:+ - type: markdown+ attributes:+ value: |+ **No diagnostics needed**: the app may not have started at all. Tell us where it stopped and what the message said.+ **不需要诊断信息**:应用可能根本没跑起来。告诉我们卡在哪一步、提示框里写了什么就行。++ Many warnings have a way through: see **The browser or Windows warns you, or blocks the installer?** at the top of the [README](https://github.com/Fei2411/DS-Bot#readme).+ 很多提示都能点过去:先看 [README](https://github.com/Fei2411/DS-Bot/blob/main/README.zh.md) 开头的 **浏览器或 Windows 提示、拦下了安装包?**。+ - type: dropdown+ id: step+ attributes:+ label: Where did it stop? / 卡在哪一步?+ options:+ - Download / 下载+ - Browser warning / 浏览器提示+ - SmartScreen or Smart App Control / SmartScreen 或智能应用控制+ - Installer / 安装+ - First start / 第一次打开+ - Other / 其他+ validations:+ required: true+ - type: textarea+ id: message+ attributes:+ label: The message, or a photo of it / 提示框的文字,或者拍一张照片+ description: Copy the text of the dialog, or paste a screenshot or a phone photo (Ctrl+V or drag it in). / 复制提示框里的文字,或者粘贴截图、手机拍的照片(Ctrl+V 或拖进来)。+ validations:+ required: true+ - type: input+ id: windows+ attributes:+ label: Windows version / Windows 版本+ description: Press Win+R, type winver and press Enter. On macOS or Linux, write the system and its version. / 按 Win+R,输入 winver,回车。macOS 或 Linux 上写系统和版本。+ placeholder: Windows 11 24H2+ validations:+ required: true+ - type: input+ id: language+ attributes:+ label: System language / 系统显示语言+ description: The display language of Windows, macOS or Linux. / Windows、macOS 或 Linux 的显示语言。+ placeholder: 简体中文 / English+ validations:+ required: true+ - type: input+ id: file+ attributes:+ label: File you downloaded / 下载的文件名- placeholder: DeepSeek-Bot-0.2.2-win-x64.exe++ placeholder: DS-Bot-0.2.2-win-x64.exe+ - type: textarea+ id: more+ attributes:+ label: Anything else / 其他情况+ description: For example the antivirus you use, or what you already tried. / 比如用的杀毒软件,或者已经试过什么。+ - type: checkboxes+ id: clean+ attributes:+ label: Privacy / 隐私+ options:+ - label: This report has no API keys, tokens or personal data. / 报告里没有 API key、token 或个人信息。+ required: truediff --cc .github/workflows/release.ymlindex d039c83c,0afc791c..ec615d7a--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@@ -233,55 -230,5 +234,56 @@@ jobs# The AppImage carries its block map inside the file, so there is no .blockmap to attach.run: |version="$(node -p "require('./package.json').version")"- gh release upload "$TAG" "dist-pack/DeepSeek-Bot-$version-linux-x86_64.AppImage" "dist-pack/DeepSeek-Bot-$version-linux-amd64.deb" dist-pack/latest-linux.yml --clobber+ legacy="$(node scripts/legacy-release-assets.mjs "dist-pack/DS-Bot-$version-linux-amd64.deb")"+ gh release upload "$TAG" "dist-pack/DS-Bot-$version-linux-x86_64.AppImage" "dist-pack/DS-Bot-$version-linux-amd64.deb" "$legacy" dist-pack/latest-linux.yml --clobber++ downloads:+ name: Download table, checksums and Latest+ needs: [app-windows, app-macos, app-linux]+ runs-on: ubuntu-latest+ timeout-minutes: 20+ defaults:+ run:+ shell: bash+ working-directory: app+ env:+ GH_TOKEN: ${{ github.token }}+ TAG: ${{ github.event.release.tag_name }}+ steps:+ - uses: actions/checkout@v4+ - uses: actions/setup-node@v4+ with:+ node-version: 24+ - name: Download the packages from the release+ if: github.event_name == 'release'+ run: |+ version="$(node -p "require('./package.json').version")"- gh release download "$TAG" --dir "$RUNNER_TEMP/packages" --pattern "DeepSeek-Bot-$version-*"++ gh release download "$TAG" --dir "$RUNNER_TEMP/packages" --pattern "DS-Bot-$version-*"+ gh release view "$TAG" --json body --jq .body > "$RUNNER_TEMP/notes.md"+ # The dry run has no release, so it checks the table and the checksums on the packages+ # that the app jobs kept.+ - name: Download the packages of the dry run+ if: github.event_name == 'workflow_dispatch'+ uses: actions/download-artifact@v4+ with:- pattern: DeepSeek-Bot-*++ pattern: DS-Bot-*+ path: ${{ runner.temp }}/packages+ merge-multiple: true+ - name: Write the download table and the checksums+ run: |+ version="$(node -p "require('./package.json').version")"+ notes=()+ if [ -f "$RUNNER_TEMP/notes.md" ]; then notes=("$RUNNER_TEMP/notes.md"); fi+ node scripts/release-notes.mjs "$version" "$RUNNER_TEMP/packages" "$RUNNER_TEMP/attach" "${notes[@]}" > "$RUNNER_TEMP/body.md"+ ls -l "$RUNNER_TEMP/attach"+ cat "$RUNNER_TEMP/body.md" >> "$GITHUB_STEP_SUMMARY"+ - name: Attach the checksums and the copies without a version+ if: github.event_name == 'release'+ run: gh release upload "$TAG" "$RUNNER_TEMP"/attach/* --clobber+ - name: Put the download table on top of the notes+ if: github.event_name == 'release'+ run: gh release edit "$TAG" --notes-file "$RUNNER_TEMP/body.md"+ # GitHub cannot make a pre-release Latest.+ - name: Mark the release as Latest+ if: github.event_name == 'release' && !github.event.release.prerelease+ run: gh release edit "$TAG" --latestdiff --cc README.mdindex 7d3ace75,214a2a99..fc3ca2c1--- a/README.md+++ b/README.md@@@ -6,38 -11,6 +6,38 @@@ English | [中文](README.zh.md  - **[Download DeepSeek Bot for Windows 10/11 (64-bit) / 下载 Windows 10/11(64 位)版](https://github.com/Fei2411/DS-Bot/releases/latest)**, about 212 MB / 约 212 MB. A community project, not an official DeepSeek product. / 社区开源项目,不是 DeepSeek 官方产品。++**[Download DS Bot for Windows 10/11 (64-bit) / 下载 Windows 10/11(64 位)版](https://github.com/Fei2411/DS-Bot/releases/latest)**, about 212 MB / 约 212 MB. A community project, not an official DeepSeek product. / 社区开源项目,不是 DeepSeek 官方产品。+- On that page, download `DeepSeek-Bot-<version>-win-x64.exe`. Double-click it to install; DeepSeek Bot opens when it is done. No administrator rights, no Node or DSH needed. You need a DeepSeek account (you can sign up with a phone number on the spot) or a DeepSeek API key. DeepSeek bills by usage: see [its prices](https://api-docs.deepseek.com/quick_start/pricing). For macOS, Linux or the DSH plugin, see [Install](README.md#install).++On that page, download `DS-Bot-<version>-win-x64.exe`. Double-click it to install; DS Bot opens when it is done. No administrator rights, no Node or DSH needed. You need a DeepSeek account (you can sign up with a phone number on the spot) or a DeepSeek API key. DeepSeek bills by usage: see [its prices](https://api-docs.deepseek.com/quick_start/pricing). For macOS, Linux or the DSH plugin, see [Install](README.md#install).+- 在这个页面下载 `DeepSeek-Bot-<版本>-win-x64.exe`,双击就会安装,装好自动打开。不用管理员权限,不用另装 Node 或 DSH。需要一个 DeepSeek 账号(可以当场用手机号注册)或 DeepSeek API Key。DeepSeek 按用量收费,见[价格页](https://api-docs.deepseek.com/quick_start/pricing)。macOS、Linux 和 DSH 插件见[安装](README.zh.md#安装)。++在这个页面下载 `DS-Bot-<版本>-win-x64.exe`,双击就会安装,装好自动打开。不用管理员权限,不用另装 Node 或 DSH。需要一个 DeepSeek 账号(可以当场用手机号注册)或 DeepSeek API Key。DeepSeek 按用量收费,见[价格页](https://api-docs.deepseek.com/quick_start/pricing)。macOS、Linux 和 DSH 插件见[安装](README.zh.md#安装)。++<details>+<summary><b>The browser or Windows warns you, or blocks the installer? / 浏览器或 Windows 提示、拦下了安装包?</b></summary>++The installer is not signed yet, so Windows does not know its publisher.++- Edge says the file is not commonly downloaded: **···** → **Keep** → **Show more** → **Keep anyway**.+- "Windows protected your PC": **More info** → **Run anyway**.+- "Smart App Control blocked …", with no **Run anyway**: there is no safe way around this for an unsigned installer. Use [DSH Desktop with the DS Bot plugin](README.md#install) instead. Do not turn Smart App Control off.+- An antivirus blocks it: check the file first. In Command Prompt, run `certutil -hashfile <file> SHA256` and compare the result with the file's line in `SHA256SUMS.txt` on the release page. If they match, choose to trust the file in the antivirus.- - The installer says it could not uninstall the old version: close DeepSeek Bot and run the installer again. If your antivirus stopped the installer, check and trust it as above first.++- The installer says it could not uninstall the old version: close DS Bot and run the installer again. If your antivirus stopped the installer, check and trust it as above first.++Still stuck? [Report an install problem](https://github.com/Fei2411/DS-Bot/issues/new?template=install.yml).++安装包还没有签名,所以 Windows 认不出发布者。++- Edge 提示「不常下载」:「···」→「保留」→「显示更多」→「仍然保留」。+- 「Windows 已保护你的电脑」:「更多信息」→「仍要运行」。+- 「智能应用控制已阻止…」,而且没有「仍要运行」:未签名的安装包没有安全的绕过办法,请改用 [DSH Desktop 加 DS Bot 插件](README.zh.md#安装)。不要关掉智能应用控制。+- 杀毒软件拦截:先核对文件。在命令提示符里运行 `certutil -hashfile <文件> SHA256`,和 Release 页上 `SHA256SUMS.txt` 里这个文件的那一行比较,一致后再在杀毒软件里选「信任」。- - 安装时提示卸载旧版失败:先关掉 DeepSeek Bot,再运行一次安装包。杀毒软件拦了安装包时,先按上面的方法核对,选「信任」。++- 安装时提示卸载旧版失败:先关掉 DS Bot,再运行一次安装包。杀毒软件拦了安装包时,先按上面的方法核对,选「信任」。++还是装不上?[报告安装问题](https://github.com/Fei2411/DS-Bot/issues/new?template=install.yml)。+</details>+- **DeepSeek Bot**: the desktop app / 桌面应用 · **DS Bot**: the project and the plugin / 项目和插件 · **DeepSeek Harness (DSH)**: what they are built on / 它们的底层++**DS Bot**: the desktop app, the project and the plugin / 桌面应用、项目和插件 · **DeepSeek Harness (DSH)**: what they are built on / 它们的底层+DS Bot is a bot plugin for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (DSH). It turns DSH into bots. You create your own bots, then talk and work with them.@@@ -48,13 -21,11 +48,13 @@@The desktop app brings its own DSH, so you don't need to install DSH first. Download it from [Releases](https://github.com/Fei2411/DS-Bot/releases):- - Windows (x64): `DeepSeek-Bot-<version>-win-x64.exe`. Run it; it installs for your user only, without administrator rights. If Windows shows "Windows protected your PC", select **More info** → **Run anyway**. For other warnings and blocks, open **The browser or Windows warns you, or blocks the installer?** at the top of this page.- - macOS: `DeepSeek-Bot-<version>-mac-arm64.zip` for an Apple chip, `DeepSeek-Bot-<version>-mac-x64.zip` for Intel. Safari unzips it by itself; drag **DeepSeek Bot** into **Applications** and open it. When macOS says it cannot check the app, open **System Settings** → **Privacy & Security** and select **Open Anyway**.- - Linux (x64): `DeepSeek-Bot-<version>-linux-x86_64.AppImage` runs on every distribution — make it executable and open it. It mounts through FUSE 2, which you may need to install first (`sudo apt install libfuse2t64` on Ubuntu 24.04+, `sudo dnf install fuse-libs` on Fedora, `sudo pacman -S fuse2` on Arch). On Ubuntu 24.04 and later an AppImage can refuse to start (Ubuntu restricts the sandbox it needs); the `DeepSeek-Bot-<version>-linux-amd64.deb` on Debian/Ubuntu does not have this problem and adds a menu entry.-- Windows (x64): `DS-Bot-<version>-win-x64.exe`. Run it; it installs for your user only, without administrator rights. If Windows shows "Windows protected your PC", select **More info** → **Run anyway**.++- Windows (x64): `DS-Bot-<version>-win-x64.exe`. Run it; it installs for your user only, without administrator rights. If Windows shows "Windows protected your PC", select **More info** → **Run anyway**. For other warnings and blocks, open **The browser or Windows warns you, or blocks the installer?** at the top of this page.+ - macOS: `DS-Bot-<version>-mac-arm64.zip` for an Apple chip, `DS-Bot-<version>-mac-x64.zip` for Intel. Safari unzips it by itself; drag **DS Bot** into **Applications** and open it. When macOS says it cannot check the app, open **System Settings** → **Privacy & Security** and select **Open Anyway**.+ - Linux (x64): `DS-Bot-<version>-linux-x86_64.AppImage` runs on every distribution with glibc 2.28 or newer — make it executable and open it. It mounts through FUSE 2, which you may need to install first (`sudo apt install libfuse2t64` on Ubuntu 24.04+, `sudo dnf install fuse-libs` on Fedora, `sudo pacman -S fuse2` on Arch). On Ubuntu 24.04 and later an AppImage can refuse to start (Ubuntu restricts the sandbox it needs); the `DS-Bot-<version>-linux-amd64.deb` on Debian/Ubuntu does not have this problem and adds a menu entry. On older-glibc systems such as CentOS 7 the app and DSH Web fail with `GLIBC_2.27 not found`; run the Docker image instead (see below and [known issues](docs/known-issues.md)).-At the first start the app asks where to keep its data and the Bots' files, and offers to copy a Bot team from your DSH (it only reads your DSH). Set up a model in its settings. The Windows app and the Linux AppImage update themselves; the macOS app and the Linux deb tell you when a new version is ready to download.+At the first start the app keeps its data and the Bots' files in your home folder; the start window says where and lets you change it in one click. It offers to copy a Bot team from your DSH (it only reads your DSH). Set up a model in its settings. The Windows app and the Linux AppImage update themselves; the macOS app and the Linux deb tell you when a new version is ready to download.++If the app does not download, install or start, [report an install problem](https://github.com/Fei2411/DS-Bot/issues/new?template=install.yml); it needs no diagnostics.**Desktop app from source (Windows)**diff --cc README.zh.mdindex 5036b1f0,eca6cd46..6f02fc02--- a/README.zh.md+++ b/README.zh.md@@@ -6,38 -11,6 +6,38 @@@  - **[Download DeepSeek Bot for Windows 10/11 (64-bit) / 下载 Windows 10/11(64 位)版](https://github.com/Fei2411/DS-Bot/releases/latest)**, about 212 MB / 约 212 MB. A community project, not an official DeepSeek product. / 社区开源项目,不是 DeepSeek 官方产品。++**[Download DS Bot for Windows 10/11 (64-bit) / 下载 Windows 10/11(64 位)版](https://github.com/Fei2411/DS-Bot/releases/latest)**, about 212 MB / 约 212 MB. A community project, not an official DeepSeek product. / 社区开源项目,不是 DeepSeek 官方产品。+- On that page, download `DeepSeek-Bot-<version>-win-x64.exe`. Double-click it to install; DeepSeek Bot opens when it is done. No administrator rights, no Node or DSH needed. You need a DeepSeek account (you can sign up with a phone number on the spot) or a DeepSeek API key. DeepSeek bills by usage: see [its prices](https://api-docs.deepseek.com/quick_start/pricing). For macOS, Linux or the DSH plugin, see [Install](README.md#install).++On that page, download `DS-Bot-<version>-win-x64.exe`. Double-click it to install; DS Bot opens when it is done. No administrator rights, no Node or DSH needed. You need a DeepSeek account (you can sign up with a phone number on the spot) or a DeepSeek API key. DeepSeek bills by usage: see [its prices](https://api-docs.deepseek.com/quick_start/pricing). For macOS, Linux or the DSH plugin, see [Install](README.md#install).+- 在这个页面下载 `DeepSeek-Bot-<版本>-win-x64.exe`,双击就会安装,装好自动打开。不用管理员权限,不用另装 Node 或 DSH。需要一个 DeepSeek 账号(可以当场用手机号注册)或 DeepSeek API Key。DeepSeek 按用量收费,见[价格页](https://api-docs.deepseek.com/quick_start/pricing)。macOS、Linux 和 DSH 插件见[安装](README.zh.md#安装)。++在这个页面下载 `DS-Bot-<版本>-win-x64.exe`,双击就会安装,装好自动打开。不用管理员权限,不用另装 Node 或 DSH。需要一个 DeepSeek 账号(可以当场用手机号注册)或 DeepSeek API Key。DeepSeek 按用量收费,见[价格页](https://api-docs.deepseek.com/quick_start/pricing)。macOS、Linux 和 DSH 插件见[安装](README.zh.md#安装)。++<details>+<summary><b>The browser or Windows warns you, or blocks the installer? / 浏览器或 Windows 提示、拦下了安装包?</b></summary>++The installer is not signed yet, so Windows does not know its publisher.++- Edge says the file is not commonly downloaded: **···** → **Keep** → **Show more** → **Keep anyway**.+- "Windows protected your PC": **More info** → **Run anyway**.+- "Smart App Control blocked …", with no **Run anyway**: there is no safe way around this for an unsigned installer. Use [DSH Desktop with the DS Bot plugin](README.md#install) instead. Do not turn Smart App Control off.+- An antivirus blocks it: check the file first. In Command Prompt, run `certutil -hashfile <file> SHA256` and compare the result with the file's line in `SHA256SUMS.txt` on the release page. If they match, choose to trust the file in the antivirus.- - The installer says it could not uninstall the old version: close DeepSeek Bot and run the installer again. If your antivirus stopped the installer, check and trust it as above first.++- The installer says it could not uninstall the old version: close DS Bot and run the installer again. If your antivirus stopped the installer, check and trust it as above first.++Still stuck? [Report an install problem](https://github.com/Fei2411/DS-Bot/issues/new?template=install.yml).++安装包还没有签名,所以 Windows 认不出发布者。++- Edge 提示「不常下载」:「···」→「保留」→「显示更多」→「仍然保留」。+- 「Windows 已保护你的电脑」:「更多信息」→「仍要运行」。+- 「智能应用控制已阻止…」,而且没有「仍要运行」:未签名的安装包没有安全的绕过办法,请改用 [DSH Desktop 加 DS Bot 插件](README.zh.md#安装)。不要关掉智能应用控制。+- 杀毒软件拦截:先核对文件。在命令提示符里运行 `certutil -hashfile <文件> SHA256`,和 Release 页上 `SHA256SUMS.txt` 里这个文件的那一行比较,一致后再在杀毒软件里选「信任」。- - 安装时提示卸载旧版失败:先关掉 DeepSeek Bot,再运行一次安装包。杀毒软件拦了安装包时,先按上面的方法核对,选「信任」。++- 安装时提示卸载旧版失败:先关掉 DS Bot,再运行一次安装包。杀毒软件拦了安装包时,先按上面的方法核对,选「信任」。++还是装不上?[报告安装问题](https://github.com/Fei2411/DS-Bot/issues/new?template=install.yml)。+</details>+- **DeepSeek Bot**: the desktop app / 桌面应用 · **DS Bot**: the project and the plugin / 项目和插件 · **DeepSeek Harness (DSH)**: what they are built on / 它们的底层++**DS Bot**: the desktop app, the project and the plugin / 桌面应用、项目和插件 · **DeepSeek Harness (DSH)**: what they are built on / 它们的底层+DS Bot 是一个基于 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(简称 dsh)的 bot 插件,插件将 dsh 改造为 bot 形式。你可以与自己创建的 bot 交流、工作。@@@ -48,13 -21,11 +48,13 @@@桌面应用自带 dsh,不用先装 dsh。在 [Releases](https://github.com/Fei2411/DS-Bot/releases) 里下载:- - Windows(x64):`DeepSeek-Bot-<版本>-win-x64.exe`。运行它即可安装,只装给当前用户,不要管理员权限。如果提示“Windows 已保护你的电脑”,点 **更多信息** → **仍要运行**。其他提示和拦截,打开本页开头的 **浏览器或 Windows 提示、拦下了安装包?**。- - macOS:Apple 芯片下载 `DeepSeek-Bot-<版本>-mac-arm64.zip`,Intel 下载 `DeepSeek-Bot-<版本>-mac-x64.zip`。Safari 会自动解压;把 **DeepSeek Bot** 拖进 **应用程序**,再打开。如果提示无法检查这个 App,打开 **系统设置** → **隐私与安全性**,点 **仍要打开**。- - Linux(x64):`DeepSeek-Bot-<版本>-linux-x86_64.AppImage` 通用于所有发行版——加上可执行权限后打开即可。它通过 FUSE 2 挂载,可能需要先安装(Ubuntu 24.04+ 用 `sudo apt install libfuse2t64`,Fedora 用 `sudo dnf install fuse-libs`,Arch 用 `sudo pacman -S fuse2`)。Ubuntu 24.04 及以后版本会限制 AppImage 需要的沙箱,AppImage 可能因此拒绝启动;Debian/Ubuntu 上的 `DeepSeek-Bot-<版本>-linux-amd64.deb` 没有这个问题,还会加菜单项。-- Windows(x64):`DS-Bot-<版本>-win-x64.exe`。运行它即可安装,只装给当前用户,不要管理员权限。如果提示“Windows 已保护你的电脑”,点 **更多信息** → **仍要运行**。++- Windows(x64):`DS-Bot-<版本>-win-x64.exe`。运行它即可安装,只装给当前用户,不要管理员权限。如果提示“Windows 已保护你的电脑”,点 **更多信息** → **仍要运行**。其他提示和拦截,打开本页开头的 **浏览器或 Windows 提示、拦下了安装包?**。+ - macOS:Apple 芯片下载 `DS-Bot-<版本>-mac-arm64.zip`,Intel 下载 `DS-Bot-<版本>-mac-x64.zip`。Safari 会自动解压;把 **DS Bot** 拖进 **应用程序**,再打开。如果提示无法检查这个 App,打开 **系统设置** → **隐私与安全性**,点 **仍要打开**。+ - Linux(x64):`DS-Bot-<版本>-linux-x86_64.AppImage` 通用于 glibc 2.28 及以上的所有发行版——加上可执行权限后打开即可。它通过 FUSE 2 挂载,可能需要先安装(Ubuntu 24.04+ 用 `sudo apt install libfuse2t64`,Fedora 用 `sudo dnf install fuse-libs`,Arch 用 `sudo pacman -S fuse2`)。Ubuntu 24.04 及以后版本会限制 AppImage 需要的沙箱,AppImage 可能因此拒绝启动;Debian/Ubuntu 上的 `DS-Bot-<版本>-linux-amd64.deb` 没有这个问题,还会加菜单项。CentOS 7 这类旧 glibc 系统上应用和 dsh Web 会因 `GLIBC_2.27 not found` 失败,改用 Docker 镜像(见下文和[已知问题](docs/known-issues.zh.md))。-第一次打开时,App 会问数据和 Bot 的文件放在哪里,并可以从你的 dsh 复制 Bot 团队(只读取你的 dsh,不改它)。在 App 的设置里配好模型就能用。Windows 版和 Linux 的 AppImage 会自动更新;macOS 版和 Linux 的 deb 有新版本时会提示你下载。+第一次打开时,App 把数据和 Bot 的文件放在你的用户文件夹里,启动窗口上写着放在哪,点一下就能换;并可以从你的 dsh 复制 Bot 团队(只读取你的 dsh,不改它)。在 App 的设置里配好模型就能用。Windows 版和 Linux 的 AppImage 会自动更新;macOS 版和 Linux 的 deb 有新版本时会提示你下载。++下载不了、装不上或打不开时,[报告安装问题](https://github.com/Fei2411/DS-Bot/issues/new?template=install.yml),不需要诊断信息。**从源码启动桌面应用(Windows)**diff --cc app/README.mdindex eb576612,5eb44710..370277e8--- a/app/README.md+++ b/app/README.md@@@ -41,7 -41,7 +41,7 @@@ Use `.\start.ps1 -DataRoot <folder>` fo## First start and import- At its first start the app uses the default data location (`~/.ds-bot`) and team workspace (`~/DeepSeek Bot`) without asking, and keeps them in `locations.json` in its own data. The start window says where the data goes and how much room the drive has, with 「换个位置…」: the system folder picker opens only on that click, and the one folder picked gives the root (`src/place.mjs`, the rule of the Windows onboarding note): the folder itself when it is new or empty, otherwise `DeepSeek Bot` inside it, as inside a drive; the data goes to `<root>/data` and the Bots' files to `<root>/workspace`. A root the app added is confirmed on a card; a place without write access, inside OneDrive, inside the user's DSH data or inside the program folder is refused with the reason. The start then begins again in the new folder, and the folders this start made at the default place go away. Once a team has been copied in, the line goes, and the data moves through Settings. The offer to copy a team is still a dialog. Neither folder may be inside the other or inside the user's DSH data.-At its first start the app asks, in system dialogs, for the data location (`~/.ds-bot` by default) and the team workspace (`~/DS Bot`), and keeps the answer in `locations.json` in its own data. Neither folder may be inside the other or inside the user's DSH data.++At its first start the app uses the default data location (`~/.ds-bot`) and team workspace (`~/DS Bot`) without asking, and keeps them in `locations.json` in its own data. The start window says where the data goes and how much room the drive has, with 「换个位置…」: the system folder picker opens only on that click, and the one folder picked gives the root (`src/place.mjs`, the rule of the Windows onboarding note): the folder itself when it is new or empty, otherwise `DS Bot` inside it, as inside a drive; the data goes to `<root>/data` and the Bots' files to `<root>/workspace`. A root the app added is confirmed on a card; a place without write access, inside OneDrive, inside the user's DSH data or inside the program folder is refused with the reason. The start then begins again in the new folder, and the folders this start made at the default place go away. Once a team has been copied in, the line goes, and the data moves through Settings. The offer to copy a team is still a dialog. Neither folder may be inside the other or inside the user's DSH data.Both change later in DS Bot's Settings > General > Locations. The plugin moves the team workspace and tells the app, which writes it into `locations.json`. The app names the user's DSH data to the plugin (`DS_BOT_USER_DSH_HOME`), so that neither the team workspace nor a Bot's folder can be set there. The data location moves through the app (`src/move-data.mjs`): the new folder must be empty or new and apart from the old data, the team workspace, the user's DSH data and the program folder. The app stops the Host, copies the data (without the team's lock) into a staging folder beside the new one, renames it to the new folder once it is whole, writes `locations.json` and starts again. A failed or interrupted copy leaves the old location in use and removes the staging folder; the old folder always stays. A run on throwaway folders (`DS_BOT_HOME`) keeps its data location.@@@ -151,13 -151,11 +151,13 @@@ The launch URL of the Host is good for| `src/bot-browser.mjs` | The Bot browsers' webviews: only a leased one attaches, with fixed preferences; each Bot's logins stay on disk until the Bot is deleted; pages cannot reach the Host || `src/cookie-parse.mjs`, `src/cookie-import.mjs`, `src/browser-sources.mjs` | Cookie imports: the cookie-file parser (Cookie-Editor JSON, Netscape, Playwright storageState), the write into a Bot's partition with read-back and flush, and the installed-browser profiles a source is cloned from — the source browser itself decrypts its own store over a CDP pipe; values never leave the main process || `src/window-frame.mjs`, `src/mica.css` | The frameless Windows window: the caption band, when Mica is available (Windows 11 22H2 and later), and the stylesheet that lets Mica through the sidebar |- | `src/host-process.mjs` | Starts the Host in Electron's Node mode and owns its exit |+ | `src/host-process.mjs` | Starts the Host in the bundled plain Node on Linux, Electron's Node mode elsewhere, and owns its exit || `src/host.mjs` | The Host: boots the profile with `runProfile()` and reports the launch URL and the page injections; for the first-run check (`DS_BOT_CHECK`), the chats it cannot read || `src/profile.mjs` | The profiles: the app's own and the first-run check's, their bundles, and their creation and update |+| `src/app-patch.mjs` | The app's own profile overlay (`profiles/app-onboarding.patch.yml`, passed through `patchFiles`): it turns off DSH Web's automatic credential step (`credentialOnboarding: false`), since models are set up in DS Bot's Models page and the Main Bot's key card || `src/session-check.mjs` | Which chats the pinned DSH refuses because a newer DSH wrote them |-| `src/first-run.mjs` | The first start's dialogs (the two folders and the offer to import) and the texts of the data move |+| `src/first-run.mjs` | The first start's places (the defaults, the saved ones, the folder picker of 「换个位置…」), its offer to import, and the texts of the data move |+| `src/place.mjs` | The place line of the start page (drive, free space) and the root rule of a picked folder || `src/import.mjs` | The import of a Bot team from the user's DSH || `src/move-data.mjs` | The move of the data location: which folders can take it, and the copy through a staging folder || `src/updates.mjs` | The self-updates (Windows installer, Linux AppImage) and the release-page checks (macOS, Linux deb) |diff --cc app/scripts/release-notes.mjsindex c02decc1,00000000..e3c48c28mode 100644,000000..100644--- a/app/scripts/release-notes.mjs+++ b/app/scripts/release-notes.mjs@@@ -1,124 -1,0 +1,124 @@@+// Writes what a release offers for download: the "Download / 下载" table at the top of its notes,+// SHA256SUMS.txt, and a copy of each package without the version in its name, which a fixed+// releases/latest/download/ link can name.+// Usage: node scripts/release-notes.mjs <version> <folder with the packages> <folder for the files to attach> [<current notes>]+// It prints the notes with the table on top. MIRROR_BASE, when set, is a URL that holds the+// packages under the same names; GITHUB_REPOSITORY names the repository (default Fei2411/DS-Bot).+import { createHash } from 'node:crypto'+import { copyFileSync, createReadStream, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs'+import { join } from 'node:path'+import { fileURLToPath } from 'node:url'++export const REPO = 'Fei2411/DS-Bot'+// The order of the table: Windows first, where most downloads are.+export const PACKAGES = [+ { file: 'win-x64.exe', system: '**Windows 10/11 (64-bit / 64 位)**', note: 'Double-click to install / 双击安装' },+ { file: 'mac-arm64.zip', system: 'macOS, Apple chip / Apple 芯片' },+ { file: 'mac-x64.zip', system: 'macOS, Intel' },+ { file: 'linux-x86_64.AppImage', system: 'Linux, AppImage' },+ { file: 'linux-amd64.deb', system: 'Linux, deb (Debian, Ubuntu)' },+]+export const SUMS = 'SHA256SUMS.txt'+// The table sits between these, so a second run replaces it instead of adding another.+const START = '<!-- downloads -->'+const END = '<!-- /downloads -->'+- export const packageName = (version, entry) => `DeepSeek-Bot-${version}-${entry.file}`- export const copyName = entry => `DeepSeek-Bot-${entry.file}`++export const packageName = (version, entry) => `DS-Bot-${version}-${entry.file}`++export const copyName = entry => `DS-Bot-${entry.file}`++/** @returns {string[]} the packages of `version` that are not among `names` */+export function missingPackages(version, names) {+ const have = new Set(names)+ return PACKAGES.map(entry => packageName(version, entry)).filter(name => !have.has(name))+}++export function formatSize(bytes) {+ return `${String(Math.max(1, Math.round(bytes / 1024 ** 2)))} MB`+}++export function releaseUrl({ repo = REPO, version, name }) {+ return `https://github.com/${repo}/releases/download/v${version}/${encodeURIComponent(name)}`+}++function mirrorUrl(mirror, name) {+ return `${mirror.replace(/\/+$/u, '')}/${encodeURIComponent(name)}`+}++/** `sizes`: bytes by package name. Without `mirror` each package has its GitHub link only. */+export function downloadBlock({ version, sizes, repo = REPO, mirror }) {+ const links = (name) => {+ const github = releaseUrl({ repo, version, name })+ return mirror ? `${name}: [Mirror / 国内镜像](${mirrorUrl(mirror, name)}) · [GitHub](${github})` : `[${name}](${github})`+ }+ const rows = PACKAGES.map((entry) => {+ const name = packageName(version, entry)+ const system = entry.note === undefined ? entry.system : `${entry.system}<br>${entry.note}`+ return `| ${system} | ${links(name)} | ${formatSize(sizes[name])} |`+ })+ const sums = releaseUrl({ repo, version, name: SUMS })+ return [+ START,+ '## Download / 下载',+ '',+ '| System / 系统 | Download / 下载 | Size / 大小 |',+ '|---|---|---|',+ ...rows,+ '',+ 'The `.blockmap`, `latest*.yml` and `ds-bot-*.tgz` files and the source code archives are for updates and the plugin: you do not need to download them.',+ '',+ '`.blockmap`、`latest*.yml`、`ds-bot-*.tgz` 和源代码是给自动更新和插件用的,不用下载。',+ '',+ `To check a download, compare its SHA-256 with [${SUMS}](${sums}). / 下载后可以用 [${SUMS}](${sums}) 核对 SHA-256。`,+ END,+ ].join('\n')+}++/** `hashes`: SHA-256 hex by package name. Each package is listed under both of its names. */+export function checksums(version, hashes) {+ const lines = PACKAGES.flatMap((entry) => {+ const hash = hashes[packageName(version, entry)]+ return [`${hash} ${packageName(version, entry)}`, `${hash} ${copyName(entry)}`]+ })+ return `${lines.join('\n')}\n`+}++/** The release notes with `block` on top, in place of a table from an earlier run. */+export function withDownloads(notes, block) {+ const start = notes.indexOf(START)+ const end = notes.indexOf(END, start)+ const rest = start === -1 || end === -1 ? notes : notes.slice(0, start) + notes.slice(end + END.length)+ const body = rest.trim()+ return body === '' ? `${block}\n` : `${block}\n\n${body}\n`+}++async function sha256(file) {+ const hash = createHash('sha256')+ for await (const chunk of createReadStream(file)) hash.update(chunk)+ return hash.digest('hex')+}++async function main([version, from, to, notesFile]) {+ if (!version || !from || !to) {+ console.error('release-notes: usage: node scripts/release-notes.mjs <version> <folder with the packages> <folder for the files to attach> [<current notes>]')+ process.exit(2)+ }+ const missing = missingPackages(version, readdirSync(from))+ if (missing.length > 0) {+ console.error(`release-notes: ${from} has no ${missing.join(', ')}`)+ process.exit(1)+ }+ mkdirSync(to, { recursive: true })+ const sizes = {}+ const hashes = {}+ for (const entry of PACKAGES) {+ const name = packageName(version, entry)+ sizes[name] = statSync(join(from, name)).size+ hashes[name] = await sha256(join(from, name))+ copyFileSync(join(from, name), join(to, copyName(entry)))+ }+ writeFileSync(join(to, SUMS), checksums(version, hashes))+ const block = downloadBlock({ version, sizes, repo: process.env.GITHUB_REPOSITORY || REPO, mirror: process.env.MIRROR_BASE || undefined })+ process.stdout.write(withDownloads(notesFile === undefined ? '' : readFileSync(notesFile, 'utf8'), block))+}++if (process.argv[1] === fileURLToPath(import.meta.url)) await main(process.argv.slice(2))diff --cc app/scripts/start-assets.mjsindex 91514e79,00000000..dac760a7mode 100644,000000..100644--- a/app/scripts/start-assets.mjs+++ b/app/scripts/start-assets.mjs@@@ -1,147 -1,0 +1,152 @@@+// Writes the generated blocks of the start page in src/start from the plugin's client modules+// in ../ds-bot (read only, as scripts/icon.mjs does):+// - start.html, between <!-- whale --> markers: the Main Bot's whale from characterMarkup('whale',+// 'deepseek'), cut at the tail stock into two copies so the tail can move on its own. The mask+// is st-eyes, the clips st-tail-cut and st-torso-cut; the fill stays var(--bt-ink-deepseek).+// - start.css, between /* tokens */ markers: the DeepSeek theme's light and dark colors.+// - start.css, between /* springs */ markers: motion.js's springs as linear() curves.+// Usage: node scripts/start-assets.mjs [--check] (--check exits 1 when a block is stale and+// writes nothing)+import { readFileSync, writeFileSync } from 'node:fs'+import { CHARACTERS, characterMarkup, MASK_ID } from '../../ds-bot/src/client/characters.js'+import { INKS } from '../../ds-bot/src/client/inks.js'+import { allThemes, themeCss } from '../../ds-bot/src/client/themes.js'++const client = new URL('../../ds-bot/src/client/', import.meta.url)+const page = new URL('../src/start/', import.meta.url)++const THEME_TOKENS = ['--bt-main', '--bt-card', '--bt-ink', '--bt-ink-2', '--bt-line', '--bt-line-2', '--bt-hover', '--bt-accent', '--bt-accent-ink']+// The status colors are the same in both modes; the plugin's base sheet defines them.+const BASE_TOKENS = ['--bt-green', '--bt-danger']+const SPRINGS = ['shape', 'tap', 'pop', 'stretch', 'list']++// Wraps the one self-closing element that starts with `start` in <g id>.+function wrap(markup, id, start) {+ const at = markup.indexOf(start)+ if (at < 0 || markup.indexOf(start, at + 1) >= 0) throw new Error(`${id}: expected exactly one match`)+ const stop = markup.indexOf('/>', at) + 2+ return `${markup.slice(0, at)}<g id="${id}">${markup.slice(at, stop)}</g>${markup.slice(stop)}`+}+function group(markup, start) {+ const at = markup.indexOf(start)+ const tags = /<g[\s>]|<\/g>/gu+ tags.lastIndex = at+ let depth = 0+ for (let match = tags.exec(markup); match !== null; match = tags.exec(markup)) {+ depth += match[0] === '</g>' ? -1 : 1+ if (depth === 0) return markup.slice(at, match.index + 4)+ }+ throw new Error('unclosed group')+}++function rig() {+ const whale = CHARACTERS.whale+ const raw = characterMarkup('whale', 'deepseek').replaceAll(MASK_ID, 'st-eyes')+ if (!raw.includes('fill="var(--bt-ink-deepseek)"')) throw new Error('the whale no longer fills with var(--bt-ink-deepseek)')+ const mask = raw.slice(raw.indexOf('<mask'), raw.indexOf('</mask>') + 7)+ .replace('<g class="bt-gaze">', '<g id="gaze" class="bt-gaze">')+ .replace('<g class="bt-eyes" fill="#000">', '<g id="eye-pair" class="bt-eyes" fill="#000">')- let layers = group(raw, '<g fill-rule="evenodd">')++ // The start whale keeps the highlight layer and the stronger shade it was designed++ // with; the runtime characters draw the body without them.++ let layers = `<g fill-rule="evenodd"><path d="${whale.body}" fill="var(--bt-ink-deepseek)"/>`++ + (whale.paints ?? []).map(([d, fill, opacity]) => `<path d="${d}" fill="${fill}" fill-opacity="${opacity}"/>`).join('')++ + `<path d="${whale.shade}" fill="#000" fill-opacity=".14"/>`++ + `<path d="${whale.light}" fill="#fff" fill-opacity=".16"/></g>`+ layers = wrap(layers, 'w-body', `<path d="${whale.body}"`)+ layers = wrap(layers, 'w-belly', `<path d="${whale.paints[0][0]}"`)+ layers = wrap(layers, 'w-shade', `<path d="${whale.shade}"`)+ layers = wrap(layers, 'w-light', `<path d="${whale.light}"`)+ layers = layers.replace('<g fill-rule="evenodd">', '<g id="whale-layers" fill-rule="evenodd">')+ // The cut runs from the notch behind the upper fluke down through the bottom contour at the+ // pivot (27.9, 61.1), where the tail turns. The tail copy reaches 4 units past the cut under+ // the torso, so tipping the flukes opens no gap; at rest the two copies draw the plain whale.+ const top = [32.45, 52.05]+ const bottom = [23.35, 70.15]+ const pivot = [27.9, 61.1]+ const length = Math.hypot(bottom[0] - top[0], bottom[1] - top[1])+ const normal = [-(bottom[1] - top[1]) / length, (bottom[0] - top[0]) / length]+ const notch = [top[0] - normal[0] * 4, top[1] - normal[1] * 4].map(n => n.toFixed(2))+ const tailCut = `M-100 -100H${top[0]}V${top[1]}L${notch[0]} ${notch[1]}L${pivot[0]} ${pivot[1]}L${bottom[0]} ${bottom[1]}L${bottom[0]} 200H-100Z`+ const torsoCut = `M${top[0]} -100H200V200H-100V${bottom[1]}H${bottom[0]}L${top[0]} ${top[1]}Z`+ return `<svg class="whale-svg" viewBox="0 0 100 100" aria-hidden="true" focusable="false"><defs>${mask}`+ + `<clipPath id="st-tail-cut" clipPathUnits="userSpaceOnUse"><path d="${tailCut}"/></clipPath>`+ + `<clipPath id="st-torso-cut" clipPathUnits="userSpaceOnUse"><path d="${torsoCut}"/></clipPath>${layers}</defs>`+ + '<g class="bt-b"><g mask="url(#st-eyes)"><g id="tail"><use href="#whale-layers" clip-path="url(#st-tail-cut)"/></g>'+ + '<g id="torso"><use href="#whale-layers" clip-path="url(#st-torso-cut)"/></g></g></g></svg>'+}++const rules = css => [...css.matchAll(/\{([^}]*)\}/gu)].map(([, body]) => new Map(body.split(';').filter(Boolean).map(item => item.split(/:(.*)/su).slice(0, 2))))+function pick(vars, names, from) {+ return names.map((name) => {+ if (!vars.has(name)) throw new Error(`${from} no longer sets ${name}`)+ return `${name}:${vars.get(name)}`+ }).join(';')+}++function tokens() {+ const [light, dark] = rules(themeCss(allThemes().deepseek))+ const base = readFileSync(new URL('styles.js', client), 'utf8').match(/^body\{(--bt-[^}]*)\}$/mu)+ if (!base) throw new Error('styles.js: the base body rule was not found')+ const [ink, inkDark] = INKS.deepseek+ return [+ '/* Generated from the DeepSeek theme in ds-bot/src/client/themes.js, inks.js and styles.js by scripts/start-assets.mjs; do not edit. */',+ `:root{color-scheme:light dark;${pick(light, THEME_TOKENS, 'themeCss')};--bt-ink-deepseek:${ink};${pick(rules(`{${base[1]}}`)[0], BASE_TOKENS, 'styles.js')}}`,+ `@media (prefers-color-scheme:dark){:root{${pick(dark, THEME_TOKENS, 'themeCss')};--bt-ink-deepseek:${inkDark}}}`,+ ]+}++// motion.js imports React for its hooks; its springs are plain arithmetic, so the module runs+// here with the React names stubbed out.+async function motion() {+ const source = readFileSync(new URL('motion.js', client), 'utf8')+ const imports = source.match(/^import .*$/gmu) ?? []+ const react = imports.length === 1 ? imports[0].match(/^import \{([^}]*)\} from 'react'\r?$/u) : null+ if (!react) throw new Error('motion.js: expected its only import to be from react')+ const stub = `const {${react[1].replaceAll(' as ', ': ')}} = {}`+ return import(`data:text/javascript,${encodeURIComponent(source.replace(imports[0], stub))}`)+}++async function springs() {+ const curves = await motion()+ return [+ '/* Generated from ds-bot/src/client/motion.js by scripts/start-assets.mjs; do not edit. */',+ ':root {',+ ...SPRINGS.flatMap((name) => {+ const curve = curves[`SPRING_${name.toUpperCase()}`]+ if (!curve) throw new Error(`motion.js no longer exports SPRING_${name.toUpperCase()}`)+ return [` --spring-${name}: ${curve.easing};`, ` --spring-${name}-ms: ${curve.duration}ms;`]+ }),+ '}',+ ]+}++// Replaces what lies between the two markers; a block of lines takes the file's own line ends,+// which git may have turned into CRLF on checkout.+function between(text, open, close, block) {+ const eol = text.includes('\r\n') ? '\r\n' : '\n'+ const body = Array.isArray(block) ? `${eol}${block.join(eol)}${eol}` : block+ const a = text.indexOf(open)+ const b = text.indexOf(close, a + open.length)+ if (a < 0 || b < 0) throw new Error(`markers ${open} ${close} not found`)+ return `${text.slice(0, a + open.length)}${body}${text.slice(b)}`+}++const files = {+ 'start.html': html => between(html, '<!-- whale -->', '<!-- /whale -->', rig()),+ 'start.css': async css => between(between(css, '/* tokens */', '/* /tokens */', tokens()), '/* springs */', '/* /springs */', await springs()),+}+const check = process.argv.includes('--check')+const stale = []+for (const [name, generate] of Object.entries(files)) {+ const file = new URL(name, page)+ const text = readFileSync(file, 'utf8')+ const next = await generate(text)+ if (next === text) continue+ stale.push(name)+ if (!check) writeFileSync(file, next)+}+if (check && stale.length) {+ console.error(`start page: stale generated blocks in ${stale.join(', ')}; run node scripts/start-assets.mjs`)+ process.exit(1)+}+console.log(check ? 'start page: generated blocks are current' : stale.length ? `start page: wrote ${stale.join(', ')}` : 'start page: nothing to write')diff --cc app/src/first-run.mjsindex c2c35b84,62e7897b..39767e96--- a/app/src/first-run.mjs+++ b/app/src/first-run.mjs@@@ -19,10 -80,8 +19,10 @@@ const locationsFile = () => join(app.ge// A quit request while a first-run dialog is open stops the first run right after that dialog.class Quit extends Error {}-async function ask(options, signal) {- const { response } = await dialog.showMessageBox({ title: 'DS Bot', noLink: true, ...options, signal })+// The dialogs belong to `ui.owner()` (the start window); `ui.asking` holds the start's clock while+// the user answers.+async function ask(options, signal, ui) {- const { response } = await ui.asking(dialog.showMessageBox(ui.owner(), { title: 'DeepSeek Bot', noLink: true, ...options, signal }))++ const { response } = await ui.asking(dialog.showMessageBox(ui.owner(), { title: 'DS Bot', noLink: true, ...options, signal }))// A quit that arrived while a synchronous macOS box was open gets to run first.await new Promise(resolve => setImmediate(resolve))if (signal.aborted) throw new Quit()@@@ -38,29 -97,23 +38,29 @@@ async function pick(title, from, signalexport const programFolder = () => installFolder(app.getPath('exe'))-function placeProblem(t, dataDir, workspace) {- const dsh = userDshHome()- const program = programFolder()- if (within(dataDir, workspace)) return t.dataInWorkspace- if (within(workspace, dataDir)) return t.workspaceInData- for (const path of [dataDir, workspace]) {- if (within(path, dsh) || within(dsh, path)) return t.inDsh(dsh)- if (app.isPackaged && within(path, program)) return t.inProgram+/**+ * The system picker of 「换个位置…」 on the start page: one folder, from which the root rule+ * (place.mjs) makes the places. Undefined when the box was cancelled or the app is quitting.+ * @param {string} from the folder the picker opens in+ */+export async function pickRoot(from, signal, ui) {+ try {+ return await pick(tx('dialog.pickRoot'), from, signal, ui)+ } catch (error) {+ if (error instanceof Quit) return undefined+ throw error}- return undefined}-function hasTeam(dataDir) {+/** The places a first start offers. */- export const defaultPlaces = () => ({ dataDir: join(homedir(), '.ds-bot'), workspace: join(homedir(), 'DeepSeek Bot') })++export const defaultPlaces = () => ({ dataDir: join(homedir(), '.ds-bot'), workspace: join(homedir(), 'DS Bot') })++/** The Bot team in a data folder, if it has one. */+export function teamIn(dataDir) {try {- return Object.keys(JSON.parse(readFileSync(join(dataDir, 'bot', 'state.json'), 'utf8')).bots ?? {}).length > 0+ return findTeam(dataDir)} catch {- return false+ return undefined}}diff --cc app/src/host-process.mjsindex ef1e2228,e3ed1369..4e9f03d8--- a/app/src/host-process.mjs+++ b/app/src/host-process.mjs@@@ -30,11 -39,10 +39,11 @@@ export class HostProcess#messageListeners = new Set()/**- * @param {{ entry: string, cwd: string, env: NodeJS.ProcessEnv, pnpm: string, onFailure: (error: Error) => void }} options- * `onFailure` receives the first unexpected failure, also after the Host was ready.+ * @param {{ entry: string, cwd: string, env: NodeJS.ProcessEnv, pnpm: string, onFailure: (error: Error) => void, output?: (stream: 'stdout' | 'stderr', text: string) => void }} options+ * `onFailure` receives the first unexpected failure, also after the Host was ready. `output`+ * takes the Host's output with the launch token hidden; by default it goes to this process's.*/- constructor(options) { this.#options = options }+ constructor(options, platform = process.platform) { this.#options = options; this.#platform = platform }/*** @returns {Promise<{ url: string, injections: unknown[] } | { unreadable: string[] }>} the Host's launch URL@@@ -42,8 -50,8 +51,8 @@@*/start() {this.#ready ??= new Promise((resolve, reject) => {- const { entry, cwd, env, pnpm } = this.#options+ const { entry, cwd, env, pnpm, output = (stream, text) => { process[stream].write(text) } } = this.#options- const child = spawn(process.execPath, ['--expose-internals', entry, pnpm], {+ const child = spawn(hostExecutable(env.DS_BOT_RUNTIME_DIR, this.#platform), ['--expose-internals', entry, pnpm], {cwd, env: { ...env, ELECTRON_RUN_AS_NODE: '1' }, stdio: ['ignore', 'pipe', 'pipe', 'ipc'],})this.#child = childdiff --cc app/src/host.mjsindex 3242a526,7e7d8155..5471592e--- a/app/src/host.mjs+++ b/app/src/host.mjs@@@ -6,8 -7,8 +7,9 @@@ import { readFileSync } from 'node:fsimport { inspect } from 'node:util'import { loadLayeredEnv, reportSkippedBundles } from '@deepseek-ai/dsh-app-boot'import { runProfile } from '@deepseek-ai/dsh/profile-boot'+import { writeAppPatch } from './app-patch.mjs'import { CHECK_PROFILE, INSTALL_ANCHOR, loadAppProfile, loadCheckProfile, PROFILE } from './profile.mjs'+ import { reconcileGoal } from './goal-patch.mjs'import { reconcileOfficeRuntime } from './office-patch.mjs'import { reconcileSearchSelector } from './search-patch.mjs'import { unreadableSessions } from './session-check.mjs'@@@ -33,7 -34,7 +35,7 @@@ async function main()environment: loadLayeredEnv('dsh'),profile: check === undefined ? PROFILE : CHECK_PROFILE,resolvedProfile: { profile, installAnchor: INSTALL_ANCHOR },- patchFiles: check === undefined ? [...writeAppPatch(profile), ...reconcileSearchSelector(profile), ...office.patchFiles] : [],- patchFiles: check === undefined ? [...reconcileSearchSelector(profile), ...reconcileGoal(profile), ...office.patchFiles] : [],++ patchFiles: check === undefined ? [...writeAppPatch(profile), ...reconcileSearchSelector(profile), ...reconcileGoal(profile), ...office.patchFiles] : [],args: ['--no-open', '--port', process.env.DS_BOT_PORT || '0'],...(pnpm === undefined ? {} : {packageManager: { command: process.execPath, args: ['--expose-internals', pnpm], env: { ELECTRON_RUN_AS_NODE: '1' } },diff --cc app/src/import.mjsindex 639677a9,68ab5d81..b3d45851--- a/app/src/import.mjs+++ b/app/src/import.mjs@@@ -236,13 -190,7 +236,13 @@@ async function copyThroughStage({ found}signal?.throwIfAborted()const keys = []- for (const name of ['.credentials.yaml', '.env']) if (await copyKey(from, to, name)) keys.push(name)+ const keptKeys = []+ for (const name of ['.credentials.yaml', '.env']) {+ const done = await copyKey(from, to, name)+ if (done === 'copied') keys.push(name)+ if (done === 'kept') keptKeys.push(name)+ }- if (keptKeys.length > 0) console.warn(`DeepSeek Bot: the import kept the ${keptKeys.join(' and ')} that the data location has`)++ if (keptKeys.length > 0) console.warn(`DS Bot: the import kept the ${keptKeys.join(' and ')} that the data location has`)const rows = found.profiles.find(entry => entry.name === profile)?.rows ?? []if (rows.length > 0) await writeModelRows(to, rows)diff --cc app/src/logs.mjsindex c7be7c32,00000000..9a981866mode 100644,000000..100644--- a/app/src/logs.mjs+++ b/app/src/logs.mjs@@@ -1,184 -1,0 +1,184 @@@+// main.log: the main process's console output and the Host's, in the app's own userData- // (%APPDATA%\DeepSeek Bot\logs on Windows), redacted before it is written and kept to three++// (%APPDATA%\DS Bot\logs on Windows), redacted before it is written and kept to three+// files of 2 MB (docs/plans/2026-10-26-windows-onboarding.md §3).+import { closeSync, mkdirSync, openSync, readFileSync, renameSync, statSync, writeSync } from 'node:fs'+import { homedir } from 'node:os'+import { join } from 'node:path'++export const LOG_LIMIT = 2 * 1024 * 1024+export const LOG_FILES = 3+// A line without its end (a progress line redrawn with \r) is written once it gets this long.+const PARTIAL_MAX = 8 * 1024++/** main.log, then main.1.log and main.2.log, newest first. */+export const logNames = (count = LOG_FILES) => Array.from({ length: count }, (_, index) => (index === 0 ? 'main.log' : `main.${String(index)}.log`))++const escape = text => text.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&')++/**+ * Removes what must not reach a log or a copied report: the launch token, API keys, the query of+ * a sign-in callback and the user's home folder, which names the user.+ * @param {{ home?: string, platform?: string }} [options]+ * @returns {(text: string) => string}+ */+export function redactor({ home = homedir(), platform = process.platform } = {}) {+ const parts = home.split(/[\\/]+/u).filter(Boolean)+ // Any separator, doubled as in JSON, and on Windows any case: the same folder. A home of '/'+ // or '' names nobody.+ const lead = /^[\\/]/u.test(home) ? '[\\\\/]' : ''+ const homePattern = parts.length > 0 ? new RegExp(`${lead}${parts.map(escape).join('[\\\\/]+')}(?=[\\\\/\\s"'\`<>|:;,)\\]}]|$)`, platform === 'win32' ? 'giu' : 'gu') : undefined+ const label = platform === 'win32' ? '%USERPROFILE%' : '~'+ return (text) => {+ let out = text+ .replace(/(token=)[^&\s"'<>]+/giu, '$1<hidden>')+ .replace(/(\/oauth\/callback)\?[^\s"'<>]+/gu, '$1?<hidden>')+ .replace(/\bsk-[A-Za-z0-9][\w-]*/gu, 'sk-<hidden>')+ .replace(/\b(Bearer\s+)[\w.~+/=-]+/gu, '$1<hidden>')+ if (homePattern !== undefined) out = out.replace(homePattern, label)+ return out+ }+}++/**+ * Splits a chunk of output into whole lines; the rest waits for the next chunk.+ * @returns {{ lines: string[], rest: string }}+ */+export function splitLines(rest, chunk) {+ const pieces = (rest + chunk).split(/\r?\n/u)+ let tail = pieces.pop() ?? ''+ const lines = pieces.map(line => line.replace(/\r/gu, ''))+ if (tail.length > PARTIAL_MAX) {+ lines.push(tail.replace(/\r/gu, ''))+ tail = ''+ }+ return { lines, rest: tail }+}++/** Whether a write of `add` bytes goes into a fresh file. */+export const shouldRotate = (size, add, limit = LOG_LIMIT) => size > 0 && size + add > limit++/** Shifts main.log to main.1.log and so on; the oldest is overwritten. */+export function rotate(dir, count = LOG_FILES) {+ const names = logNames(count)+ for (let index = names.length - 1; index > 0; index -= 1) {+ try {+ renameSync(join(dir, names[index - 1]), join(dir, names[index]))+ } catch (error) {+ if (error?.code !== 'ENOENT') throw error+ }+ }+}++/** The last `count` lines of a text. */+export function tailLines(text, count) {+ const lines = text.split(/\r?\n/u)+ if (lines.at(-1) === '') lines.pop()+ return lines.slice(-count)+}++export class LogFile {+ #dir+ #file+ #fd+ #size = 0+ #limit+ #redact+ #now+ #rests = new Map()+ #broken = false++ /** @param {{ dir: string, limit?: number, redact?: (text: string) => string, now?: () => Date }} options */+ constructor({ dir, limit = LOG_LIMIT, redact = redactor(), now = () => new Date() }) {+ this.#dir = dir+ this.#file = join(dir, logNames()[0])+ this.#limit = limit+ this.#redact = redact+ this.#now = now+ }++ get dir() { return this.#dir }++ /** Writes the whole lines of a chunk of output, each with the time and its source. */+ write(source, chunk) {+ const { lines, rest } = splitLines(this.#rests.get(source) ?? '', String(chunk))+ this.#rests.set(source, rest)+ for (const line of lines) this.#line(source, line)+ }++ /** Writes the lines still waiting for their end. */+ flush() {+ for (const [source, rest] of this.#rests) if (rest !== '') this.#line(source, rest)+ this.#rests.clear()+ }++ /** The last `count` lines across the files, oldest first, redacted. */+ tail(count) {+ this.flush()+ const texts = []+ for (const name of logNames()) {+ try {+ texts.unshift(readFileSync(join(this.#dir, name), 'utf8'))+ } catch {+ break+ }+ if (tailLines(texts.join(''), count).length >= count) break+ }+ return tailLines(texts.join(''), count).map(this.#redact)+ }++ close() {+ this.flush()+ if (this.#fd !== undefined) closeSync(this.#fd)+ this.#fd = undefined+ }++ #line(source, line) {+ if (this.#broken) return+ const text = `${this.#now().toISOString()} [${source}] ${this.#redact(line)}\n`+ const bytes = Buffer.byteLength(text)+ try {+ if (this.#fd === undefined) this.#open()+ if (shouldRotate(this.#size, bytes, this.#limit)) {+ closeSync(this.#fd)+ this.#fd = undefined+ // Another process can still hold main.log open (the one that relaunched this one);+ // then the file grows past the limit until the next start.+ try { rotate(this.#dir) } catch { /* kept */ }+ this.#open()+ }+ writeSync(this.#fd, text)+ this.#size += bytes+ } catch {+ // A log that cannot be written must not stop the app.+ this.#broken = true+ }+ }++ #open() {+ mkdirSync(this.#dir, { recursive: true })+ this.#fd = openSync(this.#file, 'a')+ this.#size = statSync(this.#file).size+ }+}++/**+ * Copies everything the main process writes to stdout and stderr into the log.+ * @returns {{ stdout: (text: string) => void, stderr: (text: string) => void }} writers that bypass the log+ */+export function captureStdio(log, streams = { stdout: process.stdout, stderr: process.stderr }) {+ const raw = {}+ for (const [name, stream] of Object.entries(streams)) {+ const write = stream.write.bind(stream)+ raw[name] = (text) => { try { write(text) } catch { /* no console */ } }+ stream.write = (chunk, encoding, callback) => {+ log.write('main', typeof chunk === 'string' ? chunk : Buffer.from(chunk).toString(typeof encoding === 'string' ? encoding : 'utf8'))+ try {+ return write(chunk, encoding, callback)+ } catch {+ // A packaged app on Windows can have no console behind stdout.+ return true+ }+ }+ }+ return raw+}diff --cc app/src/main.mjsindex eb35827b,60a7b5d7..545baedf--- a/app/src/main.mjs+++ b/app/src/main.mjs@@@ -12,14 -8,24 +12,15 @@@ import { release } from 'node:osimport { basename, dirname, isAbsolute, join, resolve } from 'node:path'import { setTimeout as sleep } from 'node:timers/promises'import { fileURLToPath } from 'node:url'-import { getDshRuntimeVersion } from '@deepseek-ai/dsh-app-boot'-import electronUpdater from 'electron-updater'-import { BotBrowserGuests, partitionOf } from './bot-browser.mjs'-import { BotViews, isBotId } from './bot-views.mjs'-import { importFromBrowser, listSources } from './browser-sources.mjs'-import { applyCookies, CookieImports } from './cookie-import.mjs'-import { parseCookieFile } from './cookie-parse.mjs'-import { downloadSaver } from './downloads.mjs'import { canonicalExecPath } from './canonical-path.mjs'-import { chooseLocations, localeText, programFolder, saveLocations, text } from './first-run.mjs'+ import { configureIdentity } from './legacy.mjs'import { hostPort } from './host-port.mjs'-import { HostProcess } from './host-process.mjs'-import { copySessions, findTeam, importTeam, teamInUse, userDshHome } from './import.mjs'-import { copyData, moveProblem } from './move-data.mjs'-import { CHECK_PROFILE, PROFILE } from './profile.mjs'+import { captureStdio, LogFile } from './logs.mjs'+import { currentRootOf, driveOf, formatBytes, freeSpace, isEmptyTree, pickFrom, placeOf, rootOf } from './place.mjs'import { createShell, SHELL_TEXT } from './shell.mjs'-import { UPDATE_TEXT, watchReleases, watchUpdates } from './updates.mjs'+import { readStartFrame, writeStartFrame } from './start-frame.mjs'+import { explainOf, StartWindow } from './start-window.mjs'+import { langOf } from './start/text.mjs'import { createDeferredPrompt } from './update-prompt.mjs'import { CAPTION_HEIGHT, cssColor, micaAvailable, nativeThemeSource } from './window-frame.mjs'@@@ -42,11 -47,10 +43,12 @@@ const IPC =}// A cookie export larger than this is not a cookie export.const IMPORT_FILE_MAX = 32 * 1024 * 1024-const MOVE_PROBLEMS = { drive: 'moveDrive', nested: 'moveNested', workspace: 'moveWorkspace', program: 'inProgram', notEmpty: 'moveNotEmpty' }+const MOVE_PROBLEMS = { drive: 'dialog.move.drive', nested: 'dialog.move.nested', workspace: 'dialog.move.workspace', program: 'dialog.move.inProgram', notEmpty: 'dialog.move.notEmpty' }+ const CHOOSING_QUIT_WAIT_MS = 1_000const UPDATE_CHECK_WAIT_MS = 15_000const UPDATE_DOWNLOAD_WAIT_MS = 15 * 60_000+// Under this, the start page notes the drive's free space for the first 10 s (onboarding §3).+const SHORT_DRIVE_BYTES = 5e9const here = dirname(fileURLToPath(import.meta.url))const assets = join(here, '..', 'assets')@@@ -57,22 -61,9 +59,23 @@@ const iconFile = join(assets, process.pconst trayIconFile = () => join(assets, process.platform === 'win32' ? 'tray.ico' : process.platform === 'darwin' ? 'trayTemplate.png' : 'tray.png')// Windows 11 draws Mica behind the page; mica.css lets it through the sidebar.const mica = micaAvailable(process.platform, release())+ configureIdentity(app)+if (process.env.DS_BOT_SHELL_DATA) app.setPath('userData', process.env.DS_BOT_SHELL_DATA)+const frameFile = join(app.getPath('userData'), 'start-frame.json')++// Loaded once the start window is up (loadModules).+let BotBrowserGuests, partitionOf, BotViews, isBotId, importFromBrowser, listSources, applyCookies, CookieImports, parseCookieFile+let downloadSaver, chooseLocations, defaultPlaces, pickRoot, programFolder, saveLocations, teamIn, teamsAt, tx, HostProcess+let copySessions, findTeam, importTeam, teamInUse, userDshHome, copyData, moveProblem, CHECK_PROFILE, PROFILE+let watchReleases, watchUpdates, getDshRuntimeVersion, electronUpdaterlet mainWindow+// Settles once the hidden team window exists.+let mainCreated+let startWindow+let logs+// Writers to the console that bypass the log: the Host's output goes into the log on its own.+let rawOutputlet host// The Host's loopback origin, which the window loads.let origin@@@ -156,27 -137,7 +159,27 @@@ if (canonical !== undefined)} else if (!app.requestSingleInstanceLock()) {app.exit(0)} else {- app.on('second-instance', () => { shell.open() })+ logs = new LogFile({ dir: join(app.getPath('userData'), 'logs') })+ rawOutput = captureStdio(logs)+ app.once('will-quit', () => { logs.flush() })- console.log(`DeepSeek Bot ${app.getVersion()} (${process.platform} ${process.arch}), Electron ${process.versions.electron}`)++ console.log(`DS Bot ${app.getVersion()} (${process.platform} ${process.arch}), Electron ${process.versions.electron}`)+ startWindow = new StartWindow({+ electron: { BrowserWindow, ipcMain, screen, shell: electronShell, clipboard, nativeTheme, systemPreferences },+ page: join(here, 'start', 'start.html'), preload: join(here, 'preload.cjs'), icon: iconFile, mica, devTools: !app.isPackaged,+ // On Windows the locale is known only once the app is ready.+ lang: () => langOf(app.getLocale()), motion: readStartFrame(frameFile).motion,+ version: app.getVersion(), program: [dirname(process.execPath), process.resourcesPath, app.getAppPath()], log: logs, mainWindow: () => mainWindow,+ onRetry: () => { retry().catch(fail) },+ onReload: () => { mainWindow?.webContents.reload() },+ // Closing the start window before the hand-off quits: there is no team window yet to stay in+ // the tray with.+ onClose: () => { app.quit() },+ onPick: () => { changePlace().catch(fail) },+ onAnswer: (value) => { placeAnswer(value).catch(fail) },+ })+ // A second launch shows the window that is showing: the start window until the hand-off+ // (also after a failed start), then the team window, built anew when it is gone.+ app.on('second-instance', () => { if (!startWindow.focus()) shell.open() })app.on('before-quit', (event) => {if (choosing !== undefined) {// A first-run dialog is open: the quit waits for it, and the app goes on meanwhile.@@@ -211,335 -176,61 +218,335 @@@ function stopHost()return hostStop}+// A throwaway run (DS_BOT_HOME) asks nothing and shows what a later start shows.+const startKind = () => (process.env.DS_BOT_HOME || existsSync(join(app.getPath('userData'), 'locations.json')) ? 'later' : 'first')+async function start() {- choosing = new AbortController()- const where = await chooseLocations(choosing.signal).finally(() => { choosing = undefined })- if (where.quit) { app.exit(0); return }- places = { dataDir: where.dataDir, workspace: where.workspace }- const port = await hostPort(join(app.getPath('userData'), 'host-port.json'))- origin = `http://127.0.0.1:${String(port)}`- const pnpm = join(app.getAppPath(), 'node_modules', 'pnpm', 'bin', 'pnpm.mjs')- const runtimeDir = app.isPackaged ? process.resourcesPath : join(here, '..', 'build', 'runtime')- const profileDir = join(where.dataDir, 'profiles', PROFILE)- mkdirSync(profileDir, { recursive: true })- const newHost = () => new HostProcess({- entry: join(here, 'host.mjs'),- cwd: profileDir,- env: { ...process.env, DSH_HOME: where.dataDir, DS_BOT_PORT: String(port), DS_BOT_APP: '1', DS_BOT_USER_DSH_HOME: userDshHome(), DS_BOT_RUNTIME_DIR: runtimeDir, ...(where.workspace ? { DS_BOT_WORKSPACE: where.workspace } : {}) },- pnpm,- onFailure: fail,+ setMenu()+ nativeTheme.themeSource = readStartFrame(frameFile).themeSource+ // A packaged app has the icon in its bundle; Electron's own run shows Electron's.+ if (process.platform === 'darwin' && !app.isPackaged) app.dock?.setIcon(iconFile)+ await prepare()+ run()+}++// What the boot needs; a retry after a failure here does what is still missing.+async function prepare() {+ // Before the windows: the team window's page is told the Host's origin.+ if (port === undefined) {+ port = await hostPort(join(app.getPath('userData'), 'host-port.json'))+ origin = `http://127.0.0.1:${String(port)}`+ }+ startWindow.open(startKind())+ if (browserGuests === undefined) {+ await loadModules()+ handleIpc()+ }+ // The team window is made once the start window has painted, already on its final rect, and+ // made again when it is gone for good (a cancelled shutdown kept the app without one), so+ // that the next engine has a window to load into.+ if (mainCreated === undefined || (await mainCreated, mainWindow === undefined)) mainCreated = startWindow.painted.then(createWindow)+}++async function loadModules() {+ const [browser, views, sources, cookies, cookieFiles, downloads, firstRun, hostProcess, imports, moves, profile, updatesModule, boot, updater] = await Promise.all([+ import('./bot-browser.mjs'), import('./bot-views.mjs'), import('./browser-sources.mjs'), import('./cookie-import.mjs'),+ import('./cookie-parse.mjs'), import('./downloads.mjs'), import('./first-run.mjs'), import('./host-process.mjs'),+ import('./import.mjs'), import('./move-data.mjs'), import('./profile.mjs'), import('./updates.mjs'),+ import('@deepseek-ai/dsh-app-boot'), import('electron-updater'),+ ])+ ;({ BotBrowserGuests, partitionOf } = browser)+ ;({ BotViews, isBotId } = views)+ ;({ importFromBrowser, listSources } = sources)+ ;({ applyCookies, CookieImports } = cookies)+ ;({ parseCookieFile } = cookieFiles)+ ;({ downloadSaver } = downloads)+ ;({ chooseLocations, defaultPlaces, pickRoot, programFolder, saveLocations, teamIn, teamsAt, tx } = firstRun)+ ;({ HostProcess } = hostProcess)+ ;({ copySessions, findTeam, importTeam, teamInUse, userDshHome } = imports)+ ;({ copyData, moveProblem } = moves)+ ;({ CHECK_PROFILE, PROFILE } = profile)+ ;({ watchReleases, watchUpdates } = updatesModule)+ ;({ getDshRuntimeVersion } = boot)+ electronUpdater = updater.default+ browserGuests = new BotBrowserGuests({ session, origin: () => origin, devTools: !app.isPackaged })+ botViews = new BotViews({+ window: () => mainWindow, WebContentsView, guests: browserGuests, origin: () => origin, devTools: !app.isPackaged,+ statePath: join(app.getPath('userData'), 'bot-views.json'),+ onChange: state => mainWindow?.webContents.send(IPC.browserViewChanged, state),})- // A failed check is not a failed start: start() rejects, and the copy goes on unchecked.- const newCheck = (home, list) => {- const cwd = join(home, 'profiles', CHECK_PROFILE)- mkdirSync(cwd, { recursive: true })- return new HostProcess({ entry: join(here, 'host.mjs'), cwd, env: { ...process.env, DSH_HOME: home, DS_BOT_CHECK: list, DS_BOT_RUNTIME_DIR: runtimeDir }, pnpm, onFailure: () => {} })+ cookieImports = new CookieImports()+}++function run() {+ const mine = (attempt += 1)+ boot(mine).catch((error) => { if (mine === attempt) void fail(error) })+}++// The engine starts again after a failure or the 180 s question; the places stay. A first run's+// copy goes on to its end first: an engine started beside it would run on a half-copied team.+async function retry() {+ const mine = (attempt += 1)+ forgetHost()+ failed = false+ proposed = undefined+ restarting = true+ try {+ await copying?.catch(() => {})+ if (copyAbort.signal.aborted || stopping || mine !== attempt) return+ await stopOld()+ if (stopping || mine !== attempt) return+ await prepare()+ } finally {+ restarting = false}- const ready = (async () => {- let copied- if (where.import) {- copying = copyTeam(where, newHost, newCheck, copyAbort.signal)- copied = await copying- copying = undefined+ if (!stopping && mine === attempt) run()+}++// The handshake of the Host that goes: a window rebuilt before the next engine answers must not+// load against a Host that is stopped, nor take its cookie for the new one's.+function forgetHost() {+ hostReady = false+ bootstrap = undefined+}++// The Host stays known while it stops, so that a quit meanwhile waits for it.+async function stopOld(options) {+ const old = host+ if (old === undefined) return+ await old.stop(options).catch((error) => { console.error(error) })+ if (host === old) host = undefined+}++// The dialogs of the first run belong to the start window and stop its clock.+const ui = () => ({ owner: () => startWindow.owner(), asking: answer => startWindow.asking(answer) })++// The data folder (with the first run's question on a first start), the engine, then the team+// view in the hidden team window.+async function boot(mine) {+ if (places === undefined) {+ const first = startWindow.kind === 'first'+ if (first) {+ const teams = teamsAt()+ startWindow.explain(explainOf(teams))+ // A reinstall goes on with its data where it is; a new or copied team can still move.+ if (teams.team === undefined) tellPlace(defaultPlaces().dataDir)}+ choosing = new AbortController()+ const where = await chooseLocations(choosing.signal, ui()).finally(() => { choosing = undefined })+ if (where.quit) { app.exit(0); return }+ setPlaces({ dataDir: where.dataDir, workspace: where.workspace })+ pendingImport = where.import+ if (first) startWindow.explain(explainOf({ offered: where.offered === true, team: teamIn(where.dataDir) }))+ }+ // Also the check that the data folder can be written.+ mkdirSync(profileDir(), { recursive: true })+ startWindow.done('data')+ const engine = await startEngine(mine)+ if (engine === undefined || mine !== attempt) return+ startWindow.done('engine')+ await mainCreated+ if (mine !== attempt || mainWindow === undefined) return+ startWindow.teamLoading()+ // The launch URL trades its token for the Host's cookie and goes on to the page. The cookie+ // is there once that load came through. The token is good for one browser only: it is spent+ // as soon as a window carries it. Each engine has a token of its own.+ const win = mainWindow+ launchUrl = engine.url+ tokenSpent = true+ hostReady = false+ bootstrap = win.loadURL(engine.url).then(() => {+ if (mine === attempt) hostReady = true+ return true+ }).catch(() => false)+}++function setPlaces(next) {+ places = next+ const root = currentRootOf(places.dataDir, places.workspace)+ made = { dataDir: !existsSync(places.dataDir), workspace: places.workspace !== undefined && !existsSync(places.workspace), root: root !== undefined && !existsSync(root) }+}++// The line on the start page that says where the data goes and how much room is there, and the+// short drive's note for the first 10 s (start-window §2, §4).+function tellPlace(dataDir) {+ const free = freeSpace(dataDir)+ startWindow.place(placeOf(dataDir, { free }))+ const drive = driveOf(dataDir)+ startWindow.hint(drive !== undefined && free !== undefined && free < SHORT_DRIVE_BYTES ? { drive, free: formatBytes(free) } : undefined)+}++// 「换个位置…」 on the start page and 〔重新选〕 on its cards: the system picker, then the root rule+// (windows-onboarding §3, 一个位置). The root is used at once when it is the folder picked; a+// layer the app added is confirmed on the 「会放在…」 card; a place that cannot be used says why.+// A cancelled picker leaves things as they were: the line, or the card it came from. Not during+// the first run's copy, whose team would be left behind.+async function changePlace() {+ if (startWindow.kind !== 'first' || places === undefined || choosing !== undefined || copying !== undefined || picking || restarting || stopping || failed) return+ picking = true+ try {+ // One wait for the picker and what follows it: a team view that becomes ready meanwhile+ // hands over only once the start knows where it goes on.+ await startWindow.asking(pickAndPlace())+ } finally {+ picking = false+ }+}++// A cancelled picker, or the place the data is in now, is no change: the line stays, and a card+// that led here goes, since the start goes on where it was.+async function pickAndPlace() {+ const picked = await pickRoot(pickFrom(places.dataDir), copyAbort.signal, ui())+ if (stopping || startWindow.owner() === undefined) return+ const root = picked === undefined ? { same: true } : rootOf(picked, { dshHome: userDshHome(), program: app.isPackaged ? programFolder() : undefined, current: places })+ if (root.same) {+ proposed = undefined+ startWindow.card(undefined)+ return+ }+ if (root.reason !== undefined) {- console.log(`DeepSeek Bot: the place ${root.at} cannot be used (${root.reason})`)++ console.log(`DS Bot: the place ${root.at} cannot be used (${root.reason})`)+ proposed = undefined+ startWindow.card({ kind: 'rejected', reason: root.reason, path: root.at })+ return+ }+ if (root.added) {+ proposed = root+ startWindow.card({ kind: 'picked', path: root.root })+ return+ }+ await startOver(root)+}++async function placeAnswer(value) {+ if (value !== 'use' || proposed === undefined || picking || restarting) return+ const root = proposed+ proposed = undefined+ await startOver(root)+}++// The start begins again in the root R (start-window §7): the whale sinks at once, the engine+// that may be up on the default folder stops, what this start made there goes, and the boot runs+// again. The places are saved at once: the import question has been answered by now.+async function startOver(root) {+ const mine = (attempt += 1)+ forgetHost()+ failed = false+ proposed = undefined+ restarting = true+ try {+ // restart() also takes the card away, without letting a held hand-off of the old engine go;+ // the line names the new place from here on. The Host on the old folder is ended at once:+ // neither its boot nor an orderly shutdown of a folder about to go is of any use, and either+ // would keep the whale under water for up to 10 s.+ startWindow.restart()+ tellPlace(root.dataDir)+ await stopOld({ now: true })+ if (stopping || mine !== attempt) return+ await removeMade()+ if (stopping || mine !== attempt) return+ setPlaces({ dataDir: root.dataDir, workspace: root.workspace })+ saveLocations(places)- console.log(`DeepSeek Bot: the data goes to ${places.dataDir}`)++ console.log(`DS Bot: the data goes to ${places.dataDir}`)+ } finally {+ restarting = false+ }+ run()+}++// What this start made at the place it leaves: the data folder it created (the engine may have+// put a blank team there), the team workspace while nothing has been written into it, and the+// root above them once it is empty.+async function removeMade() {+ const gone = []+ if (made.dataDir && existsSync(places.dataDir)) gone.push(places.dataDir)+ if (made.workspace && existsSync(places.workspace) && isEmptyTree(places.workspace)) gone.push(places.workspace)+ for (const folder of gone) await rm(folder, { recursive: true, force: true, maxRetries: 5 }).catch((error) => { console.error(error) })+ const root = currentRootOf(places.dataDir, places.workspace)+ if (made.root && root !== undefined && existsSync(root) && isEmptyTree(root)) await rm(root, { recursive: true, force: true, maxRetries: 5 }).catch((error) => { console.error(error) })+}++const profileDir = () => join(places.dataDir, 'profiles', PROFILE)+const pnpmEntry = () => join(app.getAppPath(), 'node_modules', 'pnpm', 'bin', 'pnpm.mjs')+const hostOutput = (stream, chunk) => {+ logs.write('engine', chunk)+ rawOutput[stream](chunk)+}++function newHost() {+ // A Host of an attempt that a retry has replaced no longer stands for the start.+ const mine = attempt+ return new HostProcess({+ entry: join(here, 'host.mjs'),+ cwd: profileDir(),+ env: { ...process.env, DSH_HOME: places.dataDir, DS_BOT_PORT: String(port), DS_BOT_APP: '1', DS_BOT_USER_DSH_HOME: userDshHome(), DS_BOT_RUNTIME_DIR: app.isPackaged ? process.resourcesPath : join(here, '..', 'build', 'runtime'), ...(places.workspace ? { DS_BOT_WORKSPACE: places.workspace } : {}) },+ pnpm: pnpmEntry(),+ onFailure: (error) => { if (mine === attempt) void fail(error) },+ output: hostOutput,+ })+}++// A failed check is not a failed start: start() rejects, and the copy goes on unchecked.+function newCheck(home, list) {+ const cwd = join(home, 'profiles', CHECK_PROFILE)+ mkdirSync(cwd, { recursive: true })+ return new HostProcess({ entry: join(here, 'host.mjs'), cwd, env: { ...process.env, DSH_HOME: home, DS_BOT_CHECK: list }, pnpm: pnpmEntry(), onFailure: () => {}, output: hostOutput })+}++/**+ * @returns {Promise<{ url: string } | undefined>} the Host's launch URL; none when the app quits+ * during the copy, or when a retry during the copy starts the engine itself+ */+async function startEngine(mine) {+ if (pendingImport !== undefined) {+ const where = { ...places, import: pendingImport }+ pendingImport = undefined+ // The team is about to live here; moving it is Settings' job (the data move).+ startWindow.place(undefined)+ // The copy's time is not the engine's: the start's clock stands still, and the 180 s+ // question with it.+ copying = startWindow.asking(copyTeam(where, copyAbort.signal))+ const copied = await copying+ copying = undefinedif (copied === 'quit') app.exit(0)- // The window may be waiting for the Host; it goes away with the app.- if (copied !== undefined) return new Promise(() => {})- // Not during the import, which a restart would cut short; before the Host, so that an- // update can still come when this version's Host does not start.+ if (copied !== undefined || mine !== attempt) return undefined+ }+ // Not during the import, which a restart would cut short; before the Host, so that an+ // update can still come when this version's Host does not start.+ if (!updatesStarted) {+ updatesStarted = trueupdates = startUpdates()updates?.subscribe((state) => { mainWindow?.webContents.send(IPC.appUpdateChanged, state) })- host = newHost()- host.onMessage(message => {- if (message?.type !== 'ds-bot:browser-endpoint' || typeof message.id !== 'string' || !isBotId(message.botId)) return- const downloadRoots = message.downloadRoots- if (!Array.isArray(downloadRoots) || downloadRoots.length > 4 || !Array.from(downloadRoots).every(root => typeof root === 'string' && isAbsolute(root))) {- host?.send({ type: 'ds-bot:browser-endpoint-response', id: message.id, error: 'Could not create the browser endpoint.' })- return- }- void botViews.endpoint(message.botId, { downloadRoots }).then(url => {- host?.send({ type: 'ds-bot:browser-endpoint-response', id: message.id, url })- }).catch(() => host?.send({ type: 'ds-bot:browser-endpoint-response', id: message.id, error: 'Could not create the browser endpoint.' }))- })- return host.start()- })()- ready.catch(fail)+ }+ host = newHost()+ host.onMessage(message => {+ if (message?.type !== 'ds-bot:browser-endpoint' || typeof message.id !== 'string' || !isBotId(message.botId)) return+ const downloadRoots = message.downloadRoots+ if (!Array.isArray(downloadRoots) || downloadRoots.length > 4 || !Array.from(downloadRoots).every(root => typeof root === 'string' && isAbsolute(root))) {+ host?.send({ type: 'ds-bot:browser-endpoint-response', id: message.id, error: 'Could not create the browser endpoint.' })+ return+ }+ void botViews.endpoint(message.botId, { downloadRoots }).then(url => {+ host?.send({ type: 'ds-bot:browser-endpoint-response', id: message.id, url })+ }).catch(() => host?.send({ type: 'ds-bot:browser-endpoint-response', id: message.id, error: 'Could not create the browser endpoint.' }))+ })+ return host.start()+}++function handleIpc() {// A throwaway run (DS_BOT_HOME) keeps its folders where it was told.const fixed = Boolean(process.env.DS_BOT_HOME)+ // The team view has mounted (ds-bot calls dsBotApp.ready()): the start window hands over.+ ipcMain.on(IPC.ready, (event) => { if (fromWindow(event)) startWindow.ready() })+ // The start window takes the app's theme and the Bot animation tier at the next start, before+ // the team view has loaded; Mica and the caption buttons follow the theme at once.+ ipcMain.on(IPC.nativeTheme, (event, source) => {+ const value = nativeThemeSource(source)+ if (!fromWindow(event) || value === undefined) return+ nativeTheme.themeSource = value+ writeStartFrame(frameFile, { themeSource: value })+ })+ ipcMain.on(IPC.motion, (event, tier) => { if (fromWindow(event)) writeStartFrame(frameFile, { motion: tier }) })ipcMain.handle(IPC.dataLocation, (event) => {assertWindow(event)return { path: places.dataDir, fixed }@@@ -670,13 -380,14 +677,13 @@@ const setProgress = (value) => { owner(// without the copied Sessions' folders, so the old team's folders are not offered as projects.// Before that, the app's own DSH reads every chat of the team once: a newer DSH can write// records that this one refuses while the log format stays the same. Such a chat stops the- // copy, as a newer log format does; 'quit' means the user updates DeepSeek Bot first, and+ // copy, as a newer log format does; 'quit' means the user updates DS Bot first, and// 'stopped' that the app quit during the copy.-async function copyTeam(where, newHost, newCheck, signal) {- const unreadable = await checkTeam(where, newCheck, signal)+async function copyTeam(where, signal) {+ const unreadable = await checkTeam(where, signal)if (signal.aborted) return 'stopped'if (unreadable > 0) {- const { response } = await startWindow.asking(dialog.showMessageBox(owner(), { type: 'warning', title: 'DeepSeek Bot', noLink: true, message: tx('dialog.import.newer', { n: unreadable }), buttons: [tx('btn.quit'), tx('btn.startWithout')], defaultId: 0, cancelId: 0, signal }))- const t = text()- const { response } = await dialog.showMessageBox({ type: 'warning', title: 'DS Bot', noLink: true, message: t.newer(unreadable), buttons: [t.quit, t.startEmpty], defaultId: 0, cancelId: 0, signal })++ const { response } = await startWindow.asking(dialog.showMessageBox(owner(), { type: 'warning', title: 'DS Bot', noLink: true, message: tx('dialog.import.newer', { n: unreadable }), buttons: [tx('btn.quit'), tx('btn.startWithout')], defaultId: 0, cancelId: 0, signal }))if (signal.aborted) return 'stopped'if (response === 0) return 'quit'saveLocations(where)@@@ -697,7 -408,7 +704,7 @@@} catch (error) {if (signal.aborted) return 'stopped'console.error(error)- await startWindow.asking(dialog.showMessageBox(owner(), { type: 'warning', title: 'DeepSeek Bot', message: tx('dialog.import.failed', { message: error instanceof Error ? error.message : String(error) }), signal }))- await dialog.showMessageBox({ type: 'warning', title: 'DS Bot', message: text().failed(error instanceof Error ? error.message : String(error)), signal })++ await startWindow.asking(dialog.showMessageBox(owner(), { type: 'warning', title: 'DS Bot', message: tx('dialog.import.failed', { message: error instanceof Error ? error.message : String(error) }), signal }))if (signal.aborted) return 'stopped'} finally {signal.removeEventListener('abort', stopWarm)@@@ -734,10 -445,10 +741,10 @@@ async function checkTeam(where, signalawait check.stop()}} catch (error) {- if (!signal.aborted) console.error('DeepSeek Bot: the chats were not checked before the copy:', error)+ if (!signal.aborted) console.error('DS Bot: the chats were not checked before the copy:', error)return 0} finally {- mainWindow?.setProgressBar(-1)+ setProgress(-1)await rm(home, { recursive: true, force: true, maxRetries: 5 }).catch((error) => { console.error(error) })}}@@@ -755,13 -468,13 +762,13 @@@ async function moveData(workspace)for (const current of new Set([workspace, places.workspace])) {const problem = moveProblem({ from: places.dataDir, to, workspace: current, dshHome, program: app.isPackaged ? programFolder() : undefined })if (problem === undefined) continue- await dialog.showMessageBox(owner(), { type: 'warning', title: 'DeepSeek Bot', message: problem === 'dsh' ? tx('dialog.move.inDsh', { home: dshHome }) : tx(MOVE_PROBLEMS[problem]), buttons: [tx('btn.ok')] })- await dialog.showMessageBox(owner, { type: 'warning', title: 'DS Bot', message: problem === 'dsh' ? t.inDsh(dshHome) : t[MOVE_PROBLEMS[problem]], buttons: ['OK'] })++ await dialog.showMessageBox(owner(), { type: 'warning', title: 'DS Bot', message: problem === 'dsh' ? tx('dialog.move.inDsh', { home: dshHome }) : tx(MOVE_PROBLEMS[problem]), buttons: [tx('btn.ok')] })return true}return false}if (await refused()) return false- const { response } = await dialog.showMessageBox(owner(), { type: 'question', title: 'DeepSeek Bot', noLink: true, message: tx('dialog.move.confirm', { to }), detail: tx('dialog.move.detail', { from: places.dataDir }), buttons: [tx('btn.move'), tx('btn.cancel')], defaultId: 0, cancelId: 1 })- const { response } = await dialog.showMessageBox(owner, { type: 'question', title: 'DS Bot', noLink: true, message: t.moveConfirm(to), detail: t.moveDetail(places.dataDir), buttons: [t.move, t.cancel], defaultId: 0, cancelId: 1 })++ const { response } = await dialog.showMessageBox(owner(), { type: 'question', title: 'DS Bot', noLink: true, message: tx('dialog.move.confirm', { to }), detail: tx('dialog.move.detail', { from: places.dataDir }), buttons: [tx('btn.move'), tx('btn.cancel')], defaultId: 0, cancelId: 1 })if (response !== 0 || stopping || await refused()) return falseconst signal = copyAbort.signalcopying = (async () => {@@@ -778,7 -488,7 +785,7 @@@}// Another DSH on the same data would go on writing while the copy is made.if (teamInUse(places.dataDir)) {- await dialog.showMessageBox(owner(), { type: 'warning', title: 'DeepSeek Bot', message: tx('dialog.move.inUse') })- await dialog.showMessageBox({ type: 'warning', title: 'DS Bot', message: t.moveInUse })++ await dialog.showMessageBox(owner(), { type: 'warning', title: 'DS Bot', message: tx('dialog.move.inUse') })app.relaunch()return}@@@ -795,9 -505,9 +802,9 @@@} catch (error) {if (signal.aborted) returnconsole.error(error)- await dialog.showMessageBox(owner(), { type: 'warning', title: 'DeepSeek Bot', message: tx('dialog.move.failed', { message: error instanceof Error ? error.message : String(error) }) })- await dialog.showMessageBox({ type: 'warning', title: 'DS Bot', message: t.moveFailed(error instanceof Error ? error.message : String(error)) })++ await dialog.showMessageBox(owner(), { type: 'warning', title: 'DS Bot', message: tx('dialog.move.failed', { message: error instanceof Error ? error.message : String(error) }) })} finally {- mainWindow?.setProgressBar(-1)+ setProgress(-1)}app.relaunch()})()@@@ -845,19 -558,20 +852,19 @@@ function windowShown()return mainWindow !== undefined && !mainWindow.isDestroyed() && mainWindow.isVisible() && !mainWindow.isMinimized()}+// The update questions wait for the team window: the start window goes at the hand-off, and a+// question on it would go with it. After a failed start, fail() takes the update over.+const afterHandoff = async () => { await startWindow.teamShown; return !failed }+async function askRestartNow(version) {- // After a failed start, fail() installs the update itself.- if (failed) return false- const t = localeText(UPDATE_TEXT)- const options = { type: 'info', title: 'DS Bot', message: t.ready(version), detail: t.readyDetail, buttons: [t.restart, t.later], defaultId: 0, cancelId: 1, noLink: true }- const { response } = await (mainWindow ? dialog.showMessageBox(mainWindow, options) : dialog.showMessageBox(options))+ if (failed || !await afterHandoff()) return false- const { response } = await dialog.showMessageBox(owner(), { type: 'info', title: 'DeepSeek Bot', message: tx('dialog.update.ready', { version }), detail: tx('dialog.update.readyDetail'), buttons: [tx('btn.restart'), tx('btn.notNowRestart')], defaultId: 0, cancelId: 1, noLink: true })++ const { response } = await dialog.showMessageBox(owner(), { type: 'info', title: 'DS Bot', message: tx('dialog.update.ready', { version }), detail: tx('dialog.update.readyDetail'), buttons: [tx('btn.restart'), tx('btn.notNowRestart')], defaultId: 0, cancelId: 1, noLink: true })return response === 0}async function askDownloadNow(version) {- if (failed) return false- const t = localeText(UPDATE_TEXT)- const options = { type: 'info', title: 'DS Bot', message: t.available(version), detail: t.availableDetail, buttons: [t.download, t.later], defaultId: 0, cancelId: 1, noLink: true }- const { response } = await (mainWindow ? dialog.showMessageBox(mainWindow, options) : dialog.showMessageBox(options))+ if (failed || !await afterHandoff()) return false- const { response } = await dialog.showMessageBox(owner(), { type: 'info', title: 'DeepSeek Bot', message: tx('dialog.update.available', { version }), detail: tx('dialog.update.availableDetail'), buttons: [tx('btn.download'), tx('btn.notNowDownload')], defaultId: 0, cancelId: 1, noLink: true })++ const { response } = await dialog.showMessageBox(owner(), { type: 'info', title: 'DS Bot', message: tx('dialog.update.available', { version }), detail: tx('dialog.update.availableDetail'), buttons: [tx('btn.download'), tx('btn.notNowDownload')], defaultId: 0, cancelId: 1, noLink: true })return response === 0}@@@ -887,8 -600,8 +894,8 @@@ function createWindow()const win = new BrowserWindow({// The window never squeezes the chat: RAIL_WIDTH + MIN_CHAT from ds-bot's// src/client/frame-layout.js is the avatar rail plus the smallest chat column.- width: 1320, height: 860, minWidth: 508, minHeight: 480,+ ...startWindow.mainBounds(), minWidth: 508, minHeight: 480,- title: 'DeepSeek Bot', show: false, icon: iconFile,+ title: 'DS Bot', show: false, icon: iconFile,backgroundColor: mica ? '#00000000' : dark ? '#1b1b1c' : '#ffffff',// Frameless as in DSH Desktop: the caption buttons overlay the page's band. They keep the// sidebar's colors until the page sends the colors of the surface under them.@@@ -1082,14 -789,22 +1089,14 @@@ async function fail(error)console.error(error)if (failed || stopping) returnfailed = true+ const mine = attempt+ startWindow.fail(error, startKind())const found = await Promise.race([updates?.latest() ?? null, sleep(UPDATE_CHECK_WAIT_MS).then(() => null)])- const throwaway = Boolean(process.env.DS_BOT_HOME)- const t = localeText(UPDATE_TEXT)- const next = found ? `\n\n${found.page ? t.onFailurePage(found.version) : t.onFailure(found.version)}` : ''- dialog.showErrorBox('DS Bot', `${text().notStarted}\n\n${error instanceof Error ? error.message : String(error)}${next}`)- if (found?.page) {- if (!throwaway) await electronShell.openExternal(found.page)- app.quit()+ if (!found || mine !== attempt) return- await dialog.showMessageBox(owner(), { type: 'info', title: 'DeepSeek Bot', message: tx(found.page ? 'dialog.update.onFailurePage' : 'dialog.update.onFailure', { version: found.version }) })++ await dialog.showMessageBox(owner(), { type: 'info', title: 'DS Bot', message: tx(found.page ? 'dialog.update.onFailurePage' : 'dialog.update.onFailure', { version: found.version }) })+ if (found.page) {+ if (!process.env.DS_BOT_HOME) await electronShell.openExternal(found.page)return}- if (found) {- mainWindow?.hide()- if (await Promise.race([found.downloaded, sleep(UPDATE_DOWNLOAD_WAIT_MS).then(() => false)])) {- await updates.install()- return- }- }- app.quit()+ if (await Promise.race([found.downloaded, sleep(UPDATE_DOWNLOAD_WAIT_MS).then(() => false)]) && failed && mine === attempt) await updates.install()}diff --cc app/src/place.mjsindex cd87b9a9,00000000..c4d0aa6cmode 100644,000000..100644--- a/app/src/place.mjs+++ b/app/src/place.mjs@@@ -1,183 -1,0 +1,183 @@@+// Where a first start puts the data: the line on the start page that says so, and the root rule+// of 「换个位置…」 (windows-onboarding §3, 一个位置; start-window §6). No Electron here, so the+// tests run without it.+import { existsSync, mkdirSync, readdirSync, rmdirSync, rmSync, statfsSync, statSync, writeFileSync } from 'node:fs'+import { homedir } from 'node:os'+import { basename, dirname, join, parse, resolve, sep } from 'node:path'+import { real, within } from './copy-tree.mjs'++export const DATA_DIR = 'data'+export const WORKSPACE_DIR = 'workspace'+// The layer the app adds inside a drive or a folder that is someone else's.- export const LAYER = 'DeepSeek Bot'++export const LAYER = 'DS Bot'++/** Free bytes on the volume that holds `path`, measured at its nearest existing ancestor. */+export function freeSpace(path) {+ let at = resolve(path)+ for (;;) {+ if (existsSync(at)) {+ try {+ const stats = statfsSync(at)+ return Number(stats.bavail) * Number(stats.bsize)+ } catch {+ return undefined+ }+ }+ const up = dirname(at)+ if (up === at) return undefined+ at = up+ }+}++/** Bytes as the page shows them, in Explorer's units of 1024: whole GB from 10 up, else one decimal. */+export function formatBytes(bytes) {+ if (typeof bytes !== 'number' || !Number.isFinite(bytes) || bytes < 0) return undefined+ const gb = bytes / 2 ** 30+ if (gb >= 10) return `${String(Math.floor(gb))} GB`+ if (gb >= 1) return `${(Math.floor(gb * 10) / 10).toFixed(1)} GB`+ return `${String(Math.floor(bytes / 2 ** 20))} MB`+}++/** The drive letter of a Windows path ('C'), or undefined. */+export function driveOf(path) {+ const match = /^([A-Za-z]):[\\/]/u.exec(resolve(path))+ return match ? match[1].toUpperCase() : undefined+}++/** A path with the home folder written as ~, for the page. */+export function shortPath(path, home = homedir()) {+ const full = resolve(path)+ const base = resolve(home)+ if (full === base) return '~'+ return within(full, base) ? `~${sep}${full.slice(base.length).replace(/^[\\/]+/u, '')}` : full+}++/**+ * What the start page says about the place of the data: the drive and its free space on+ * Windows, the folder elsewhere.+ * @param {{ home?: string, free?: number }} what `free` from freeSpace(); none leaves it out+ * @returns {{ drive?: string, path?: string, free?: string }}+ */+export function placeOf(dataDir, { home = homedir(), free } = {}) {+ const drive = driveOf(dataDir)+ const place = drive === undefined ? { path: shortPath(dataDir, home) } : { drive }+ const text = formatBytes(free)+ return text === undefined ? place : { ...place, free: text }+}++/** The root R of places made by the root rule (R\data beside R\workspace); the default places have none. */+export function currentRootOf(dataDir, workspace) {+ if (typeof dataDir !== 'string' || typeof workspace !== 'string') return undefined+ const root = dirname(resolve(dataDir))+ if (basename(resolve(dataDir)) !== DATA_DIR || basename(resolve(workspace)) !== WORKSPACE_DIR || dirname(resolve(workspace)) !== root) return undefined+ return root+}++/** The picker starts from the current data folder's parent (windows-onboarding §3). */+export const pickFrom = dataDir => dirname(resolve(dataDir))++/** A folder with nothing but empty folders in it. */+export function isEmptyTree(folder) {+ try {+ if (!statSync(folder).isDirectory()) return false+ return readdirSync(folder).every(name => isEmptyTree(join(folder, name)))+ } catch {+ return false+ }+}++// A folder that holds nothing but what the app itself puts into an empty root (the two+// folders of a start that never got further).+const ownEmpty = folder => readdirSync(folder).every(name => [DATA_DIR, WORKSPACE_DIR].includes(name) && isEmptyTree(join(folder, name)))++// OneDrive's folders: the roots it names in the environment, a folder called OneDrive or+// 「OneDrive - <organisation>」, and macOS's Library/CloudStorage/OneDrive-<name>. A folder that+// only has OneDrive in its name (OneDrive-old) is not the cloud.+function inOneDrive(path, env) {+ const roots = ['OneDrive', 'OneDriveConsumer', 'OneDriveCommercial'].map(name => env[name]).filter(value => typeof value === 'string' && value !== '')- if (roots.some(root => within(path, root))) return true++ if (roots.some(root => within(path, real(root)))) return true+ const parts = path.split(/[\\/]/u)+ return parts.some((part, k) => part === 'OneDrive' || part.startsWith('OneDrive - ') || (parts[k - 1] === 'CloudStorage' && part.startsWith('OneDrive-')))+}++const sameFolder = (a, b) => within(a, b) && within(b, a)++/**+ * The root R that a picked folder gives (windows-onboarding §3, 一个位置): the folder itself- * when it is new, empty, or an empty root of the app's own; otherwise `DeepSeek Bot` inside it,++ * when it is new, empty, or an empty root of the app's own; otherwise `DS Bot` inside it,+ * as inside a drive. The data goes to R\data and the Bots' files to R\workspace.+ * @param {string} picked+ * @param {{ dshHome?: string, program?: string, env?: NodeJS.ProcessEnv, probe?: boolean, current?: { dataDir: string, workspace?: string } }} where+ * `probe` writes a file into R\data to see that the place can be written (default true);+ * `current` names the places the data is in now+ * @returns {{ same: true } | { root: string, dataDir: string, workspace: string, added: boolean, reason?: 'permission' | 'onedrive' | 'foreign' | 'nested' | 'dsh' | 'program', at?: string }}+ * `same`: the place the data is in now was picked, which is no change; `reason` says why R+ * cannot be used, with the path `at` that the card names+ */+export function rootOf(picked, { dshHome, program, env = process.env, probe = true, current } = {}) {+ const chosen = resolve(picked)+ const places = root => ({ root, dataDir: join(root, DATA_DIR), workspace: join(root, WORKSPACE_DIR) })+ try {+ // The places the data is in now: the data folder, and the team workspace once something+ // is in it (an empty one, just made, can become the new root, as a pick of the home folder+ // proposes with the default places).+ const data = typeof current?.dataDir === 'string' ? real(current.dataDir) : undefined+ const workspace = typeof current?.workspace === 'string' && existsSync(current.workspace) && !isEmptyTree(current.workspace) ? real(current.workspace) : undefined+ const now = [data, workspace].filter(path => path !== undefined)+ const nowRoot = currentRootOf(current?.dataDir, current?.workspace)+ const physicalChosen = real(chosen)+ if ([data, nowRoot === undefined ? undefined : real(nowRoot)].some(path => path !== undefined && sameFolder(physicalChosen, path))) return { same: true }+ if (now.some(path => within(physicalChosen, path))) return { ...places(chosen), added: false, reason: 'nested', at: chosen }+ const isDrive = parse(chosen).root === chosen+ let root = chosen+ let added = false+ if (isDrive) {+ root = join(chosen, LAYER)+ added = true+ } else if (existsSync(chosen)) {+ if (!statSync(chosen).isDirectory()) return { ...places(root), added, reason: 'foreign', at: chosen }+ if (readdirSync(chosen).length > 0 && !ownEmpty(chosen)) {+ root = join(chosen, LAYER)+ added = true+ }+ }+ const result = { ...places(root), added }+ const reject = (reason, at = root) => ({ ...result, reason, at })+ // An added layer that is already someone else's folder cannot be used either.+ if (added && existsSync(root) && (!statSync(root).isDirectory() || (readdirSync(root).length > 0 && !ownEmpty(root)))) return reject('foreign')+ // The checks look through links and junctions at the folder as the file system has it.+ const physical = real(root)+ if (now.some(path => within(physical, path) || within(path, physical))) return reject('nested', chosen)+ if (inOneDrive(physical, env)) return reject('onedrive', chosen)+ if (dshHome !== undefined && existsSync(dshHome)) {+ const dsh = real(dshHome)+ if (within(physical, dsh) || within(dsh, physical)) return reject('dsh', chosen)+ }+ if (program !== undefined && within(physical, real(program))) return reject('program', chosen)+ if (probe && !canWrite(result.dataDir)) return reject('permission', chosen)+ return result+ } catch {+ // A folder that cannot be read (another user's, the system's) cannot be written either.+ return { ...places(chosen), added: false, reason: 'permission', at: chosen }+ }+}++// Makes only the missing layers, writes and removes a file, and removes what it made.+function canWrite(folder) {+ const made = []+ try {+ for (let at = resolve(folder); !existsSync(at); at = dirname(at)) {+ made.unshift(at)+ if (dirname(at) === at) break+ }+ mkdirSync(folder, { recursive: true })+ const file = join(folder, '.ds-bot-write-check')+ writeFileSync(file, '')+ rmSync(file)+ return true+ } catch {+ return false+ } finally {+ for (const at of [...made].reverse()) { try { rmdirSync(at) } catch { /* not empty: left as it is */ } }+ }+}diff --cc app/src/preload.cjsindex 28a7e7ec,72e37d74..ae70b508--- a/app/src/preload.cjs+++ b/app/src/preload.cjs@@@ -44,50 -26,10 +44,50 @@@ if (startPage !== undefined)if (fullscreen) root.dataset.fullscreen = 'true'else delete root.dataset.fullscreen})- const start = () => { frameless(caption.slice('--ds-bot-caption='.length), process.argv.includes('--ds-bot-mica')) }- // A preload runs before the document root exists.- if (document.readyState === 'loading') window.addEventListener('DOMContentLoaded', start, { once: true })- else start()+ loaded(() => { frameless(caption.slice('--ds-bot-caption='.length), process.argv.includes('--ds-bot-mica')) })+ }+}++// The app's theme (DSH's) and the Bot animation tier (ds-bot's), which the start window takes+// at the next start.+function reportLook() {+ const root = document.documentElement+ const sent = {}+ const send = (channel, value) => {+ if (value === null || value === sent[channel]) return+ sent[channel] = value+ ipcRenderer.send(channel, value)+ }+ const report = () => {+ send('ds-bot:native-theme', root.getAttribute('data-ds-theme-source'))+ send('ds-bot:motion', document.body?.getAttribute('data-bt-motion') ?? null)+ }+ const observer = new MutationObserver(report)+ observer.observe(root, { attributeFilter: ['data-ds-theme-source'] })+ if (document.body !== null) observer.observe(document.body, { attributeFilter: ['data-bt-motion'] })+ report()+}++// The main process sends the whole state on every change; a page that subscribes late, or again,+// gets the last one first.+function startBridge() {+ const listeners = new Set()+ let last+ const tell = (listener, state) => {- try { listener(state) } catch (error) { console.error('DeepSeek Bot: a start state listener failed', error) }++ try { listener(state) } catch (error) { console.error('DS Bot: a start state listener failed', error) }+ }+ ipcRenderer.on('ds-bot:start-state', (_event, state) => {+ last = state+ for (const listener of [...listeners]) tell(listener, state)+ })+ return {+ onState(listener) {+ if (typeof listener !== 'function') return () => {}+ listeners.add(listener)+ if (last !== undefined) tell(listener, last)+ return () => { listeners.delete(listener) }+ },+ act: (name, payload) => ipcRenderer.invoke('ds-bot:start-act', String(name), payload),}}diff --cc app/src/start-frame.mjsindex f3cc8445,00000000..34c4aea6mode 100644,000000..100644--- a/app/src/start-frame.mjs+++ b/app/src/start-frame.mjs@@@ -1,42 -1,0 +1,42 @@@+// What the start window needs before the team view has loaded: the theme source and the motion+// tier the team view reported last. Kept in the app's own userData, never in DSH_HOME or ~/.dsh+// (docs/plans/2026-10-26-start-window.md §3, §10).+import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs'+import { dirname } from 'node:path'++const THEMES = new Set(['light', 'dark', 'system'])+const MOTIONS = new Set(['quiet', 'normal', 'lively'])+const DEFAULTS = { themeSource: 'system', motion: 'normal' }++/** @returns {{ themeSource: 'light' | 'dark' | 'system', motion: 'quiet' | 'normal' | 'lively' }} */+export function readStartFrame(file) {+ let saved+ try {+ saved = JSON.parse(readFileSync(file, 'utf8'))+ } catch {+ return { ...DEFAULTS }+ }+ return {+ themeSource: THEMES.has(saved?.themeSource) ? saved.themeSource : DEFAULTS.themeSource,+ motion: MOTIONS.has(saved?.motion) ? saved.motion : DEFAULTS.motion,+ }+}++/** Keeps the values of `change` that are valid; returns whether the file changed. */+export function writeStartFrame(file, change) {+ const current = readStartFrame(file)+ const next = {+ themeSource: THEMES.has(change.themeSource) ? change.themeSource : current.themeSource,+ motion: MOTIONS.has(change.motion) ? change.motion : current.motion,+ }+ if (next.themeSource === current.themeSource && next.motion === current.motion) return false+ try {+ mkdirSync(dirname(file), { recursive: true })+ writeFileSync(`${file}.tmp`, `${JSON.stringify(next)}\n`)+ renameSync(`${file}.tmp`, file)+ return true+ } catch (error) {- console.error('DeepSeek Bot: the start window\'s theme was not saved:', error)++ console.error('DS Bot: the start window\'s theme was not saved:', error)+ return false+ }+}diff --cc app/src/start-window.mjsindex 0abebecd,00000000..b5ceefc8mode 100644,000000..100644--- a/app/src/start-window.mjs+++ b/app/src/start-window.mjs@@@ -1,755 -1,0 +1,755 @@@+// The start window (docs/plans/2026-10-26-start-window.md §1, §8, §11; windows-onboarding §3): the+// app's own small window that shows start/start.html while the engine boots. It holds the+// start's state and sends the page the whole of it on every change; at the end it grows into the+// team window's rect, and the hidden team window shows on the same rect. The rect maths, the+// growth, the snapshot and the checks are plain functions, so the tests run without Electron.+import { pathToFileURL } from 'node:url'+import { within } from './copy-tree.mjs'++export const START_STATE = 'ds-bot:start-state'+export const START_ACT = 'ds-bot:start-act'++export const START_SIZE = { width: 720, height: 540 }+export const SHORT_START_SIZE = { width: 720, height: 500 }+// Work areas lower than this get the short start window.+const SHORT_WORK_AREA = 588+export const MAIN_SIZE = { width: 1320, height: 860 }+export const PHASES = ['data', 'engine', 'team']+export const START_KINDS = ['first', 'later', 'moving']+export const WATCHDOG_MS = 180_000+export const TEAM_VIEW_MS = 20_000+// handoffShow + 160 ms: the growth, 300 ms in steps of about 14 ms; the start window goes+// 300 ms after the team window shows (§8).+export const GROWTH = { delay: 160, duration: 300, step: 14 }+export const DESTROY_AFTER_MS = 300+export const FAILURE_LINES = 200+// The DeepSeek theme's --bt-main and --bt-ink (ui-standard 2.1), as in start.css: the window's+// own background and caption symbols, which show before the page paints and where Mica is not.+const COLORS = { light: { main: '#fcfcfc', ink: '#141414' }, dark: { main: '#141414', ink: '#f2f2f2' } }+const CAPTION_HEIGHT = 40+const PAINT_WAIT_MS = 3000++// What the page may ask, and in which views (null: in any). The cards of later pull requests+// send other names, which are refused.+const ACT_VIEWS = {+ handoffShow: ['handoff'],+ handoffDone: ['handoff'],+ retry: ['failed', 'watchdog'],+ wait: ['watchdog'],+ reloadView: ['viewFailed'],+ // 「换个位置…」 on the page (also under the 180 s question), and the cards it leads to+ // (「会放在…」, a place that cannot be used).+ pick: ['boot', 'card', 'watchdog'],+ answer: ['card'],+ openLogs: null,+ copyDetails: null,+}+export const START_ACTS = Object.freeze(Object.keys(ACT_VIEWS))++/** Whether the main process takes this act from the start page in this view. */+export function acceptsAct(name, view) {+ if (typeof name !== 'string' || !Object.hasOwn(ACT_VIEWS, name)) return false+ const views = ACT_VIEWS[name]+ return views === null || views.includes(view)+}++/** Whether a frame shows exactly the start page that was loaded. */+export function isStartPage(frameUrl, loadedUrl) {+ try {+ const frame = new URL(frameUrl)+ return frame.protocol === 'file:' && frame.href === new URL(loadedUrl).href+ } catch {+ return false+ }+}++export const startUrl = (page, kind) => `${pathToFileURL(page).href}?start=${kind}`++/** The start window's content size on a display's work area. */+export const startSize = workArea => ({ ...(workArea.height < SHORT_WORK_AREA ? SHORT_START_SIZE : START_SIZE) })++export function centred(size, area) {+ return {+ x: area.x + Math.round((area.width - size.width) / 2),+ y: area.y + Math.round((area.height - size.height) / 2),+ width: size.width,+ height: size.height,+ }+}++/** A rect moved, and shrunk if it must be, to lie inside an area. */+export function clampInto(rect, area) {+ const width = Math.min(rect.width, area.width)+ const height = Math.min(rect.height, area.height)+ return {+ x: Math.min(Math.max(rect.x, area.x), area.x + area.width - width),+ y: Math.min(Math.max(rect.y, area.y), area.y + area.height - height),+ width,+ height,+ }+}++/** The team window's rect: centred on the start window, inside the work area. */+export function mainRect(start, area, size = MAIN_SIZE) {+ const x = Math.round(start.x + start.width / 2 - size.width / 2)+ const y = Math.round(start.y + start.height / 2 - size.height / 2)+ return clampInto({ x, y, width: size.width, height: size.height }, area)+}++/** CSS's cubic-bezier() as a function of the time fraction. */+export function cubicBezier(x1, y1, x2, y2) {+ const curve = (p1, p2) => {+ const c = 3 * p1+ const b = 3 * (p2 - p1) - c+ const a = 1 - c - b+ return s => ((a * s + b) * s + c) * s+ }+ const x = curve(x1, x2)+ const y = curve(y1, y2)+ return (t) => {+ if (t <= 0) return 0+ if (t >= 1) return 1+ // x is monotonic for control points inside [0, 1], so halving finds its parameter.+ let low = 0+ let high = 1+ for (let step = 0; step < 40; step += 1) {+ const mid = (low + high) / 2+ if (x(mid) < t) low = mid+ else high = mid+ }+ return y((low + high) / 2)+ }+}+export const GROWTH_EASING = cubicBezier(0.2, 0.7, 0.2, 1)++export function rectAt(from, to, progress) {+ const at = key => Math.round(from[key] + (to[key] - from[key]) * progress)+ return { x: at('x'), y: at('y'), width: at('width'), height: at('height') }+}++/** The rects of the growth, one per step; the last one is the target at the full duration. */+export function growthSteps(from, to, { duration, step } = GROWTH) {+ const steps = []+ for (let at = step; ; at += step) {+ const time = Math.min(at, duration)+ steps.push({ at: time, rect: rectAt(from, to, GROWTH_EASING(time / duration)) })+ if (time >= duration) return steps+ }+}++// When the page never sends handoffShow, the main process shows the team window itself. A first+// start and a celebrating hand-off take up to about 1.2 s, plus up to 600 ms of queued swimming.+export const fallbackMs = ({ start, celebrate }) => (start === 'first' || celebrate ? 2500 : 800)++// The five reasons of the failure page (windows-onboarding §3), most specific first: a Host+// that stopped says so and carries its own error output, which names the cause.+const REASONS = [+ ['permission', /\b(?:EACCES|EPERM)\b|permission denied|operation not permitted|access is denied/iu],+ ['space', /\b(?:ENOSPC|EDQUOT)\b|no space left|not enough space|disk (?:is )?full/iu],+ ['files', /\b(?:MODULE_NOT_FOUND|ERR_MODULE_NOT_FOUND)\b|cannot find (?:module|package)|could not load its own bundles|not a valid Win32 application|0xC0000135|3221225781/iu],+ ['engine', /DSH Host stopped|engine's web server/iu],+]++// Only a missing file of the program's own says that the install is incomplete: a data folder+// on a drive that is gone is missing too, and so is a workspace.+function missingOwnFile(error, text, program) {+ if (!/\bENOENT\b/u.test(text)) return false+ const paths = [error?.path, ...[...text.matchAll(/ENOENT: [^,\n]*, \w+ '([^'\n]+)'/gu)].map(match => match[1])]+ return paths.some(path => typeof path === 'string' && program.some(folder => within(path, folder)))+}++/**+ * @param {{ program?: string[] }} where `program`: the folders of the app's own files+ * @returns {'permission' | 'space' | 'files' | 'engine' | 'other'}+ */+export function failureReason(error, { program = [] } = {}) {+ const code = typeof error?.code === 'string' ? error.code : ''+ const message = error instanceof Error ? error.message : String(error ?? '')+ const text = `${code} ${message}`+ for (const [reason, pattern] of REASONS) {+ if (pattern.test(text) || (reason === 'files' && missingOwnFile(error, text, program))) return reason+ }+ return 'other'+}++// The Main Bot that a kept team's sidebar shows first (ds-bot's channel.js: mainBotIds[0]; an+// older state.json has mainBotId), whose name the greeting says on a reinstall.+export function mainBotName(state) {+ const id = Array.isArray(state?.mainBotIds) ? state.mainBotIds[0] : state?.mainBotId+ const name = typeof id === 'string' ? state.bots?.[id]?.name : undefined+ return typeof name === 'string' && name.trim() !== '' ? name.trim() : undefined+}++// What the hint row can prepare for. previewNotice: DSH shows its preview notice when the+// Session is ready and the main view has no non-empty Session (windows-onboarding §3, the row of+// the third stop), which a data folder without a team always has. A kept or copied team may have+// read it already, and the main process cannot tell before the team view has loaded.+export function explainOf({ offered = false, team } = {}) {+ if (offered) return { mode: 'import', nextStep: false, previewNotice: false }+ if (team !== undefined) {+ const name = mainBotName(team.team)+ return { mode: 'reinstall', bots: team.bots, groups: team.rooms, ...(name === undefined ? {} : { name }), nextStep: false, previewNotice: false }+ }+ return { mode: 'new', nextStep: true, previewNotice: true }+}++export const clockMs = (clock, now) => clock.base + (clock.running ? Math.max(0, now - clock.from) : 0)++/** The whole state the page gets: the page computes the elapsed time from clock.ms at clock.at. */+export function startSnapshot(state, now) {+ const snapshot = {+ v: 1,+ lang: state.lang,+ start: state.start,+ motion: state.motion,+ // Windows draws the caption buttons over the page's band; macOS and Linux a system title bar.+ frame: state.frame,+ view: state.view,+ phase: PHASES.find(phase => !state.done.includes(phase)) ?? 'team',+ done: PHASES.filter(phase => state.done.includes(phase)),+ clock: { ms: Math.round(clockMs(state.clock, now)), at: now, running: state.clock.running, rate: 1 },+ explain: { ...state.explain },+ celebrate: state.celebrate,+ }+ if (state.hint !== undefined) snapshot.hint = { ...state.hint }+ if (state.place !== undefined) snapshot.place = { ...state.place }+ if (state.card !== undefined) snapshot.card = { ...state.card }+ if (state.failure !== undefined) snapshot.failure = { reason: state.failure.reason, log: [...state.failure.log] }+ return snapshot+}+- export const detailsText = ({ version, platform, arch, reason, lines }) => [`DeepSeek Bot ${version} (${platform} ${arch})`, `reason: ${reason}`, '', ...lines].join('\n')++export const detailsText = ({ version, platform, arch, reason, lines }) => [`DS Bot ${version} (${platform} ${arch})`, `reason: ${reason}`, '', ...lines].join('\n')+- const note = message => { console.log(`DeepSeek Bot: start window: ${message}`) }++const note = message => { console.log(`DS Bot: start window: ${message}`) }+// The page sends a button's detail as { value }; anything else counts as none.+const valueOf = payload => (payload !== null && typeof payload === 'object' && typeof payload.value === 'string' ? payload.value.slice(0, 40) : undefined)++export class StartWindow {+ #o+ #window+ #url+ #painted = Promise.resolve()+ #state+ #explain = explainOf()+ #asks = 0+ #watchAt = WATCHDOG_MS+ #timers = {}+ #phaseAt = 0+ #readyAt = 0+ #showAt = 0+ #from+ #handing = false+ #revealed = false+ // Whether the engine of this attempt is up; the stages done say where the whale is, which a+ // retry never moves back.+ #engineUp = false+ // What a dialog of the window (the folder picker) or a card keeps waiting: the hand-off, which+ // would take the window and the dialog's owner away, and the 20 s check's verdict.+ #readyHeld = false+ #heldAt = 0+ #viewLate = false+ #teamShown+ #showTeam++ /**+ * @param {{+ * electron: { BrowserWindow: any, ipcMain: any, screen: any, shell: any, clipboard: any, nativeTheme: any, systemPreferences: any },+ * page: string, preload: string, icon: string, mica: boolean, devTools: boolean,+ * lang: () => 'zh' | 'en', motion: string, version: string, program: string[],+ * log: { dir: string, tail: (count: number) => string[] },+ * mainWindow: () => any,+ * onRetry: () => void, onReload: () => void, onClose: () => void,+ * onPick?: (value?: string) => void, onAnswer?: (value?: string) => void,+ * }} options `lang` is asked at each open; `program` names the folders of the app's own files;+ * `onClose` runs when the user closes the start window before the hand-off; `onPick` when+ * the page asks for the folder picker ('changePlace' from its place line, nothing from a+ * card's 〔重新选〕), `onAnswer` with a card's answer ('use' for 〔继续〕 on 「会放在…」).+ */+ constructor(options) {+ this.#o = options+ this.#teamShown = new Promise((resolve) => { this.#showTeam = resolve })+ options.electron.ipcMain.handle(START_ACT, (event, name, payload) => this.#act(event, name, payload))+ }++ get kind() { return this.#state?.start }++ /** Settles once the current window has painted its first frame (or has had time to). */+ get painted() { return this.#painted }++ /** Settles once the team window has shown at a hand-off. */+ get teamShown() { return this.#teamShown }++ /** Opens the window, unless one is open, with a fresh state for this kind of start. */+ open(kind) {+ if (this.#open()) return+ const { BrowserWindow, screen, nativeTheme } = this.#o.electron+ const start = START_KINDS.includes(kind) ? kind : 'later'+ this.#reset(start)+ const area = screen.getDisplayNearestPoint(screen.getCursorScreenPoint()).workArea+ const win32 = process.platform === 'win32'+ const { mica } = this.#o+ const colors = this.#colors()+ const rect = centred(startSize(area), area)+ const win = new BrowserWindow({+ ...rect,+ useContentSize: true, resizable: false, maximizable: false, fullscreenable: false, minimizable: true,- show: true, title: 'DeepSeek Bot', icon: this.#o.icon,++ show: true, title: 'DS Bot', icon: this.#o.icon,+ backgroundColor: mica ? '#00000000' : colors.main,+ // Frameless with the system minimize and close buttons over the page's empty 40 px band.+ ...(win32 ? {+ titleBarStyle: 'hidden',+ titleBarOverlay: { height: CAPTION_HEIGHT, color: mica ? '#00000000' : colors.main, symbolColor: colors.ink },+ ...(mica ? { backgroundMaterial: 'mica' } : {}),+ } : {}),+ webPreferences: {+ preload: this.#o.preload, contextIsolation: true, sandbox: true, nodeIntegration: false, webviewTag: false, spellcheck: false,+ // The page paces the whale and the hand-off on timers, which a covered or minimized+ // window would otherwise run once a second.+ backgroundThrottling: false,+ additionalArguments: [`--ds-bot-start=${pathToFileURL(this.#o.page).href}`],+ },+ })+ // At a fractional display scale, Electron 44 on Windows makes a frameless window a few pixels+ // larger than asked; setting the size again once it exists gives the size asked for.+ win.setContentBounds(rect)+ this.#window = win+ this.#url = startUrl(this.#o.page, start)+ const contents = win.webContents+ // The window shows at once; its page paints a little later (onboarding §3: within about 1 s).+ const sinceLaunch = () => String(Math.round(process.uptime() * 1000))+ note(`${start} start window shown ${sinceLaunch()} ms after launch`)+ win.once('ready-to-show', () => { note(`the start page painted ${sinceLaunch()} ms after launch`) })+ this.#painted = new Promise((resolve) => {+ win.once('ready-to-show', resolve)+ contents.once('did-finish-load', resolve)+ setTimeout(resolve, PAINT_WAIT_MS)+ })+ win.on('page-title-updated', (event) => { event.preventDefault() })+ contents.on('will-navigate', (event) => { event.preventDefault() })+ contents.setWindowOpenHandler(() => ({ action: 'deny' }))+ // A reload loses what the preload kept, so the page gets the state again.+ contents.on('dom-ready', () => { this.#send() })+ contents.on('render-process-gone', (_event, details) => { note(`the page's renderer stopped (${String(details?.reason)})`) })+ if (this.#o.devTools) {+ contents.on('before-input-event', (_event, input) => {+ if (input.type === 'keyDown' && (input.key === 'F12' || (input.control && input.shift && input.key.toLowerCase() === 'i'))) contents.toggleDevTools()+ })+ }+ const recolor = () => {+ if (win.isDestroyed()) return+ const next = this.#colors()+ if (win32) win.setTitleBarOverlay({ color: mica ? '#00000000' : next.main, symbolColor: next.ink })+ if (!mica) win.setBackgroundColor(next.main)+ }+ nativeTheme.on('updated', recolor)+ win.once('closed', () => {+ nativeTheme.off('updated', recolor)+ if (this.#window !== win) return+ this.#window = undefined+ this.#clearTimers()+ if (!this.#revealed) this.#o.onClose()+ })+ void win.loadURL(this.#url).catch((error) => { note(`the start page did not load: ${error instanceof Error ? error.message : String(error)}`) })+ }++ /** The window that dialogs belong to, while it is the one showing. */+ owner() { return this.#open() && !this.#revealed ? this.#window : undefined }++ /** Brings the start window back while it is the one showing. */+ focus() {+ const win = this.owner()+ if (win === undefined) return false+ if (win.isMinimized()) win.restore()+ win.show()+ win.focus()+ return true+ }++ explain(explain) {+ this.#explain = { ...explain }+ if (this.#open()) this.#update({ explain: this.#explain })+ }++ /**+ * The line that says where the data goes, with 「换个位置…」 (start-window §2): the drive and its+ * free space, or the folder. Undefined takes the line away.+ * @param {{ drive?: string, path?: string, free?: string } | undefined} place+ */+ place(place) {+ if (this.#open()) this.#update({ place: place === undefined ? undefined : { ...place } })+ }++ /** A short drive's one-line note for the first 10 s (§4), or none. */+ hint(hint) {+ if (this.#open()) this.#update({ hint: hint === undefined ? undefined : { ...hint } })+ }++ /**+ * A card on the sheet while the start boots (the clock stands still), or none: back to the+ * boot. Only the cards of a place: 「会放在…」 and a place that cannot be used.+ * @param {{ kind: 'picked' | 'rejected', path: string, reason?: string } | undefined} card+ */+ card(card) {+ if (!this.#open() || !['boot', 'card', 'watchdog'].includes(this.#state.view)) return+ if (card === undefined && this.#state.view !== 'card') return+ // Back in the boot, a 180 s question that the card replaced comes straight back.+ this.#update(card === undefined ? { view: 'boot', card: undefined } : { view: 'card', card: { ...card } })+ if (card === undefined) this.#resume()+ }++ /**+ * The start begins again in another folder (§7): the stages go back to the start, the whale+ * sinks and surfaces at the first stop, and the clock starts from 0. The first success after+ * it celebrates, as after a retry.+ */+ restart() {+ if (!this.#open()) return+ note('starting over in another folder')+ this.#engineUp = false+ this.#holdsOff()+ this.#watchAt = WATCHDOG_MS+ this.#phaseAt = Date.now()+ this.#clear('teamView')+ this.#update({ view: 'boot', done: [], card: undefined, failure: undefined, celebrate: true, clock: { base: 0, from: Date.now(), running: true } })+ }++ /**+ * The clock stands still while the user answers a dialog: thinking time is not the engine's.+ * The hand-off and the 20 s check wait for the answer too (see ready()).+ */+ async asking(promise) {+ this.#asks += 1+ this.#refresh()+ try {+ return await promise+ } finally {+ this.#asks -= 1+ this.#refresh()+ this.#resume()+ }+ }++ // What waited for the dialogs to close and the card to go.+ #resume() {+ if (this.#asks > 0 || !this.#open() || this.#state.view !== 'boot') return+ if (this.#readyHeld) {+ this.#readyHeld = false+ note(`the hand-off waited ${String(Date.now() - this.#heldAt)} ms for the answer`)+ this.ready()+ } else if (this.#viewLate) {+ this.#viewLate = false+ this.#teamViewLate()+ }+ }++ #holdsOff() {+ if (this.#readyHeld) note(`the held hand-off is dropped after ${String(Date.now() - this.#heldAt)} ms: the start goes on elsewhere`)+ this.#readyHeld = false+ this.#viewLate = false+ }++ /** The data folder or the engine is ready; the engine also again after a retry. */+ done(phase) {+ if (!this.#open() || !['data', 'engine'].includes(phase)) return+ const again = this.#state.done.includes(phase)+ if (again && (phase !== 'engine' || this.#engineUp)) return+ if (phase === 'engine') this.#engineUp = true+ note(`${phase} took ${String(Date.now() - this.#phaseAt)} ms`)+ this.#phaseAt = Date.now()+ // The engine came up while the 180 s question was open: the question goes.+ this.#update({ ...(again ? {} : { done: [...this.#state.done, phase] }), ...(this.#state.view === 'watchdog' ? { view: 'boot' } : {}) })+ }++ /** The engine's page started loading in the hidden team window: it has 20 s to call ready(). */+ teamLoading() {+ if (!this.#open()) return+ this.#later('teamView', TEAM_VIEW_MS, () => { this.#teamViewLate() })+ }++ #teamViewLate() {+ if (!['boot', 'card'].includes(this.#state.view)) return+ // A dialog or a card is up: the verdict waits for the answer (#resume).+ if (this.#asks > 0 || this.#state.view === 'card') { this.#viewLate = true; return }+ note(`the team view did not call ready() within ${String(TEAM_VIEW_MS / 1000)} s`)+ this.#update({ view: 'viewFailed', failure: { reason: 'other', log: this.#o.log.tail(FAILURE_LINES) } })+ }++ /**+ * dsBotApp.ready() from the team view: the hand-off starts. While a dialog of the window or+ * a card is up (the folder picker, 「会放在…」), it waits: the hand-off would take the window,+ * and with it the dialog's owner, away while the user is still choosing where the data goes.+ */+ ready() {+ if (!this.#open() || !['boot', 'card', 'viewFailed'].includes(this.#state.view) || !this.#engineUp) return+ this.#clear('teamView')+ if (this.#asks > 0 || this.#state.view === 'card') {+ if (!this.#readyHeld) {+ note('the team view is ready; the hand-off waits for the answer')+ this.#heldAt = Date.now()+ }+ this.#readyHeld = true+ return+ }+ this.#readyHeld = false+ const now = Date.now()+ note(`team took ${String(now - this.#phaseAt)} ms`)+ this.#readyAt = now+ // A team view that loads after its 20 s goes in without a celebration (§7).+ const celebrate = this.#state.celebrate && this.#state.view !== 'viewFailed'+ this.#update({ view: 'handoff', done: [...PHASES], celebrate, failure: undefined })+ this.#later('fallback', fallbackMs(this.#state), () => {+ note('the page did not send handoffShow')+ this.#handoffShow({ grow: false })+ })+ }++ /**+ * The failure page: in this window, or in a new one when the team window was already showing.+ * @param {string} kind the kind of start when no start window has opened yet+ */+ fail(error, kind = 'later') {+ const showing = this.#revealed+ // The page's hand-off empties it for the growth and cannot be undone there: a fresh page+ // draws the failure.+ const emptied = !showing && this.#open() && this.#state.view === 'handoff'+ if (showing) {+ this.#destroy()+ const main = this.#o.mainWindow()+ if (main !== undefined && !main.isDestroyed()) main.hide()+ }+ if (!this.#open()) this.open(showing || this.#state === undefined ? kind : this.#state.start)+ this.#cancelHandoff()+ this.#holdsOff()+ this.#clear('teamView')+ this.#clear('fallback')+ this.#update({ view: 'failed', failure: { reason: failureReason(error, { program: this.#o.program }), log: this.#o.log.tail(FAILURE_LINES) } })+ if (emptied) this.#window.webContents.reload()+ }++ /** The team window's rect: centred on the start window, inside that display's work area. */+ mainBounds() {+ const { screen } = this.#o.electron+ if (!this.#open()) return centred(clampInto({ x: 0, y: 0, ...MAIN_SIZE }, screen.getPrimaryDisplay().workArea), screen.getPrimaryDisplay().workArea)+ const start = this.#window.getNormalBounds()+ return mainRect(start, screen.getDisplayMatching(start).workArea)+ }++ /**+ * Puts the hidden team window on its rect, also when made with it: the size it was made with+ * can be off by a few pixels (see open()), the one set afterwards is exact.+ * @returns the rect+ */+ placeMain(main = this.#o.mainWindow()) {+ const rect = this.mainBounds()+ if (main !== undefined && !main.isDestroyed()) main.setBounds(rect)+ return rect+ }++ #open() { return this.#window !== undefined && !this.#window.isDestroyed() }++ #colors() { return COLORS[this.#o.electron.nativeTheme.shouldUseDarkColors ? 'dark' : 'light'] }++ #reset(start) {+ this.#clearTimers()+ this.#handing = false+ this.#revealed = false+ this.#engineUp = false+ this.#holdsOff()+ this.#watchAt = WATCHDOG_MS+ const now = Date.now()+ this.#phaseAt = now+ this.#state = {+ lang: this.#o.lang(), start, motion: this.#o.motion, frame: process.platform === 'win32' ? 'band' : 'system',+ view: start === 'moving' ? 'moving' : 'boot',+ done: [], explain: this.#explain, celebrate: start === 'first',+ clock: { base: 0, from: now, running: true },+ hint: undefined, place: undefined, card: undefined, failure: undefined,+ }+ this.#refresh()+ }++ // Applies a change, keeps the clock running only while the start is booting and nobody is+ // being asked, and sends the page the whole state.+ #update(change) {+ const now = Date.now()+ const next = { ...this.#state, ...change }+ const running = this.#asks === 0 && (next.view === 'boot' || next.view === 'moving')+ const clock = next.clock+ if (running !== clock.running) next.clock = { base: clockMs(clock, now), from: now, running }+ this.#state = next+ this.#armWatchdog()+ this.#send()+ }++ #refresh() { if (this.#state !== undefined) this.#update({}) }++ #send() {+ if (this.#open() && this.#state !== undefined) this.#window.webContents.send(START_STATE, startSnapshot(this.#state, Date.now()))+ }++ // 180 s on the start's clock without the engine: the whale asks whether to try again.+ #armWatchdog() {+ this.#clear('watchdog')+ const { start, view, clock } = this.#state+ if (start === 'moving' || view !== 'boot' || !clock.running || this.#engineUp) return+ this.#later('watchdog', this.#watchAt - clockMs(clock, Date.now()), () => {+ note(`no engine after ${String(Math.round(this.#watchAt / 1000))} s`)+ this.#update({ view: 'watchdog' })+ })+ }++ #act(event, name, payload) {+ const win = this.#window+ if (!this.#open() || event.sender !== win.webContents || event.senderFrame !== win.webContents.mainFrame+ || !isStartPage(event.senderFrame?.url, this.#url)) return false+ if (!acceptsAct(name, this.#state.view)) {+ note(`refused the act ${typeof name === 'string' ? name.slice(0, 40) : typeof name} in ${this.#state.view}`)+ return false+ }+ if (name === 'handoffShow') this.#handoffShow(payload)+ else if (name === 'handoffDone') note(`handoffDone at handoffShow + ${String(Date.now() - this.#showAt)} ms`)+ else if (name === 'retry') this.#retry()+ else if (name === 'wait') this.#wait()+ else if (name === 'reloadView') this.#reload()+ else if (name === 'openLogs') this.#openLogs()+ else if (name === 'copyDetails') this.#copyDetails()+ else if (name === 'pick') this.#o.onPick?.(valueOf(payload))+ else if (name === 'answer') this.#o.onAnswer?.(valueOf(payload))+ return true+ }++ // The failed stage, or the engine after the 180 s question, starts again; the stages already+ // done stay done, and the first success after this celebrates (§7). The engine starts again+ // in any case, so the 180 s question guards it again.+ #retry() {+ note(`retry from ${this.#state.view}`)+ this.#engineUp = false+ this.#holdsOff()+ this.#watchAt = WATCHDOG_MS+ this.#phaseAt = Date.now()+ this.#update({ view: 'boot', failure: undefined, celebrate: true, done: this.#state.done.filter(phase => phase !== 'team'), clock: { base: 0, from: Date.now(), running: true } })+ this.#o.onRetry()+ }++ // 〔继续等待〕: the question comes back after another 180 s on the clock.+ #wait() {+ this.#watchAt = clockMs(this.#state.clock, Date.now()) + WATCHDOG_MS+ this.#update({ view: 'boot' })+ }++ #reload() {+ note('reloading the team view')+ this.#update({ view: 'boot', failure: undefined })+ this.#o.onReload()+ this.teamLoading()+ }++ #openLogs() {+ void this.#o.electron.shell.openPath(this.#o.log.dir).then((problem) => { if (problem) note(`the logs folder did not open: ${problem}`) })+ }++ #copyDetails() {+ const { version } = this.#o+ const reason = this.#state.failure?.reason ?? 'other'+ const text = detailsText({ version, platform: process.platform, arch: process.arch, reason, lines: this.#o.log.tail(FAILURE_LINES) })+ void Promise.resolve(this.#o.electron.clipboard.writeText(text)).catch((error) => { note(`the details were not copied: ${error instanceof Error ? error.message : String(error)}`) })+ }++ #handoffShow(payload) {+ if (this.#handing || this.#state.view !== 'handoff') return+ const main = this.#o.mainWindow()+ if (main === undefined || main.isDestroyed()) return+ this.#handing = true+ this.#clear('fallback')+ this.#showAt = Date.now()+ note(`handoffShow at ready + ${String(this.#showAt - this.#readyAt)} ms`)+ const win = this.#window+ this.#from = win.getBounds()+ // The start window may have been dragged since the team window was placed.+ const target = this.placeMain(main)+ const grow = !(payload !== null && typeof payload === 'object' && payload.grow === false) && !win.isMinimized() && !this.#reducedMotion()+ if (!grow) { this.#reveal(); return }+ this.#later('grow', GROWTH.delay, () => { this.#grow(this.#from, target) })+ }++ // Electron ignores setBounds' animate flag on Windows, so the growth is stepped here; each step+ // eases from the time it really runs at, so a busy machine skips steps rather than stretching.+ #grow(from, to) {+ const began = Date.now()+ note(`growing at handoffShow + ${String(began - this.#showAt)} ms`)+ const step = () => {+ if (!this.#open()) return+ const time = Math.min(1, (Date.now() - began) / GROWTH.duration)+ this.#window.setBounds(rectAt(from, to, GROWTH_EASING(time)))+ if (time < 1) this.#later('grow', GROWTH.step, step)+ else this.#reveal()+ }+ this.#later('grow', GROWTH.step, step)+ }++ // The team window shows on its rect: with the focus when the start window had it; otherwise+ // behind nothing new, flashing its taskbar button; minimized when the start window was.+ #reveal() {+ if (this.#revealed || !this.#open()) return+ const main = this.#o.mainWindow()+ if (main === undefined || main.isDestroyed()) return+ this.#revealed = true+ this.#showTeam()+ this.#clear('fallback')+ this.#clear('grow')+ const win = this.#window+ const how = win.isMinimized() ? 'minimized' : win.isFocused() ? 'focused' : 'behind'+ if (how === 'focused') {+ main.show()+ main.focus()+ } else if (how === 'minimized') {+ main.minimize()+ } else {+ main.showInactive()+ try { main.moveAbove(win.getMediaSourceId()) } catch { /* the order stays the system's */ }+ }+ if (how !== 'focused') {+ main.flashFrame(true)+ main.once('focus', () => { main.flashFrame(false) })+ }+ // Leaves the taskbar only now, so the app's button never goes away.+ win.setSkipTaskbar(true)+ note(`team window shown (${how}) at ready + ${String(Date.now() - this.#readyAt)} ms`)+ this.#later('destroy', DESTROY_AFTER_MS, () => { this.#destroy() })+ }++ #cancelHandoff() {+ if (!this.#handing || this.#revealed) return+ this.#clear('grow')+ this.#handing = false+ if (this.#from !== undefined && this.#open()) this.#window.setBounds(this.#from)+ }++ #destroy() {+ const win = this.#window+ if (win !== undefined && !win.isDestroyed()) win.destroy()+ }++ #reducedMotion() {+ try {+ return this.#o.electron.systemPreferences.getAnimationSettings().prefersReducedMotion === true+ } catch {+ return false+ }+ }++ #later(name, ms, run) {+ this.#clear(name)+ this.#timers[name] = setTimeout(() => {+ delete this.#timers[name]+ run()+ }, Math.max(0, ms))+ }++ #clear(name) {+ clearTimeout(this.#timers[name])+ delete this.#timers[name]+ }++ #clearTimers() { for (const name of Object.keys(this.#timers)) this.#clear(name) }+}diff --cc app/src/start/start.htmlindex e45251fd,00000000..cd7338f1mode 100644,000000..100644--- a/app/src/start/start.html+++ b/app/src/start/start.html@@@ -1,52 -1,0 +1,52 @@@+<!doctype html>+<html lang="zh-CN">+<head>+<meta charset="utf-8">+<meta http-equiv="Content-Security-Policy" content="default-src 'self'; base-uri 'none'; object-src 'none'">+<meta name="color-scheme" content="light dark">+<meta name="viewport" content="width=device-width">- <title>DeepSeek Bot</title>++<title>DS Bot</title>+<link rel="stylesheet" href="start.css">+<script type="module" src="start.js"></script>+</head>+<body>+<div class="band" aria-hidden="true"></div>+<span class="elapsed" aria-hidden="true"></span>+<main class="stage">+<div class="water" aria-hidden="true"></div>+<div class="lane"><div class="whale-x"><div class="whale-gaze"><div class="whale"><div class="whale-move"><div class="whale-loop">+<!-- whale --><svg class="whale-svg" viewBox="0 0 100 100" aria-hidden="true" focusable="false"><defs><mask id="st-eyes" maskUnits="userSpaceOnUse" x="-100" y="-100" width="300" height="300"><rect x="-100" y="-100" width="300" height="300" fill="#fff"/><g id="gaze" class="bt-gaze"><g id="eye-pair" class="bt-eyes" fill="#000"><g transform="translate(72.5 48.4) rotate(-15.8)"><rect class="bt-eye" x="-4.65" y="-11.5" width="9.3" height="23" rx="4.65"/></g><g transform="translate(85.6 43.4) rotate(-21.2)"><rect class="bt-eye" x="-3.5" y="-11.45" width="7" height="22.9" rx="3.5"/></g><g transform="translate(72.5 48.4) rotate(-15.8)"><path class="bt-eye-happy" opacity="0" d="M-5.766 3.22Q0 -9.66 5.766 3.22" fill="none" stroke="#000" stroke-width="4.65" stroke-linecap="round"/></g><g transform="translate(85.6 43.4) rotate(-21.2)"><path class="bt-eye-happy" opacity="0" d="M-4.34 3.206Q0 -9.617999999999999 4.34 3.206" fill="none" stroke="#000" stroke-width="3.5" stroke-linecap="round"/></g></g></g></mask><clipPath id="st-tail-cut" clipPathUnits="userSpaceOnUse"><path d="M-100 -100H32.45V52.05L36.02 53.85L27.9 61.1L23.35 70.15L23.35 200H-100Z"/></clipPath><clipPath id="st-torso-cut" clipPathUnits="userSpaceOnUse"><path d="M32.45 -100H200V200H-100V70.15H23.35L32.45 52.05Z"/></clipPath><g id="whale-layers" fill-rule="evenodd"><g id="w-body"><path d="M65.3 20.9l5.1 .1 4.8 .9 4.8 1.7 4.3 2.3 3.8 3.1 3 3.4 2.3 3.8 1.6 4.3 .9 4.3 0 4.8-.8 4.8-1.4 4.3-2.3 4.3-3.2 4.3-3.4 3.3-4.3 3.1-7.2 3.5-7.6 1.7-7.2 .1-9.6-1.6-3.3-1-2.9-1.7-8.8-8.9-6-4.7-3.3-.5-7.7 1.1-4.8-.1-4.7-1.2-1.9-1.2-1-1-.5-1.5 .4-1.4 1.1-1.3 1.9-1.3 4.7-1.5 7.7-.6 1.1-.5 .7-1 0-1.4-2.8-7.2-1.2-5.3-.1-4.3 .4-1.4 .9-1.2 1.9-.2 2 1 2.2 2.3 2.2 3.4 3.2 7.6 1.9 9.7 .5-.1 1.1-7.2 1.8-4.8 3.2-5.2 3.9-4.3 4.9-3.9 5.6-2.9 5.8-1.9z" fill="var(--bt-ink-deepseek)"/></g><g id="w-belly"><path d="M93.3 55.8l1-.3 .1 1.2-2.4 5.3-3.4 4.8-3.8 3.8-4.8 3.4-5.7 2.8-4.8 1.5-4.8 .4 20.1-17.4 5.2-3.7z" fill="#fff" fill-opacity="1"/></g><g id="w-shade"><path d="M88.6 29.5l2.4 2.9 1.9 2.8 2.4 6.3 .5 3.3 .1 5.3-1.5 6.6-1.9 4.3-2 3.3-4.8 5.4-5.7 4.3-7.2 3.3-6.2 1.5-6.7 .1-3.3-.2-9.6-1.8-3.3-1.5-2.4-1.9-8.6-8.9-5.3-3.9-3.3-.1-2.9 .2-3.3 .8-5.8 0-4.3-1-2.9-1.9 .6-.6 3.8-1.3 10.5-2.5 4.3 .9 1.4-.1 2.2-1.7 .5-1.4-.3-1.5-1.2-1.4-2.2-1.4-1.2-1.9-.6-12 .4-3.3 .5-.5 2.9 3.8 2.4 4.8 1.9 5.7 .7 5.8 .7 2.8 2.1 2.4 2.7 5.5 3.8 4.3 2.9 2.2 3.3 1 3.4-.4 6.2-3 7.1-4.5 7.3-5.6 6.6-5.9 5.9-6.5 3.7-5.3 1.7-4.2 .1-2.9z" fill="#000" fill-opacity=".14"/></g><g id="w-light"><path d="M55.6 22.8l1.9-.3 1.5 .3 .6 1 .1 .9-2 4.3-3.8 5.3-5.8 6.2-5.4 4.4-4.8 2.3-1.4 0-1.2-.5-.8-1.9 .5-3.3 2.5-4.8 3.3-4.3 2.4-2.4 5.3-3.9zM19.3 28.1l-1.4 2 .3-1.1zM21.7 49.1l.6 .5-.3 .5-.8 0zM35.8 52l1.2-.4 .9 .7 .7 1.6-.4 .9-1.2 .1-2.6-.5zM7.2 52.9l-2.9 2.9 1.2-1.6z" fill="#fff" fill-opacity=".16"/></g></g></defs><g class="bt-b"><g mask="url(#st-eyes)"><g id="tail"><use href="#whale-layers" clip-path="url(#st-tail-cut)"/></g><g id="torso"><use href="#whale-layers" clip-path="url(#st-torso-cut)"/></g></g></g></svg><!-- /whale -->+</div></div></div></div></div></div>+<div class="whale-hit" aria-hidden="true"></div>+<div class="fx" aria-hidden="true"><span class="trace"></span><span class="trace"></span><span class="ripple"></span></div>+<ol class="track sr" data-t-label="status.track">+<li class="station" data-phase="data" data-state="pending"><span data-t="status.phase.data"></span> <span class="sr"></span></li>+<li class="station" data-phase="engine" data-state="pending"><span data-t="status.phase.engine"></span> <span class="sr"></span></li>+<li class="station" data-phase="team" data-state="pending"><span data-t="status.phase.team"></span> <span class="sr"></span></li>+</ol>+<p class="voice"><span></span></p>+<p class="caption"><span class="caption-text"></span><button class="btn" data-look="small" data-act="openLogs" data-t="btn.openLogs" hidden></button></p>+<section class="sheet">+<div class="sheet-edge"></div><div class="sheet-fill"></div>+<div class="sheet-body">+<section class="card" data-kind="recommend" hidden><div class="card-scroll"><h2 class="card-title" data-t="say.{reason}"></h2><p class="lead"><span data-t="reason.place.{reason}"></span> <span class="ask" data-t="card.recommend.ask"></span></p></div><div class="card-actions"><button class="btn" data-look="primary" data-act="answer" data-detail="rec" data-rec data-t="btn.useRec"></button><button class="btn" data-look="soft" data-act="answer" data-detail="keep" data-keep data-t="btn.keepDrive"></button><button class="btn" data-look="link" data-act="pick" data-rec data-t="btn.otherPlace"></button><button class="btn" data-look="primary" data-act="pick" data-norec data-t="btn.pickPlace"></button><p class="foot" data-t="note.changeLater"></p></div></section>+<section class="card" data-kind="rejected" hidden><div class="card-scroll"><h2 class="card-title" data-t="say.rejected"></h2><p class="lead" data-t="reason.place.{reason}"></p></div><div class="card-actions"><button class="btn" data-look="primary" data-act="pick" data-t="btn.repick"></button><button class="btn" data-look="soft" data-act="answer" data-detail="rec" data-rec data-t="btn.useRec"></button><button class="btn" data-look="soft" data-act="answer" data-detail="keep" data-keep data-t="btn.keepDrive"></button><p class="foot" data-t="note.changeLater"></p></div></section>+<section class="card" data-kind="missing" hidden><div class="card-scroll"><h2 class="card-title" data-t="say.missing"></h2><p class="lead" data-t="card.missing.lead"></p></div><div class="card-actions"><button class="btn" data-look="primary" data-act="retry" data-t="btn.retry"></button><button class="btn" data-look="soft" data-act="pick" data-t="btn.relocate"></button><button class="btn" data-look="soft" data-act="freshStart" data-t="btn.freshStart"></button></div><p class="miss" data-t="card.missing.retryMissed" hidden></p><p class="foot" data-t="note.changeLater"></p></section>+<section class="card" data-kind="picked" hidden><div class="card-scroll"><h2 class="card-title" data-t="say.picked"></h2><p class="lead" data-t="card.picked.lead"></p></div><div class="card-actions"><button class="btn" data-look="primary" data-act="answer" data-detail="use" data-t="btn.continue"></button><button class="btn" data-look="soft" data-act="pick" data-t="btn.repick"></button><p class="foot" data-t="note.changeLater"></p></div></section>+<section class="card" data-kind="import" hidden><div class="card-scroll"><h2 class="card-title" data-t="say.import"></h2><p class="lead" data-t="card.import.lead"></p><p class="small extra-row"><span data-t="card.import.extra"></span><button class="btn disclose" data-look="link" data-act="toggleMore" aria-expanded="false"><span data-t="btn.more"></span><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 6.2 8 9.7l3.5-3.5"/></svg></button></p><div class="more" hidden><p class="small ink" data-t="card.import.found"></p><p class="small" data-t="card.import.scope"></p><p class="small ink model-row"><span data-t="card.import.model"></span><button class="btn" data-look="link" data-act="toggleModels" aria-expanded="false" data-t="btn.changeModel"></button></p><ul class="models" hidden></ul><div class="opts"><label><input type="checkbox" data-opt="regen"><span data-t="card.import.optRegen"></span></label><label><input type="checkbox" data-opt="skipWork"><span data-t="card.import.optSkipWork"></span></label></div></div></div><div class="card-actions"><button class="btn" data-look="primary" data-act="answer" data-detail="copy" data-t="btn.copy"></button><button class="btn" data-look="soft" data-act="answer" data-detail="skip" data-t="btn.skipCopy"></button><p class="foot" data-t="note.copyLater"></p></div></section>+<section class="card" data-kind="importSpace" hidden><div class="card-scroll"><h2 class="card-title" data-t="say.importSpace"></h2><p class="lead" data-t="card.importSpace.lead"></p></div><div class="card-actions"><button class="btn" data-look="primary" data-act="pick" data-t="btn.pickPlace"></button><button class="btn" data-look="soft" data-act="answer" data-detail="skip" data-t="btn.skipCopy"></button></div></section>+<section class="card" data-kind="copying" hidden><div class="card-scroll"><h2 class="card-title" data-t="say.copying"></h2><div class="copy-steps"><ol class="steps"><li data-step="1"><span class="mark" aria-hidden="true"><span class="dot"></span><svg class="check" viewBox="0 0 16 16"><circle cx="8" cy="8" r="8"/><path d="M4.6 8.3 7 10.6l4.4-4.9"/></svg></span><span data-t="card.copying.step1"></span></li><li data-step="2"><span class="mark" aria-hidden="true"><span class="dot"></span><svg class="check" viewBox="0 0 16 16"><circle cx="8" cy="8" r="8"/><path d="M4.6 8.3 7 10.6l4.4-4.9"/></svg></span><span data-t="card.copying.step2"></span></li><li data-step="3"><span class="mark" aria-hidden="true"><span class="dot"></span><svg class="check" viewBox="0 0 16 16"><circle cx="8" cy="8" r="8"/><path d="M4.6 8.3 7 10.6l4.4-4.9"/></svg></span><span data-t="card.copying.step3"></span></li></ol><div class="bar" aria-hidden="true"><span class="bar-fill"></span></div></div><div class="confirm" hidden><p class="lead" data-t="card.copying.stopConfirm"></p></div></div><div class="card-actions"><span class="eta small"></span><button class="btn stop" data-look="soft" data-act="stopCopy" data-t="btn.stopCopy"></button><button class="btn" data-look="primary" data-act="keepCopying" data-confirm data-t="btn.keepCopying"></button><button class="btn danger" data-look="soft" data-act="stopCopy" data-detail="confirm" data-confirm data-t="btn.stopCopy"></button></div></section>+<section class="card" data-kind="inUse" hidden><div class="card-scroll"><h2 class="card-title" data-t="say.inUse"></h2><p class="lead" data-t="card.inUse.lead"></p></div><div class="card-actions"><button class="btn" data-look="primary" data-act="answer" data-detail="skip" data-t="btn.skipCopy"></button></div></section>+<section class="card" data-kind="newerUpdating" hidden><div class="card-scroll"><h2 class="card-title" data-t="say.newer"></h2><p class="lead" data-t="card.newerUpdating.lead"></p><p class="small"><span data-t="card.update.slow"></span> <button class="btn" data-look="link" data-act="manualDownload" data-t="btn.manualDownload"></button></p></div><div class="card-actions"><button class="btn" data-look="primary" data-act="answer" data-detail="skip" data-t="btn.skipCopy"></button></div></section>+<section class="card" data-kind="newer" hidden><div class="card-scroll"><h2 class="card-title" data-t="say.newer"></h2><p class="lead" data-t="card.newer.lead"></p></div><div class="card-actions"><button class="btn" data-look="primary" data-act="answer" data-detail="startWithout" data-t="btn.startWithout"></button><p class="foot" data-t="note.copyAgain"></p></div></section>+<section class="card" data-kind="importFailed" hidden><div class="card-scroll"><p class="lead" data-t="card.importFailed.lead"></p><div class="card-actions"><button class="btn" data-look="primary" data-act="retry" data-t="btn.retry"></button><button class="btn" data-look="soft" data-act="answer" data-detail="startWithout" data-t="btn.startWithout"></button><button class="btn" data-look="soft" data-act="copyDetails" data-t="btn.copyDetails"></button><button class="btn disclose" data-look="link" data-act="toggleDetails" aria-expanded="false"><span data-t="btn.details"></span><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 6.2 8 9.7l3.5-3.5"/></svg></button></div><div class="log" hidden><pre></pre></div></div></section>+<section class="card" data-kind="watchdog" hidden><div class="card-actions"><button class="btn" data-look="primary" data-act="wait" data-t="btn.wait"></button><button class="btn" data-look="soft" data-act="retry" data-t="btn.retry"></button><button class="btn" data-look="soft" data-act="openLogs" data-t="btn.openLogs"></button></div></section>+<section class="card" data-kind="failed" hidden><div class="card-scroll"><p class="lead" data-t="reason.start.{reason}"></p><div class="banner" hidden><div class="banner-row"><p class="lead" data-t="card.update.available"></p><button class="btn" data-look="primary" data-act="installUpdate" data-u="available" data-t="btn.install"></button></div><div class="banner-down" data-u="downloading"><p class="small banner-line"><span data-t="card.update.downloading"></span><span class="slow"><span data-t="card.update.slow"></span><button class="btn" data-look="link" data-act="manualDownload" data-t="btn.manualDownload"></button></span></p><div class="bar"><span class="bar-fill"></span></div></div><p class="small" data-u="installing" data-t="card.update.installing"></p><div class="banner-fail" data-u="failed"><p class="small danger" data-t="card.update.failed"></p><button class="btn" data-look="small" data-act="installUpdate" data-t="btn.retry"></button><button class="btn" data-look="small" data-act="manualDownload" data-t="btn.manualDownload"></button></div></div><div class="card-actions"><button class="btn" data-look="primary" data-act="retry" data-main data-t="btn.retry"></button><button class="btn" data-look="soft" data-act="pick" data-detail="changePlace" data-places data-t="btn.changePlace" hidden></button><button class="btn" data-look="soft" data-act="freshStart" data-places data-t="btn.freshStart" hidden></button><button class="btn" data-look="soft" data-act="openLogs" data-t="btn.openLogs"></button><button class="btn" data-look="soft" data-act="copyDetails" data-t="btn.copyDetails"></button><button class="btn disclose" data-look="link" data-act="toggleDetails" aria-expanded="false"><span data-t="btn.details"></span><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 6.2 8 9.7l3.5-3.5"/></svg></button></div><div class="log" hidden><pre></pre></div></div></section>+<section class="card" data-kind="viewFailed" hidden><div class="card-actions"><button class="btn" data-look="primary" data-act="reloadView" data-t="btn.reload"></button><button class="btn" data-look="soft" data-act="openLogs" data-t="btn.openLogs"></button><button class="btn" data-look="soft" data-act="copyDetails" data-t="btn.copyDetails"></button></div></section>+</div>+</section>+</main>+<footer class="footrow"><span class="note" data-t="foot.community"></span><p class="place" hidden><span class="place-text"></span><span aria-hidden="true">·</span><button class="btn" data-look="link" data-act="pick" data-detail="changePlace" data-t="btn.changePlace"></button></p></footer>+<p class="sr live" aria-live="polite"></p>+</body>+</html>diff --cc app/src/start/text.mjsindex e716cd38,00000000..6b63ca34mode 100644,000000..100644--- a/app/src/start/text.mjs+++ b/app/src/start/text.mjs@@@ -1,362 -1,0 +1,362 @@@+// Every string of the app shell that the user sees, in one table: the start page and the system+// dialogs of the main process (choosing a folder, moving the data, the import, updates). Product- // names in dialog titles (DeepSeek Bot, DSH Desktop, DSH Web) are constants, not copy.++// names in dialog titles (DS Bot, DSH Desktop, DSH Web) are constants, not copy.+// docs/plans/2026-10-29-start-copy.md decides the keys and the layers; zh is the source, en+// mirrors it key by key with the same placeholders.+//+// A key is <layer>.<thing>[.<part>]; the layer says where the line is on screen:+// voice the whale's line: one line, at most 16 characters, no full stop (a question mark is fine)+// say a card's first line: at most 12 characters, no full stop+// hint the hint row: the one thing to know next, at most 22 characters, no full stop+// card card text: whole sentences ending in 。 or ?; card.<card>.<part>+// reason reasons reused in card text: whole sentences end in 。 (reason.place.*,+// reason.start.*), fragments set into a sentence have no punctuation (reason.copy.*)+// btn buttons: at most 10 characters, a verb first; one that opens a system picker or+// leaves the card ends in …; no full stop+// note card footnotes: one sentence ending in 。 that says where to change it later+// foot the footer row: no full stop+// status screen readers and counters only: no full stop+// dialog system dialogs: sentences ending in 。 or ?, picker titles without a full stop+//+// Placeholders are {name}; paths, sizes, names and versions come from the snapshot or the+// caller, never from here. {name|one|many} picks the English singular or plural by the value.+export const TEXT = {+ zh: {+ // voice+ 'voice.hello': '嗨,我是总管',+ 'voice.helloName': '嗨,我是{name}',+ 'voice.helloBack': '嗨,我来了',+ 'voice.data': '先找个地方放东西',+ 'voice.found': '找到了',+ 'voice.engine': '热身中,等我一下',+ 'voice.slow10': '第一次会慢一点',+ 'voice.slow45': '有点久,可能是杀毒软件在查新文件',+ 'voice.team': '开门去了',+ 'voice.ready': '进去吧',+ 'voice.watchdog': '等太久了,要不要重试?',+ 'voice.opening': '正在打开你的团队…',- 'voice.moving': '正在搬 DeepSeek Bot 的数据…',- 'voice.failed': 'DeepSeek Bot 没能启动',++ 'voice.moving': '正在搬 DS Bot 的数据…',++ 'voice.failed': 'DS Bot 没能启动',+ 'voice.viewFailed': '团队界面没有加载出来',+ // say+ 'say.space': '{drive} 盘有点挤',+ 'say.permission': '这里不让我放东西',+ 'say.rejected': '这里放不了',+ 'say.picked': '我多加了一层文件夹',+ 'say.missing': '数据不在原来的地方了',+ 'say.import': '找到你以前的团队了',+ 'say.importSpace': '地方不够放',+ 'say.inUse': 'DeepSeek Harness 还在用这个团队',+ 'say.newer': '这些对话比我新',+ 'say.copying': '正在搬过来',+ // hint+ 'hint.model': '待会儿要接一个模型:DeepSeek 账号或 API Key',+ 'hint.preview': '里面先有一页说明,点「继续」就行',+ 'hint.reinstall': '上次的 {bots} 个 Bot 和 {groups} 个群聊都在',+ 'hint.space': '{drive} 盘只剩 {free}',+ 'hint.slowLater': '比平时慢,请再等一会儿',+ // card+ 'card.recommend.ask': '放到 {rec} 盘(剩 {recFree})?',+ 'card.missing.lead': '找不到数据文件夹 {path}。可能是移动硬盘没插上,或者文件夹被移走、删除了。旧数据不会被改动。',+ 'card.missing.retryMissed': '还是找不到这个文件夹。',+ 'card.picked.lead': '会放在 {path}。',+ 'card.import.lead': 'DeepSeek Harness 里有 {bots} 个 Bot 和 {groups} 个群聊(对话 {chats},工作文件 {work})。复制过来?',+ 'card.import.extra': '复制后会多占 {total},DeepSeek Harness 里的原件不动。',+ 'card.import.found': '在 {path} 里找到 {bots} 个 Bot({names}等)和 {groups} 个群聊,{sessions} 段对话。',+ 'card.import.scope': '会复制:Bot、群聊、记忆、对话、附件、模型设置和 API Key。不会复制:MCP、技能和 DSH Agent。DeepSeek Harness 里的内容不会改动,复制以后两边各用各的。',+ 'card.import.model': '模型设置:{model}',+ 'card.import.optRegen': '不复制可以重新生成的文件夹',+ 'card.import.optSkipWork': '先不复制工作文件',+ 'card.importSpace.lead': '空间不够:复制要约 {need},{drive} 盘只剩 {free},还差 {short}。',+ 'card.copying.step1': '检查对话 {a}/{b}',+ 'card.copying.step2': '复制 Bot 和对话 {a} / {b}',+ 'card.copying.step3': '启动团队',+ 'card.copying.eta': '还要大约 {n} 分钟',+ 'card.copying.etaSoon': '不到 1 分钟',+ 'card.copying.stopConfirm': '停下后不会留下复制了一半的团队,DeepSeek Harness 里的团队不受影响。',+ 'card.inUse.lead': '请完全退出 DSH Desktop(任务栏右下角的托盘图标也要退出),并关掉 DSH Web,这里会自动继续。',- 'card.newerUpdating.lead': 'DeepSeek Bot {version} 能读它们,正在下载({p}%)。装好后会重新打开,再复制团队。',- 'card.newer.lead': '这些对话是更新版本的 DeepSeek Harness 写的,DeepSeek Bot 现在读不了。',++ 'card.newerUpdating.lead': 'DS Bot {version} 能读它们,正在下载({p}%)。装好后会重新打开,再复制团队。',++ 'card.newer.lead': '这些对话是更新版本的 DeepSeek Harness 写的,DS Bot 现在读不了。',+ 'card.importFailed.lead': '团队没有复制完:{reason}。DeepSeek Harness 里的团队没有变化。',- 'card.update.available': 'DeepSeek Bot {version} 已经发布,可能修好了这个问题。',++ 'card.update.available': 'DS Bot {version} 已经发布,可能修好了这个问题。',+ 'card.update.downloading': '正在下载 {version}({p}%,{a}/{b} MB)',+ 'card.update.installing': '正在安装,装好后会重新打开。',+ 'card.update.failed': '下载失败。',+ 'card.update.slow': '下载太慢?',+ // reason+ 'reason.place.space': '{drive} 盘只剩 {free}。',- 'reason.place.permission': 'DeepSeek Bot 没有权限在 {path} 里写文件。',++ 'reason.place.permission': 'DS Bot 没有权限在 {path} 里写文件。',+ 'reason.place.onedrive': '{path} 在 OneDrive 里,同步会打断正在写入的对话。',+ 'reason.place.foreign': '{path} 里已经有别的文件。',+ 'reason.place.dsh': '{path} 是 DeepSeek Harness 的数据。',+ 'reason.place.program': '{path} 在程序文件夹里,卸载时会删掉。',+ 'reason.place.nested': '{path} 和现在放数据的位置重叠。',+ 'reason.start.permission': '没有写入权限。',+ 'reason.start.space': '磁盘空间不够。',+ 'reason.start.files': '程序文件不完整,可能被杀毒软件拦掉了一部分。',+ 'reason.start.engine': '本机引擎启动到一半停下了。',+ 'reason.start.other': '出了点意外。',+ 'reason.copy.inUse': '文件被别的程序占用',+ 'reason.copy.permission': '没有权限读取',+ 'reason.copy.full': '磁盘满了',+ // btn+ 'btn.retry': '重试',+ 'btn.wait': '继续等待',+ 'btn.openLogs': '打开日志文件夹',+ 'btn.freshStart': '用新的空白团队开始…',+ 'btn.useRec': '放到 {rec} 盘',+ 'btn.keepDrive': '仍然放在 {drive} 盘',+ 'btn.otherPlace': '其他位置…',+ 'btn.pickPlace': '选择其他位置…',+ 'btn.changePlace': '换个位置…',+ 'btn.relocate': '重新找到它…',+ 'btn.continue': '继续',+ 'btn.repick': '重新选…',+ 'btn.copy': '复制过来',+ 'btn.skipCopy': '先不复制',+ 'btn.more': '详细',+ 'btn.changeModel': '更换',+ 'btn.stopCopy': '停止复制',+ 'btn.keepCopying': '继续复制',+ 'btn.startWithout': '先不带团队开始',+ 'btn.copyDetails': '复制详细信息',+ 'btn.copied': '已复制',+ 'btn.details': '详细信息',+ 'btn.install': '下载并安装',+ 'btn.manualDownload': '手动下载',+ 'btn.reload': '重新载入',+ 'btn.move': '移动并重启',+ 'btn.cancel': '取消',+ 'btn.quit': '退出',+ 'btn.restart': '立即重启',+ 'btn.download': '下载',+ 'btn.notNowRestart': '先不重启',+ 'btn.notNowDownload': '先不下载',+ 'btn.ok': '确定',+ // note+ 'note.changeLater': '以后可以在 设置 → 通用 → 位置 里改。',+ 'note.copyLater': '也可以在 设置 → 通用 → 位置 里复制。',+ 'note.copyAgain': '以后可以在 设置 → 通用 → 位置 里复制。',+ // foot+ 'foot.community': '社区开源项目,不是 DeepSeek 官方产品',+ 'foot.place.drive': '数据放在 {drive} 盘(剩 {free})',+ 'foot.place.driveOnly': '数据放在 {drive} 盘',+ 'foot.place.path': '数据放在 {path}(剩 {free})',+ 'foot.place.pathOnly': '数据放在 {path}',+ // status+ 'status.track': '启动进度',+ 'status.phase.data': '准备数据文件夹',+ 'status.phase.engine': '启动本机引擎',+ 'status.phase.team': '打开团队',+ 'status.state.pending': '未开始',+ 'status.state.active': '进行中',+ 'status.state.done': '已完成',+ 'status.state.failed': '没有完成',+ 'status.sr.active': '{phase}:进行中',+ 'status.sr.done': '{phase}:已完成',+ 'status.elapsed': '已用 {n} 秒',+ // dialog- 'dialog.pickRoot': '选择 DeepSeek Bot 放数据的位置',- 'dialog.pickMove': '选择 DeepSeek Bot 数据的新文件夹',++ 'dialog.pickRoot': '选择 DS Bot 放数据的位置',++ 'dialog.pickMove': '选择 DS Bot 数据的新文件夹',+ 'dialog.move.inDsh': '请选择 DeepSeek Harness 数据({home})以外的文件夹。',+ 'dialog.move.inProgram': '请选择程序文件夹以外的位置:卸载时会删掉程序文件夹。',+ 'dialog.move.drive': '请选择一个文件夹,不要选整个磁盘。',+ 'dialog.move.nested': '请选择现在的数据文件夹以外的位置。',+ 'dialog.move.workspace': '数据文件夹和总工作区不能互相包含。',+ 'dialog.move.notEmpty': '请选择一个空文件夹,或者新建一个。',- 'dialog.move.confirm': '把 DeepSeek Bot 的数据移到 {to} 吗?',- 'dialog.move.detail': 'DeepSeek Bot 会把数据复制过去,然后重新启动。{from} 会原样保留,确认一切正常后可以自己删掉。',++ 'dialog.move.confirm': '把 DS Bot 的数据移到 {to} 吗?',++ 'dialog.move.detail': 'DS Bot 会把数据复制过去,然后重新启动。{from} 会原样保留,确认一切正常后可以自己删掉。',+ 'dialog.move.inUse': '另一个 DeepSeek Harness 正在使用这份数据,所以没有移动。请先关掉它,再重试。',- 'dialog.move.failed': '数据没有复制成功:{message}\n\nDeepSeek Bot 会继续使用原来位置的数据。',- 'dialog.import.found': 'DeepSeek Harness 里有 {bots} 个 Bot 和 {groups} 个群聊。要复制到 DeepSeek Bot 吗?',++ 'dialog.move.failed': '数据没有复制成功:{message}\n\nDS Bot 会继续使用原来位置的数据。',++ 'dialog.import.found': 'DeepSeek Harness 里有 {bots} 个 Bot 和 {groups} 个群聊。要复制到 DS Bot 吗?',+ 'dialog.import.foundDetail': '会复制 Bot、群聊、记忆、对话、附件、模型设置和 API Key。{home} 里的内容不会改变,复制以后两边各用各的。',+ 'dialog.import.inUse': 'DeepSeek Harness 正在使用这个团队。请先关掉它,再重试。',- 'dialog.import.newer': '有 {n} 段对话是更新版本的 DeepSeek Harness 写的,这个版本的 DeepSeek Bot 读不了。请先更新 DeepSeek Bot,再打开它来复制团队。',- 'dialog.import.whichModels': 'DeepSeek Bot 用哪一份模型设置?',- 'dialog.import.failed': '团队没有复制完:{message}\n\nDeepSeek Bot 会用一个新团队开始。DeepSeek Harness 里的团队没有变化。',- 'dialog.update.ready': 'DeepSeek Bot {version} 已经下载好。',++ 'dialog.import.newer': '有 {n} 段对话是更新版本的 DeepSeek Harness 写的,这个版本的 DS Bot 读不了。请先更新 DS Bot,再打开它来复制团队。',++ 'dialog.import.whichModels': 'DS Bot 用哪一份模型设置?',++ 'dialog.import.failed': '团队没有复制完:{message}\n\nDS Bot 会用一个新团队开始。DeepSeek Harness 里的团队没有变化。',++ 'dialog.update.ready': 'DS Bot {version} 已经下载好。',+ 'dialog.update.readyDetail': '现在重启就能更新;不重启的话,下次退出时安装。',- 'dialog.update.available': 'DeepSeek Bot {version} 已经发布。',- 'dialog.update.availableDetail': '这个版本不能自己更新。请到发布页下载新版,再用它替换「应用程序」里的 DeepSeek Bot。',- 'dialog.update.onFailure': 'DeepSeek Bot {version} 下载完会自动安装,然后重新打开。',- 'dialog.update.onFailurePage': 'DeepSeek Bot {version} 已经发布。关掉这个对话框后,会打开它的下载页面。',++ 'dialog.update.available': 'DS Bot {version} 已经发布。',++ 'dialog.update.availableDetail': '这个版本不能自己更新。请到发布页下载新版,再用它替换「应用程序」里的 DS Bot。',++ 'dialog.update.onFailure': 'DS Bot {version} 下载完会自动安装,然后重新打开。',++ 'dialog.update.onFailurePage': 'DS Bot {version} 已经发布。关掉这个对话框后,会打开它的下载页面。',+ },+ en: {+ // voice+ 'voice.hello': 'Hi, I’m Chief',+ 'voice.helloName': 'Hi, I’m {name}',+ 'voice.helloBack': 'Hi, I’m here',+ 'voice.data': 'First, a place for my things',+ 'voice.found': 'Found one',+ 'voice.engine': 'Warming up, one moment',+ 'voice.slow10': 'The first time takes a bit longer',+ 'voice.slow45': 'Taking a while: antivirus may be checking new files',+ 'voice.team': 'Off to open the door',+ 'voice.ready': 'Come on in',+ 'voice.watchdog': 'This is taking too long. Try again?',+ 'voice.opening': 'Opening your team…',- 'voice.moving': 'Moving DeepSeek Bot’s data…',- 'voice.failed': 'DeepSeek Bot couldn’t start',++ 'voice.moving': 'Moving DS Bot’s data…',++ 'voice.failed': 'DS Bot couldn’t start',+ 'voice.viewFailed': 'The team view didn’t load',+ // say+ 'say.space': 'Drive {drive} is a bit full',+ 'say.permission': 'I’m not allowed to put things here',+ 'say.rejected': 'That place won’t work',+ 'say.picked': 'I added one more folder',+ 'say.missing': 'Your data isn’t where it was',+ 'say.import': 'Found your old team',+ 'say.importSpace': 'Not enough room',+ 'say.inUse': 'DeepSeek Harness is still using this team',+ 'say.newer': 'These chats are newer than me',+ 'say.copying': 'Moving your team in',+ // hint+ 'hint.model': 'Next you’ll connect a model: a DeepSeek account or an API Key',+ 'hint.preview': 'A notice page comes first; just click “Continue”',+ 'hint.reinstall': 'Your {bots|Bot|Bots} and {groups|group chat|group chats} are still here',+ 'hint.space': 'Only {free} left on drive {drive}',+ 'hint.slowLater': 'Slower than usual; please wait a little longer',+ // card+ 'card.recommend.ask': 'Put it on drive {rec} ({recFree} free)?',+ 'card.missing.lead': 'Can’t find the data folder {path}. The external drive may be unplugged, or the folder was moved or deleted. The old data won’t be changed.',+ 'card.missing.retryMissed': 'Still can’t find this folder.',+ 'card.picked.lead': 'It will go in {path}.',+ 'card.import.lead': 'DeepSeek Harness has {bots|Bot|Bots} and {groups|group chat|group chats} (chats {chats}, work files {work}). Copy them over?',+ 'card.import.extra': 'The copy takes another {total}; the originals in DeepSeek Harness stay untouched.',+ 'card.import.found': 'Found {bots|Bot|Bots} ({names} and others), {groups|group chat|group chats} and {sessions|chat|chats} in {path}.',+ 'card.import.scope': 'Copied: Bots, group chats, memory, chats, attachments, model settings and API Keys. Not copied: MCP, skills and DSH Agent. Nothing in DeepSeek Harness changes; after the copy each side goes its own way.',+ 'card.import.model': 'Model settings: {model}',+ 'card.import.optRegen': 'Skip folders that can be regenerated',+ 'card.import.optSkipWork': 'Don’t copy work files yet',+ 'card.importSpace.lead': 'Not enough space: the copy needs about {need}, drive {drive} has {free} left, {short} short.',+ 'card.copying.step1': 'Checking chats {a}/{b}',+ 'card.copying.step2': 'Copying Bots and chats {a} / {b}',+ 'card.copying.step3': 'Starting the team',+ 'card.copying.eta': 'About {n|minute|minutes} left',+ 'card.copying.etaSoon': 'Less than a minute left',+ 'card.copying.stopConfirm': 'Stopping leaves no half-copied team, and the team in DeepSeek Harness is not affected.',+ 'card.inUse.lead': 'Quit DSH Desktop completely (its tray icon at the bottom right of the taskbar too) and close DSH Web; this continues by itself.',- 'card.newerUpdating.lead': 'DeepSeek Bot {version} can read them and is downloading ({p}%). After installing it reopens and copies the team.',- 'card.newer.lead': 'These chats were written by a newer DeepSeek Harness, which DeepSeek Bot can’t read yet.',++ 'card.newerUpdating.lead': 'DS Bot {version} can read them and is downloading ({p}%). After installing it reopens and copies the team.',++ 'card.newer.lead': 'These chats were written by a newer DeepSeek Harness, which DS Bot can’t read yet.',+ 'card.importFailed.lead': 'The team wasn’t fully copied: {reason}. The team in DeepSeek Harness is unchanged.',- 'card.update.available': 'DeepSeek Bot {version} is out and may fix this.',++ 'card.update.available': 'DS Bot {version} is out and may fix this.',+ 'card.update.downloading': 'Downloading {version} ({p}%, {a}/{b} MB)',+ 'card.update.installing': 'Installing; it reopens when done.',+ 'card.update.failed': 'The download failed.',+ 'card.update.slow': 'Download too slow?',+ // reason+ 'reason.place.space': 'Only {free} left on drive {drive}.',- 'reason.place.permission': 'DeepSeek Bot can’t write files in {path}.',++ 'reason.place.permission': 'DS Bot can’t write files in {path}.',+ 'reason.place.onedrive': '{path} is in OneDrive; syncing interrupts chats while they are being written.',+ 'reason.place.foreign': '{path} already has other files in it.',+ 'reason.place.dsh': '{path} is DeepSeek Harness’s data.',+ 'reason.place.program': '{path} is in the program folder, which uninstalling removes.',+ 'reason.place.nested': '{path} overlaps where the data is now.',+ 'reason.start.permission': 'No permission to write.',+ 'reason.start.space': 'Not enough disk space.',+ 'reason.start.files': 'Program files are incomplete; antivirus software may have blocked some of them.',+ 'reason.start.engine': 'The local engine stopped halfway through starting.',+ 'reason.start.other': 'Something unexpected happened.',+ 'reason.copy.inUse': 'a file is in use by another program',+ 'reason.copy.permission': 'no permission to read',+ 'reason.copy.full': 'the disk is full',+ // btn+ 'btn.retry': 'Try again',+ 'btn.wait': 'Keep waiting',+ 'btn.openLogs': 'Open log folder',+ 'btn.freshStart': 'Start with a new blank team…',+ 'btn.useRec': 'Put it on drive {rec}',+ 'btn.keepDrive': 'Keep it on drive {drive}',+ 'btn.otherPlace': 'Another location…',+ 'btn.pickPlace': 'Choose another location…',+ 'btn.changePlace': 'Change the location…',+ 'btn.relocate': 'Find it again…',+ 'btn.continue': 'Continue',+ 'btn.repick': 'Choose again…',+ 'btn.copy': 'Copy them over',+ 'btn.skipCopy': 'Don’t copy yet',+ 'btn.more': 'Details',+ 'btn.changeModel': 'Change',+ 'btn.stopCopy': 'Stop copying',+ 'btn.keepCopying': 'Keep copying',+ 'btn.startWithout': 'Start without the team',+ 'btn.copyDetails': 'Copy details',+ 'btn.copied': 'Copied',+ 'btn.details': 'Details',+ 'btn.install': 'Download and install',+ 'btn.manualDownload': 'Download manually',+ 'btn.reload': 'Reload',+ 'btn.move': 'Move and restart',+ 'btn.cancel': 'Cancel',+ 'btn.quit': 'Quit',+ 'btn.restart': 'Restart now',+ 'btn.download': 'Download',+ 'btn.notNowRestart': 'Not now',+ 'btn.notNowDownload': 'Not now',+ 'btn.ok': 'OK',+ // note+ 'note.changeLater': 'You can change this later in Settings → General → Location.',+ 'note.copyLater': 'You can also copy the team in Settings → General → Location.',+ 'note.copyAgain': 'You can copy the team later in Settings → General → Location.',+ // foot+ 'foot.community': 'A community open-source project, not an official DeepSeek product',+ 'foot.place.drive': 'Data on drive {drive}, {free} free',+ 'foot.place.driveOnly': 'Data on drive {drive}',+ 'foot.place.path': 'Data in {path}, {free} free',+ 'foot.place.pathOnly': 'Data in {path}',+ // status+ 'status.track': 'Start progress',+ 'status.phase.data': 'Prepare the data folder',+ 'status.phase.engine': 'Start the local engine',+ 'status.phase.team': 'Open the team',+ 'status.state.pending': 'Not started',+ 'status.state.active': 'In progress',+ 'status.state.done': 'Done',+ 'status.state.failed': 'Not finished',+ 'status.sr.active': '{phase}: in progress',+ 'status.sr.done': '{phase}: done',+ 'status.elapsed': '{n} s so far',+ // dialog- 'dialog.pickRoot': 'Choose where DeepSeek Bot keeps its data',- 'dialog.pickMove': 'Choose a new folder for DeepSeek Bot’s data',++ 'dialog.pickRoot': 'Choose where DS Bot keeps its data',++ 'dialog.pickMove': 'Choose a new folder for DS Bot’s data',+ 'dialog.move.inDsh': 'Choose a folder outside the DeepSeek Harness data ({home}).',+ 'dialog.move.inProgram': 'Choose a place outside the program folder: uninstalling removes the program folder.',+ 'dialog.move.drive': 'Choose a folder, not a whole drive.',+ 'dialog.move.nested': 'Choose a place outside the current data folder.',+ 'dialog.move.workspace': 'The data folder and the team workspace cannot hold each other.',+ 'dialog.move.notEmpty': 'Choose an empty folder or make a new one.',- 'dialog.move.confirm': 'Move DeepSeek Bot’s data to {to}?',- 'dialog.move.detail': 'DeepSeek Bot copies its data there and starts again. {from} stays as it is; you can delete it yourself once everything works.',++ 'dialog.move.confirm': 'Move DS Bot’s data to {to}?',++ 'dialog.move.detail': 'DS Bot copies its data there and starts again. {from} stays as it is; you can delete it yourself once everything works.',+ 'dialog.move.inUse': 'Another DeepSeek Harness is using this data, so it was not moved. Close it, then try again.',- 'dialog.move.failed': 'The data was not copied: {message}\n\nDeepSeek Bot goes on with its data where it was.',- 'dialog.import.found': 'DeepSeek Harness has {bots|Bot|Bots} and {groups|group chat|group chats}. Copy them into DeepSeek Bot?',++ 'dialog.move.failed': 'The data was not copied: {message}\n\nDS Bot goes on with its data where it was.',++ 'dialog.import.found': 'DeepSeek Harness has {bots|Bot|Bots} and {groups|group chat|group chats}. Copy them into DS Bot?',+ 'dialog.import.foundDetail': 'Copied: Bots, group chats, memory, chats, attachments, model settings and API Keys. Nothing in {home} changes; after the copy each side goes its own way.',+ 'dialog.import.inUse': 'DeepSeek Harness is using this team. Close it, then try again.',- 'dialog.import.newer': '{n|chat was|chats were} written by a newer DeepSeek Harness than this version of DeepSeek Bot can read. Update DeepSeek Bot first, then open it to copy the team.',- 'dialog.import.whichModels': 'Which model settings should DeepSeek Bot use?',- 'dialog.import.failed': 'The team wasn’t fully copied: {message}\n\nDeepSeek Bot starts with a new team. The team in DeepSeek Harness is unchanged.',- 'dialog.update.ready': 'DeepSeek Bot {version} has finished downloading.',++ 'dialog.import.newer': '{n|chat was|chats were} written by a newer DeepSeek Harness than this version of DS Bot can read. Update DS Bot first, then open it to copy the team.',++ 'dialog.import.whichModels': 'Which model settings should DS Bot use?',++ 'dialog.import.failed': 'The team wasn’t fully copied: {message}\n\nDS Bot starts with a new team. The team in DeepSeek Harness is unchanged.',++ 'dialog.update.ready': 'DS Bot {version} has finished downloading.',+ 'dialog.update.readyDetail': 'Restart now to update; if you don’t, it installs the next time you quit.',- 'dialog.update.available': 'DeepSeek Bot {version} is out.',- 'dialog.update.availableDetail': 'This version can’t update itself. Download the new version from its release page, then replace DeepSeek Bot in Applications with it.',- 'dialog.update.onFailure': 'DeepSeek Bot {version} installs itself when its download is done, and then opens again.',- 'dialog.update.onFailurePage': 'DeepSeek Bot {version} is out. Once this box is closed, its download page opens.',++ 'dialog.update.available': 'DS Bot {version} is out.',++ 'dialog.update.availableDetail': 'This version can’t update itself. Download the new version from its release page, then replace DS Bot in Applications with it.',++ 'dialog.update.onFailure': 'DS Bot {version} installs itself when its download is done, and then opens again.',++ 'dialog.update.onFailurePage': 'DS Bot {version} is out. Once this box is closed, its download page opens.',+ },+}++const PLACEHOLDER = /\{(\w+)(?:\|([^|}]*)\|([^}]*))?\}/gu++/** Fill {name} and {name|one|many} from vars; a placeholder without a value stays as it is. */+export function fill(text, vars) {+ return text.replace(PLACEHOLDER, (all, name, one, many) => {+ if (!(name in vars)) return all+ const value = String(vars[name])+ return one === undefined ? value : `${value} ${value === '1' ? one : many}`+ })+}++export function t(lang, key, vars) {+ const text = TEXT[lang]?.[key] ?? TEXT.zh[key] ?? key+ return vars ? fill(text, vars) : text+}++export const langOf = locale => (String(locale ?? '').toLowerCase().startsWith('zh') ? 'zh' : 'en')diff --cc app/test/import.test.mjsindex fda2d13b,7f9527cb..358bb28a--- a/app/test/import.test.mjs+++ b/app/test/import.test.mjs@@@ -84,9 -75,8 +84,9 @@@ const HOST_CREDENTIALS =function newHome(root) {const to = join(root, 'ds-bot')write(join(to, 'bot', 'state.json'), JSON.stringify({ version: 1, mainBotIds: [], bots: {}, rooms: {} }))- write(join(to, 'profiles', 'ds-bot', 'cordis.patch.yml'), '- id: llm-pi-ai\n config:\n providers: {}\n- id: webserver\n config:\n port: 0\n')+ write(join(to, '.credentials.yaml'), HOST_CREDENTIALS)+ write(join(to, 'profiles', 'ds-bot', 'cordis.patch.yml'), '- id: llm-pi-ai\n config:\n providers: {}\n- id: webserver\n config:\n port: 0\n- id: ui-settings-general\n config:\n welcomeNoticeVersion: seen\n')- const workspace = join(root, 'DeepSeek Bot')+ const workspace = join(root, 'DS Bot')write(join(workspace, 'kept.txt'), 'new kept')return { to, workspace }}diff --cc app/test/logs.test.mjsindex 3134aaae,00000000..b5d3fa82mode 100644,000000..100644--- a/app/test/logs.test.mjs+++ b/app/test/logs.test.mjs@@@ -1,109 -1,0 +1,109 @@@+import assert from 'node:assert/strict'+import { existsSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'+import { tmpdir } from 'node:os'+import { join } from 'node:path'+import { test } from 'node:test'+import { captureStdio, LogFile, logNames, redactor, rotate, shouldRotate, splitLines, tailLines } from '../src/logs.mjs'++const folder = (t) => {+ const dir = mkdtempSync(join(tmpdir(), 'ds-bot-logs-'))+ t.after(() => { rmSync(dir, { recursive: true, force: true, maxRetries: 5 }) })+ return dir+}+const at = () => new Date('2026-10-28T08:00:00.000Z')++// The CI user of the onboarding acceptance has a space and Chinese in its name.+const windows = redactor({ home: 'C:\\Users\\测试 用户', platform: 'win32' })++test('the launch token, API keys and the sign-in callback do not reach the log', () => {+ assert.equal(windows('GET http://127.0.0.1:52817/?token=Zm9v.YmFy&x=1'), 'GET http://127.0.0.1:52817/?token=<hidden>&x=1')+ assert.equal(windows('access_token=abc refresh_Token=def'), 'access_token=<hidden> refresh_Token=<hidden>')+ // The mock model's keys and the three DeepSeek-shaped ones of the acceptance.+ for (const key of ['sk-test-ok', 'sk-test-bad', 'sk-test-empty', `sk-${'0123456789abcdef'.repeat(2).slice(0, 28)}0001`, `sk-${'a'.repeat(28)}0401`, `sk-${'b'.repeat(28)}0000`]) {+ assert.equal(windows(`key "${key}" saved`), 'key "sk-<hidden>" saved')+ }+ assert.equal(windows('GET /oauth/callback?code=abc&state=def 302'), 'GET /oauth/callback?<hidden> 302')+ assert.equal(windows('Authorization: Bearer eyJh.eyJz.c2ln'), 'Authorization: Bearer <hidden>')+})++test('the home folder becomes %USERPROFILE% in every spelling', () => {+ assert.equal(windows('data C:\\Users\\测试 用户\\.ds-bot'), 'data %USERPROFILE%\\.ds-bot')- assert.equal(windows('url file:///c:/users/测试 用户/DeepSeek Bot'), 'url file:///%USERPROFILE%/DeepSeek Bot')++ assert.equal(windows('url file:///c:/users/测试 用户/DS Bot'), 'url file:///%USERPROFILE%/DS Bot')+ assert.equal(windows('{"dataDir":"C:\\\\Users\\\\测试 用户\\\\.ds-bot"}'), '{"dataDir":"%USERPROFILE%\\\\.ds-bot"}')+ assert.equal(windows('cwd C:\\Users\\测试 用户'), 'cwd %USERPROFILE%')+ // Another user whose name starts the same way is not this one.+ assert.equal(windows('C:\\Users\\测试 用户2\\x'), 'C:\\Users\\测试 用户2\\x')+ const posix = redactor({ home: '/home/Alice', platform: 'linux' })+ assert.equal(posix('/home/Alice/.ds-bot and file:///home/Alice'), '~/.ds-bot and file://~')+ assert.equal(posix('/home/Alicey/x /HOME/Alice'), '/home/Alicey/x /HOME/Alice')+ assert.equal(redactor({ home: '/', platform: 'linux' })('/usr/bin'), '/usr/bin')+})++test('redaction keeps ordinary words and can run twice', () => {+ assert.equal(windows('desk-top task-runner risk-free'), 'desk-top task-runner risk-free')+ const line = 'GET /oauth/callback?code=1 ?token=2 sk-test-ok Bearer x C:\\Users\\测试 用户\\a'+ assert.equal(windows(windows(line)), windows(line))+})++test('output splits into whole lines; the rest waits', () => {+ assert.deepEqual(splitLines('', 'one\r\ntwo\nthr'), { lines: ['one', 'two'], rest: 'thr' })+ assert.deepEqual(splitLines('thr', 'ee\n'), { lines: ['three'], rest: '' })+ const long = 'x'.repeat(9000)+ assert.deepEqual(splitLines('', long), { lines: [long], rest: '' })+ assert.deepEqual(tailLines('a\nb\nc\n', 2), ['b', 'c'])+})++test('a write that would pass 2 MB goes into a fresh file, three files at most', (t) => {+ assert.equal(shouldRotate(0, 5 * 1024 * 1024), false)+ assert.equal(shouldRotate(2 * 1024 * 1024 - 10, 10), false)+ assert.equal(shouldRotate(2 * 1024 * 1024 - 10, 11), true)+ assert.deepEqual(logNames(), ['main.log', 'main.1.log', 'main.2.log'])+ const dir = folder(t)+ writeFileSync(join(dir, 'main.log'), 'newest\n')+ writeFileSync(join(dir, 'main.1.log'), 'older\n')+ writeFileSync(join(dir, 'main.2.log'), 'oldest\n')+ rotate(dir)+ assert.deepEqual(readdirSync(dir).sort(), ['main.1.log', 'main.2.log'])+ assert.equal(readFileSync(join(dir, 'main.1.log'), 'utf8'), 'newest\n')+ assert.equal(readFileSync(join(dir, 'main.2.log'), 'utf8'), 'older\n')+})++test('the log rotates by size and its tail reads across the files', (t) => {+ const dir = folder(t)+ const log = new LogFile({ dir, limit: 400, redact: windows, now: at })+ for (let index = 0; index < 40; index += 1) log.write('main', `line ${String(index)} C:\\Users\\测试 用户\n`)+ log.write('engine', 'partial')+ log.close()+ assert.deepEqual(readdirSync(dir).sort(), ['main.1.log', 'main.2.log', 'main.log'])+ for (const name of logNames()) assert.ok(readFileSync(join(dir, name)).length <= 400, name)+ const last = readFileSync(join(dir, 'main.log'), 'utf8').trim().split('\n').at(-1)+ assert.equal(last, '2026-10-28T08:00:00.000Z [engine] partial')+ const tail = log.tail(12)+ assert.equal(tail.length, 12)+ assert.equal(tail.at(-2), '2026-10-28T08:00:00.000Z [main] line 39 %USERPROFILE%')+ assert.ok(tail.every(line => !line.includes('测试')))+})++test('a log that cannot be written does not stop the app', (t) => {+ const dir = folder(t)+ const blocked = join(dir, 'file')+ writeFileSync(blocked, '')+ const log = new LogFile({ dir: join(blocked, 'logs'), now: at })+ log.write('main', 'lost\n')+ assert.deepEqual(log.tail(5), [])+ assert.equal(existsSync(join(blocked, 'logs')), false)+})++test('the console goes on as before and into the log', (t) => {+ const dir = folder(t)+ const log = new LogFile({ dir, redact: windows, now: at })+ const seen = []+ const stream = { write: (chunk) => { seen.push(String(chunk)); return true } }+ const raw = captureStdio(log, { stdout: stream })+ stream.write('hello sk-test-ok\n')+ stream.write(Buffer.from('bytes\n'))+ raw.stdout('only the console\n')+ log.close()+ assert.deepEqual(seen, ['hello sk-test-ok\n', 'bytes\n', 'only the console\n'])+ assert.equal(readFileSync(join(dir, 'main.log'), 'utf8'), '2026-10-28T08:00:00.000Z [main] hello sk-<hidden>\n2026-10-28T08:00:00.000Z [main] bytes\n')+})diff --cc app/test/main-first-run.test.mjsindex 00000000,af108cea..b85e8b64mode 000000,100644..100644--- a/app/test/main-first-run.test.mjs+++ b/app/test/main-first-run.test.mjs@@@ -1,0 -1,31 +1,23 @@@-// The first run asks where the app keeps its data. A quit while it asks ends the app-// even when the dialog never answers it (#401), and the places stay unwritten.++// The first run asks where the app keeps its data, on the start page. A quit while it asks++// ends the app even when the page never answers it (#401).+ import assert from 'node:assert/strict'-import { existsSync } from 'node:fs'+ import { join } from 'node:path'+ import { after, before, test } from 'node:test'+ import { app, paths, state } from './helpers/fake-electron.mjs'+ import { startApp, waitFor } from './helpers/app-harness.mjs'+ import { installHooks } from './helpers/register.mjs'++ await installHooks()+-before(async () => {- // The first-run dialog never answers.- state.dialogAnswer = () => new Promise(() => {})- await startApp({ firstRun: true })-})++before(async () => { await startApp({ firstRun: true }) })++ after(() => { app.emit('will-quit') })+-test('a quit while the first run is asking ends the app even when the dialog never answers', async () => {- await waitFor(() => state.dialogs.length > 0, 'ask for the places')- app.quit()- assert.equal(state.quitPrevented, true, 'the quit waits for the first run')- await waitFor(() => state.exits.length > 0, 'leave anyway')- assert.equal(state.exits[0], 0)-})++const isStart = win => (win.options.webPreferences?.additionalArguments ?? []).some(arg => arg.startsWith('--ds-bot-start='))+-test('the first run that is quit wrote nothing', () => {- assert.equal(existsSync(join(paths.userData, 'locations.json')), false)++test('a quit while the first run is up ends the app', async () => {++ await waitFor(() => state.windows.some(isStart), 'the start window')++ app.quit()++ // An un-prevented quit tears the windows down; a held one quits again once the hold lifts.++ await waitFor(() => state.windows.every(win => win.destroyed), 'leave anyway')+ })diff --cc app/test/main.test.mjsindex 51d3eb38,a10bd8bf..d7352866--- a/app/test/main.test.mjs+++ b/app/test/main.test.mjs@@@ -13,9 -13,9 +13,9 @@@ await installHooks(before(async () => { await startApp() })test('the app starts with a window and a tray', async () => {- await waitFor(() => state.windows.length > 0, 'open the window')+ await waitFor(() => window() !== undefined, 'open the window')await waitFor(() => state.tray !== undefined, 'build the tray')- assert.equal(state.tray.tooltip, 'DeepSeek Bot')+ assert.equal(state.tray.tooltip, 'DS Bot')assert.equal(state.quits, 0, 'the app goes on')})diff --cc app/test/place.test.mjsindex 5112d9d1,00000000..1f6d6906mode 100644,000000..100644--- a/app/test/place.test.mjs+++ b/app/test/place.test.mjs@@@ -1,196 -1,0 +1,196 @@@+import assert from 'node:assert/strict'+import { existsSync, mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'+import { tmpdir } from 'node:os'+import { join, parse, resolve, sep } from 'node:path'+import { test } from 'node:test'+import { currentRootOf, DATA_DIR, driveOf, formatBytes, freeSpace, isEmptyTree, LAYER, pickFrom, placeOf, rootOf, shortPath, WORKSPACE_DIR } from '../src/place.mjs'++const win32 = process.platform === 'win32'+const temp = (t) => {+ const dir = mkdtempSync(join(tmpdir(), 'ds-bot-place-'))+ t.after(() => { rmSync(dir, { recursive: true, force: true }) })+ return dir+}++test('free space is read at the nearest existing ancestor of a folder that is not there yet', (t) => {+ const dir = temp(t)+ const free = freeSpace(join(dir, 'not', 'yet'))+ assert.equal(typeof free, 'number')+ assert.ok(free > 0)+ assert.equal(freeSpace(join(dir, 'not', 'yet')), freeSpace(dir))+})++// Explorer's units: GB and MB of 1024, so the line agrees with what the user sees there.+test('sizes read as Explorer shows them', () => {+ assert.equal(formatBytes(412.7 * 2 ** 30), '412 GB')+ assert.equal(formatBytes(10 * 2 ** 30), '10 GB')+ assert.equal(formatBytes(1.26 * 2 ** 30), '1.2 GB')+ assert.equal(formatBytes(900 * 2 ** 20), '900 MB')+ assert.equal(formatBytes(undefined), undefined)+ assert.equal(formatBytes(-1), undefined)+})++test('the drive letter is read from a Windows path only', () => {+ if (win32) {+ assert.equal(driveOf('C:\\Users\\me\\.ds-bot'), 'C')- assert.equal(driveOf('d:/DeepSeek Bot'), 'D')++ assert.equal(driveOf('d:/DS Bot'), 'D')+ } else {+ assert.equal(driveOf('/home/user/.ds-bot'), undefined)+ }+})++test('a path under the home folder is written with ~', () => {+ const home = resolve('/home/user')+ assert.equal(shortPath(join(home, '.ds-bot'), home), `~${sep}.ds-bot`)+ assert.equal(shortPath(home, home), '~')+ assert.equal(shortPath(resolve('/srv/data'), home), resolve('/srv/data'))+})++test('the place line names the drive and its free space, or the folder', () => {+ if (win32) {+ assert.deepEqual(placeOf('C:\\Users\\me\\.ds-bot', { free: 412 * 2 ** 30 }), { drive: 'C', free: '412 GB' })+ assert.deepEqual(placeOf('C:\\Users\\me\\.ds-bot', { free: undefined }), { drive: 'C' })+ } else {+ assert.deepEqual(placeOf('/home/user/.ds-bot', { home: '/home/user', free: 1.5 * 2 ** 30 }), { path: `~${sep}.ds-bot`, free: '1.5 GB' })+ }+})++test('the picker opens in the data folder\'s parent', (t) => {+ const dir = temp(t)- assert.equal(pickFrom(join(dir, 'DeepSeek Bot', 'data')), join(dir, 'DeepSeek Bot'))++ assert.equal(pickFrom(join(dir, 'DS Bot', 'data')), join(dir, 'DS Bot'))+})++test('the current root is the parent of a data and a workspace folder that are siblings', (t) => {+ const dir = temp(t)+ assert.equal(currentRootOf(join(dir, 'R', DATA_DIR), join(dir, 'R', WORKSPACE_DIR)), join(dir, 'R'))+ // The default places are not under one root.- assert.equal(currentRootOf(join(dir, '.ds-bot'), join(dir, 'DeepSeek Bot')), undefined)++ assert.equal(currentRootOf(join(dir, '.ds-bot'), join(dir, 'DS Bot')), undefined)+ assert.equal(currentRootOf(join(dir, 'R', DATA_DIR), undefined), undefined)+})++test('an empty tree holds nothing but empty folders', (t) => {+ const dir = temp(t)+ mkdirSync(join(dir, 'a', 'b'), { recursive: true })+ assert.equal(isEmptyTree(dir), true)+ writeFileSync(join(dir, 'a', 'b', 'file'), '')+ assert.equal(isEmptyTree(dir), false)+ assert.equal(isEmptyTree(join(dir, 'missing')), false)+})++// The root rule of windows-onboarding §3 (一个位置), without the write probe.+const noProbe = { env: {}, probe: false }++test('a new or empty folder is the root itself', (t) => {+ const dir = temp(t)+ const fresh = join(dir, 'new')+ assert.deepEqual(rootOf(fresh, noProbe), { root: fresh, dataDir: join(fresh, DATA_DIR), workspace: join(fresh, WORKSPACE_DIR), added: false })+ const empty = join(dir, 'empty')+ mkdirSync(empty)+ assert.deepEqual(rootOf(empty, noProbe), { root: empty, dataDir: join(empty, DATA_DIR), workspace: join(empty, WORKSPACE_DIR), added: false })+})+- test('a drive or a folder with other things in it gets a DeepSeek Bot layer', (t) => {++test('a drive or a folder with other things in it gets a DS Bot layer', (t) => {+ const dir = temp(t)+ writeFileSync(join(dir, 'notes.txt'), '')+ const layered = rootOf(dir, noProbe)+ assert.equal(layered.root, join(dir, LAYER))+ assert.equal(layered.added, true)+ assert.equal(layered.reason, undefined)+ const drive = parse(dir).root+ const atDrive = rootOf(drive, noProbe)+ assert.equal(atDrive.root, join(drive, LAYER))+ assert.equal(atDrive.added, true)+})++test('an empty root of the app\'s own is used again; someone else\'s layer is refused', (t) => {+ const dir = temp(t)+ mkdirSync(join(dir, DATA_DIR, 'profiles'), { recursive: true })+ mkdirSync(join(dir, WORKSPACE_DIR))+ assert.equal(rootOf(dir, noProbe).added, false)+ const busy = temp(t)+ writeFileSync(join(busy, 'notes.txt'), '')+ mkdirSync(join(busy, LAYER))+ writeFileSync(join(busy, LAYER, 'theirs.txt'), '')+ const refused = rootOf(busy, noProbe)+ assert.equal(refused.reason, 'foreign')+ assert.equal(refused.at, join(busy, LAYER))+ const file = join(dir, 'a-file')+ writeFileSync(file, '')+ assert.equal(rootOf(file, noProbe).reason, 'foreign')+})++test('the place the data is in now is no change, and a place inside it is refused', (t) => {+ const dir = temp(t)+ const current = { dataDir: join(dir, 'R', DATA_DIR), workspace: join(dir, 'R', WORKSPACE_DIR) }+ mkdirSync(join(current.dataDir, 'profiles'), { recursive: true })+ mkdirSync(current.workspace)+ for (const same of [join(dir, 'R'), current.dataDir, `${join(dir, 'R')}${sep}`]) assert.deepEqual(rootOf(same, { ...noProbe, current }), { same: true })+ const inside = rootOf(join(current.dataDir, 'old'), { ...noProbe, current })+ assert.equal(inside.reason, 'nested')+ assert.equal(inside.at, join(current.dataDir, 'old'))+ // The team workspace with something in it is a place too; an empty one, just made, is free.+ writeFileSync(join(current.workspace, 'notes.md'), '')+ assert.equal(rootOf(join(current.workspace, 'sub'), { ...noProbe, current }).reason, 'nested')+ // The default places: picking the home puts the root on the workspace the start made.+ const home = join(dir, 'home')- mkdirSync(join(home, 'DeepSeek Bot'), { recursive: true })++ mkdirSync(join(home, 'DS Bot'), { recursive: true })+ writeFileSync(join(home, 'other.txt'), '')- const defaults = { dataDir: join(home, '.ds-bot'), workspace: join(home, 'DeepSeek Bot') }++ const defaults = { dataDir: join(home, '.ds-bot'), workspace: join(home, 'DS Bot') }+ const atHome = rootOf(home, { ...noProbe, current: defaults })+ assert.equal(atHome.reason, undefined)- assert.equal(atHome.root, join(home, 'DeepSeek Bot'))++ assert.equal(atHome.root, join(home, 'DS Bot'))+ assert.equal(atHome.added, true)- assert.equal(rootOf(join(home, 'DeepSeek Bot'), { ...noProbe, current: defaults }).added, false)++ assert.equal(rootOf(join(home, 'DS Bot'), { ...noProbe, current: defaults }).added, false)+ // Once the workspace holds files, the layer the home pick would add is a used folder.- writeFileSync(join(home, 'DeepSeek Bot', 'theirs.txt'), '')++ writeFileSync(join(home, 'DS Bot', 'theirs.txt'), '')+ assert.equal(rootOf(home, { ...noProbe, current: defaults }).reason, 'foreign')- assert.equal(rootOf(join(home, 'DeepSeek Bot', 'sub'), { ...noProbe, current: defaults }).reason, 'nested')++ assert.equal(rootOf(join(home, 'DS Bot', 'sub'), { ...noProbe, current: defaults }).reason, 'nested')+ assert.equal(rootOf(join(home, 'elsewhere'), { ...noProbe, current: defaults }).reason, undefined)+})++test('a folder that cannot be read counts as one without permission', { skip: !win32 || !existsSync('C:\\System Volume Information') }, () => {+ const refused = rootOf('C:\\System Volume Information', noProbe)+ assert.equal(refused.reason, 'permission')+ assert.equal(refused.at, 'C:\\System Volume Information')+})++test('OneDrive, the DSH home and the program folder are refused, through links too', (t) => {+ const dir = temp(t)+ const cloud = join(dir, 'OneDrive', 'Docs')+ assert.equal(rootOf(cloud, noProbe).reason, 'onedrive')+ assert.equal(rootOf(cloud, noProbe).at, cloud)+ assert.equal(rootOf(join(dir, 'OneDrive - Contoso', 'Docs'), noProbe).reason, 'onedrive')+ assert.equal(rootOf(join(dir, 'Library', 'CloudStorage', 'OneDrive-Personal', 'Docs'), noProbe).reason, 'onedrive')+ // A folder that only has OneDrive in its name is not the cloud.+ assert.equal(rootOf(join(dir, 'OneDrive-old', 'Docs'), noProbe).reason, undefined)+ const synced = join(dir, 'Synced')+ assert.equal(rootOf(synced, { ...noProbe, env: { OneDrive: join(dir, 'Synced') } }).reason, 'onedrive')+ const dsh = join(dir, '.dsh')+ mkdirSync(dsh)+ const inDsh = rootOf(join(dsh, 'bots'), { ...noProbe, dshHome: dsh })+ assert.equal(inDsh.reason, 'dsh')+ assert.equal(inDsh.at, join(dsh, 'bots'))+ assert.equal(rootOf(dir, { ...noProbe, dshHome: join(dir, 'missing-dsh') }).reason, undefined)+ assert.equal(rootOf(join(dir, 'app', 'data'), { ...noProbe, program: join(dir, 'app') }).reason, 'program')+ // A link into the DSH home leads there.+ const link = join(dir, 'link')+ try {+ symlinkSync(dsh, link, 'junction')+ } catch {+ return+ }+ assert.equal(rootOf(join(link, 'bots'), { ...noProbe, dshHome: dsh }).reason, 'dsh')+})++test('the write probe makes only the missing layers and takes them away again', (t) => {+ const dir = temp(t)+ const fresh = join(dir, 'deep', 'er')+ const root = rootOf(fresh, { env: {} })+ assert.equal(root.reason, undefined)+ assert.equal(existsSync(join(dir, 'deep')), false)+ const kept = join(dir, 'kept')+ mkdirSync(kept)+ rootOf(kept, { env: {} })+ assert.equal(existsSync(kept), true)+ assert.equal(existsSync(join(kept, DATA_DIR)), false)+})diff --cc app/test/release-notes.test.mjsindex dabab44b,00000000..565129f4mode 100644,000000..100644--- a/app/test/release-notes.test.mjs+++ b/app/test/release-notes.test.mjs@@@ -1,164 -1,0 +1,164 @@@+import assert from 'node:assert/strict'+import { spawnSync } from 'node:child_process'+import { createHash } from 'node:crypto'+import { mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'+import { tmpdir } from 'node:os'+import { join } from 'node:path'+import { test } from 'node:test'+import { fileURLToPath } from 'node:url'+import YAML from 'yaml'+import { checksums, copyName, downloadBlock, formatSize, missingPackages, PACKAGES, packageName, withDownloads } from '../scripts/release-notes.mjs'++const script = fileURLToPath(new URL('../scripts/release-notes.mjs', import.meta.url))+const read = file => readFileSync(new URL(file, import.meta.url), 'utf8')+const names = version => PACKAGES.map(entry => packageName(version, entry))+const MB = 1024 ** 2++test('the packages carry the names electron-builder gives them, and copies drop the version', () => {- assert.match(read('../electron-builder.yml'), /^artifactName: DeepSeek-Bot-\$\{version\}-\$\{os\}-\$\{arch\}\.\$\{ext\}$/mu)++ assert.match(read('../electron-builder.yml'), /^artifactName: DS-Bot-\$\{version\}-\$\{os\}-\$\{arch\}\.\$\{ext\}$/mu)+ assert.deepEqual(names('0.2.3'), [- 'DeepSeek-Bot-0.2.3-win-x64.exe',- 'DeepSeek-Bot-0.2.3-mac-arm64.zip',- 'DeepSeek-Bot-0.2.3-mac-x64.zip',- 'DeepSeek-Bot-0.2.3-linux-x86_64.AppImage',- 'DeepSeek-Bot-0.2.3-linux-amd64.deb',++ 'DS-Bot-0.2.3-win-x64.exe',++ 'DS-Bot-0.2.3-mac-arm64.zip',++ 'DS-Bot-0.2.3-mac-x64.zip',++ 'DS-Bot-0.2.3-linux-x86_64.AppImage',++ 'DS-Bot-0.2.3-linux-amd64.deb',+ ])+ assert.deepEqual(PACKAGES.map(copyName), [- 'DeepSeek-Bot-win-x64.exe',- 'DeepSeek-Bot-mac-arm64.zip',- 'DeepSeek-Bot-mac-x64.zip',- 'DeepSeek-Bot-linux-x86_64.AppImage',- 'DeepSeek-Bot-linux-amd64.deb',++ 'DS-Bot-win-x64.exe',++ 'DS-Bot-mac-arm64.zip',++ 'DS-Bot-mac-x64.zip',++ 'DS-Bot-linux-x86_64.AppImage',++ 'DS-Bot-linux-amd64.deb',+ ])+})++test('sizes are whole megabytes, as GitHub shows them', () => {+ assert.equal(formatSize(222_174_558), '212 MB')+ assert.equal(formatSize(10), '1 MB')+})++test('the table lists Windows first, then macOS and Linux, and says which files are not for download', () => {+ const sizes = Object.fromEntries(names('0.2.3').map((name, index) => [name, (index + 1) * 100 * MB]))+ const block = downloadBlock({ version: '0.2.3', sizes })+ const rows = block.split('\n').filter(line => line.startsWith('| ') && !line.startsWith('| System'))+ assert.equal(rows.length, 5)- assert.match(rows[0], /^\| \*\*Windows 10\/11 \(64-bit \/ 64 位\)\*\*<br>Double-click to install \/ 双击安装 \| \[DeepSeek-Bot-0\.2\.3-win-x64\.exe\]\(https:\/\/github\.com\/Fei2411\/DS-Bot\/releases\/download\/v0\.2\.3\/DeepSeek-Bot-0\.2\.3-win-x64\.exe\) \| 100 MB \|$/u)++ assert.match(rows[0], /^\| \*\*Windows 10\/11 \(64-bit \/ 64 位\)\*\*<br>Double-click to install \/ 双击安装 \| \[DS-Bot-0\.2\.3-win-x64\.exe\]\(https:\/\/github\.com\/Fei2411\/DS-Bot\/releases\/download\/v0\.2\.3\/DS-Bot-0\.2\.3-win-x64\.exe\) \| 100 MB \|$/u)+ assert.match(rows[1], /^\| macOS, Apple chip .*mac-arm64\.zip.*\| 200 MB \|$/u)+ assert.match(rows[2], /^\| macOS, Intel .*mac-x64\.zip.*\| 300 MB \|$/u)+ assert.match(rows[3], /^\| Linux, AppImage .*linux-x86_64\.AppImage.*\| 400 MB \|$/u)+ assert.match(rows[4], /^\| Linux, deb .*linux-amd64\.deb.*\| 500 MB \|$/u)+ assert.match(block, /^## Download \/ 下载$/mu)+ assert.match(block, /The `\.blockmap`, `latest\*\.yml` and `ds-bot-\*\.tgz` files and the source code archives are for updates and the plugin/u)+ assert.match(block, /\[SHA256SUMS\.txt\]\(https:\/\/github\.com\/Fei2411\/DS-Bot\/releases\/download\/v0\.2\.3\/SHA256SUMS\.txt\)/u)+ assert.doesNotMatch(block, /Mirror/u)+})++test('a mirror comes before GitHub, and a fork links to its own releases', () => {+ const sizes = Object.fromEntries(names('0.2.3').map(name => [name, MB]))+ const block = downloadBlock({ version: '0.2.3', sizes, repo: 'someone/DS-Bot', mirror: 'https://mirror.example/ds-bot/v0.2.3/' })- assert.match(block, /\| DeepSeek-Bot-0\.2\.3-win-x64\.exe: \[Mirror \/ 国内镜像\]\(https:\/\/mirror\.example\/ds-bot\/v0\.2\.3\/DeepSeek-Bot-0\.2\.3-win-x64\.exe\) · \[GitHub\]\(https:\/\/github\.com\/someone\/DS-Bot\/releases\/download\/v0\.2\.3\/DeepSeek-Bot-0\.2\.3-win-x64\.exe\) \|/u)++ assert.match(block, /\| DS-Bot-0\.2\.3-win-x64\.exe: \[Mirror \/ 国内镜像\]\(https:\/\/mirror\.example\/ds-bot\/v0\.2\.3\/DS-Bot-0\.2\.3-win-x64\.exe\) · \[GitHub\]\(https:\/\/github\.com\/someone\/DS-Bot\/releases\/download\/v0\.2\.3\/DS-Bot-0\.2\.3-win-x64\.exe\) \|/u)+ assert.doesNotMatch(block, /Fei2411/u)+})++test('SHA256SUMS.txt lists each package under both of its names, in the format sha256sum checks', () => {+ const hashes = Object.fromEntries(names('0.2.3').map((name, index) => [name, String(index).repeat(64)]))+ const lines = checksums('0.2.3', hashes).split('\n')+ assert.equal(lines.pop(), '')+ assert.equal(lines.length, 10)- assert.equal(lines[0], `${'0'.repeat(64)} DeepSeek-Bot-0.2.3-win-x64.exe`)- assert.equal(lines[1], `${'0'.repeat(64)} DeepSeek-Bot-win-x64.exe`)- assert.equal(lines[9], `${'4'.repeat(64)} DeepSeek-Bot-linux-amd64.deb`)++ assert.equal(lines[0], `${'0'.repeat(64)} DS-Bot-0.2.3-win-x64.exe`)++ assert.equal(lines[1], `${'0'.repeat(64)} DS-Bot-win-x64.exe`)++ assert.equal(lines[9], `${'4'.repeat(64)} DS-Bot-linux-amd64.deb`)+})++test('a missing package is named; other files in the folder do not count', () => {- const present = ['DeepSeek-Bot-0.2.3-win-x64.exe', 'DeepSeek-Bot-0.2.3-win-x64.exe.blockmap', 'DeepSeek-Bot-mac-arm64.zip', 'DeepSeek-Bot-0.2.2-mac-x64.zip',- 'DeepSeek-Bot-0.2.3-linux-x86_64.AppImage', 'DeepSeek-Bot-0.2.3-linux-amd64.deb', 'latest.yml']- assert.deepEqual(missingPackages('0.2.3', present), ['DeepSeek-Bot-0.2.3-mac-arm64.zip', 'DeepSeek-Bot-0.2.3-mac-x64.zip'])++ const present = ['DS-Bot-0.2.3-win-x64.exe', 'DS-Bot-0.2.3-win-x64.exe.blockmap', 'DS-Bot-mac-arm64.zip', 'DS-Bot-0.2.2-mac-x64.zip',++ 'DS-Bot-0.2.3-linux-x86_64.AppImage', 'DS-Bot-0.2.3-linux-amd64.deb', 'latest.yml']++ assert.deepEqual(missingPackages('0.2.3', present), ['DS-Bot-0.2.3-mac-arm64.zip', 'DS-Bot-0.2.3-mac-x64.zip'])+ assert.deepEqual(missingPackages('0.2.3', names('0.2.3')), [])+})++test('the table goes on top of the notes, and a second run replaces it', () => {+ const sizes = Object.fromEntries(names('0.2.3').map(name => [name, MB]))+ const block = downloadBlock({ version: '0.2.3', sizes })+ const once = withDownloads('## What changed\r\n\r\n- Fixed it\r\n', block)+ assert.ok(once.startsWith(`${block}\n\n## What changed`))+ assert.equal(withDownloads(once, block), once)+ const bigger = downloadBlock({ version: '0.2.3', sizes: Object.fromEntries(names('0.2.3').map(name => [name, 2 * MB])) })+ const again = withDownloads(once, bigger)+ assert.ok(again.startsWith(`${bigger}\n\n## What changed`))+ assert.equal(again.split('## Download / 下载').length, 2)+ assert.equal(withDownloads('', block), `${block}\n`)+})++test('the script hashes and copies the packages and prints the notes', (t) => {+ const work = mkdtempSync(join(tmpdir(), 'ds-bot-release-notes-'))+ t.after(() => { rmSync(work, { recursive: true, force: true }) })+ const from = join(work, 'packages')+ const to = join(work, 'attach')+ mkdirSync(from)+ for (const name of names('0.2.3')) writeFileSync(join(from, name), `package ${name}`)- writeFileSync(join(from, 'DeepSeek-Bot-0.2.3-win-x64.exe.blockmap'), 'map')++ writeFileSync(join(from, 'DS-Bot-0.2.3-win-x64.exe.blockmap'), 'map')+ writeFileSync(join(work, 'notes.md'), '- Fixed it\n')+ const env = { ...process.env, GITHUB_REPOSITORY: '', MIRROR_BASE: '' }+ const run = spawnSync(process.execPath, [script, '0.2.3', from, to, join(work, 'notes.md')], { encoding: 'utf8', env })+ assert.equal(run.status, 0, run.stderr)+ assert.ok(run.stdout.startsWith('<!-- downloads -->\n## Download / 下载\n'))+ assert.ok(run.stdout.endsWith('<!-- /downloads -->\n\n- Fixed it\n'))- assert.match(run.stdout, /\/Fei2411\/DS-Bot\/releases\/download\/v0\.2\.3\/DeepSeek-Bot-0\.2\.3-win-x64\.exe/u)++ assert.match(run.stdout, /\/Fei2411\/DS-Bot\/releases\/download\/v0\.2\.3\/DS-Bot-0\.2\.3-win-x64\.exe/u)+ assert.deepEqual(readdirSync(to).sort(), [...PACKAGES.map(copyName), 'SHA256SUMS.txt'].sort())+ const sums = readFileSync(join(to, 'SHA256SUMS.txt'), 'utf8')+ for (const entry of PACKAGES) {+ const name = packageName('0.2.3', entry)+ const hash = createHash('sha256').update(`package ${name}`).digest('hex')+ assert.ok(sums.includes(`${hash} ${name}\n`) && sums.includes(`${hash} ${copyName(entry)}\n`), name)+ assert.equal(readFileSync(join(to, copyName(entry)), 'utf8'), `package ${name}`)+ }+})++test('the script stops when a package is missing, so the release is not marked Latest', (t) => {+ const work = mkdtempSync(join(tmpdir(), 'ds-bot-release-notes-'))+ t.after(() => { rmSync(work, { recursive: true, force: true }) })+ for (const name of names('0.2.3').slice(1)) writeFileSync(join(work, name), name)+ const run = spawnSync(process.execPath, [script, '0.2.3', work, join(work, 'attach')], { encoding: 'utf8' })+ assert.equal(run.status, 1)- assert.match(run.stderr, /has no DeepSeek-Bot-0\.2\.3-win-x64\.exe$/mu)++ assert.match(run.stderr, /has no DS-Bot-0\.2\.3-win-x64\.exe$/mu)+})++// A releases/latest link must never reach a release whose files are still being attached.+test('the release becomes Latest last, after every job that attaches files', () => {+ const workflow = YAML.parse(read('../../.github/workflows/release.yml'))+ const runs = job => (job.steps ?? []).map(step => step.run ?? '').join('\n')+ const latest = Object.entries(workflow.jobs).filter(([, job]) => /gh release edit "\$TAG" --latest/u.test(runs(job)))+ assert.equal(latest.length, 1)+ const [name, job] = latest[0]+ const before = (jobName, seen = new Set()) => {+ for (const need of [workflow.jobs[jobName].needs ?? []].flat()) if (!seen.has(need)) before(need, seen.add(need))+ return seen+ }+ const uploaders = Object.keys(workflow.jobs).filter(other => other !== name && /gh release upload/u.test(runs(workflow.jobs[other])))+ assert.ok(uploaders.length >= 4)+ for (const uploader of uploaders) assert.ok(before(name).has(uploader), `${name} must come after ${uploader}`)+ assert.match(job.steps.at(-1).run, /^gh release edit "\$TAG" --latest$/u)+ assert.match(runs(job), /node scripts\/release-notes\.mjs /u)+})++test('both READMEs open with the same download block, a Windows link and the not-official line', () => {+ for (const file of ['../../README.md', '../../README.zh.md']) {+ const top = read(file).split(/\r?\n/u).slice(0, 10).join('\n')+ assert.match(top, /\(https:\/\/github\.com\/Fei2411\/DS-Bot\/releases\/latest\)/u, file)+ assert.match(top, /Windows 10\/11/u, file)+ assert.match(top, /not an official DeepSeek product/u, file)+ assert.match(top, /不是 DeepSeek 官方产品/u, file)+ }+ const block = (file) => {+ const lines = read(file).split(/\r?\n/u)- return lines.slice(lines.findIndex(line => line.startsWith('**[Download DeepSeek Bot')), lines.findIndex(line => line.startsWith('**DeepSeek Bot**:')) + 1)++ return lines.slice(lines.findIndex(line => line.startsWith('**[Download DS Bot')), lines.findIndex(line => line.startsWith('**DS Bot**:')) + 1)+ }+ assert.ok(block('../../README.md').length > 10)+ assert.deepEqual(block('../../README.zh.md'), block('../../README.md'))+ // Edge shows Keep anyway only under Show more.+ assert.match(block('../../README.md').join('\n'), /\*\*Keep\*\* → \*\*Show more\*\* → \*\*Keep anyway\*\*/u)+ assert.match(block('../../README.md').join('\n'), /「保留」→「显示更多」→「仍然保留」/u)+ for (const file of ['../../README.md', '../../README.zh.md'])+ assert.doesNotMatch(read(file), /ds-bot-\d+\.\d+\.\d+\.tgz|DS-Bot#v\d/u, file)+})diff --cc app/test/start-window.test.mjsindex 08150943,00000000..6cdc538fmode 100644,000000..100644--- a/app/test/start-window.test.mjs+++ b/app/test/start-window.test.mjs@@@ -1,667 -1,0 +1,667 @@@+import assert from 'node:assert/strict'+import { EventEmitter } from 'node:events'+import { mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'+import { tmpdir } from 'node:os'+import { join } from 'node:path'+import { test } from 'node:test'+import { readStartFrame, writeStartFrame } from '../src/start-frame.mjs'+import {+ acceptsAct, centred, clampInto, clockMs, cubicBezier, detailsText, explainOf, failureReason, fallbackMs, GROWTH, GROWTH_EASING,+ growthSteps, isStartPage, MAIN_SIZE, mainRect, START_ACT, START_ACTS, START_STATE, startSize, startSnapshot, startUrl, StartWindow,+ TEAM_VIEW_MS, WATCHDOG_MS,+} from '../src/start-window.mjs'++const AREA = { x: 0, y: 0, width: 1920, height: 1040 }++test('the start window is 720 × 540, and 720 × 500 on a work area under 588 high', () => {+ assert.deepEqual(startSize(AREA), { width: 720, height: 540 })+ assert.deepEqual(startSize({ ...AREA, height: 588 }), { width: 720, height: 540 })+ assert.deepEqual(startSize({ ...AREA, height: 587 }), { width: 720, height: 500 })+})++test('the start window is centred on the work area under the cursor', () => {+ assert.deepEqual(centred(startSize(AREA), AREA), { x: 600, y: 250, width: 720, height: 540 })+ // A second display left of the first, below a taskbar at the top.+ assert.deepEqual(centred({ width: 720, height: 540 }, { x: -1280, y: 40, width: 1280, height: 984 }), { x: -1000, y: 262, width: 720, height: 540 })+})++test('the team window is centred on the start window and stays inside the work area', () => {+ const start = centred(startSize(AREA), AREA)+ assert.deepEqual(mainRect(start, AREA), { x: 300, y: 90, ...MAIN_SIZE })+ // Dragged to the top left corner: the team window keeps to the work area.+ assert.deepEqual(mainRect({ x: 10, y: 5, width: 720, height: 540 }, AREA), { x: 0, y: 0, ...MAIN_SIZE })+ assert.deepEqual(mainRect({ x: 1190, y: 495, width: 720, height: 540 }, AREA), { x: 600, y: 180, ...MAIN_SIZE })+ // A laptop's work area smaller than the team window: it fills the work area.+ assert.deepEqual(mainRect({ x: 323, y: 94, width: 720, height: 540 }, { x: 0, y: 0, width: 1366, height: 728 }), { x: 23, y: 0, width: 1320, height: 728 })+ assert.deepEqual(clampInto({ x: -50, y: 900, width: 2000, height: 300 }, AREA), { x: 0, y: 740, width: 1920, height: 300 })+})++test('the easing is CSS cubic-bezier()', () => {+ const ease = cubicBezier(0.25, 0.1, 0.25, 1)+ assert.ok(Math.abs(ease(0.5) - 0.8024) < 1e-3)+ assert.equal(GROWTH_EASING(0), 0)+ assert.equal(GROWTH_EASING(1), 1)+ let previous = 0+ for (let step = 1; step <= 100; step += 1) {+ const value = GROWTH_EASING(step / 100)+ assert.ok(value >= previous && value <= 1, `at ${String(step)}%`)+ previous = value+ }+ // cubic-bezier(.2, .7, .2, 1) is quick at first: most of the way in the first half.+ assert.ok(GROWTH_EASING(0.5) > 0.9)+})++test('the start window grows into the team window in about 14 ms steps over 300 ms', () => {+ const from = centred(startSize(AREA), AREA)+ const to = mainRect(from, AREA)+ const steps = growthSteps(from, to)+ assert.equal(GROWTH.duration, 300)+ assert.equal(GROWTH.delay, 160)+ assert.equal(steps.length, 22)+ assert.deepEqual(steps.at(-1), { at: 300, rect: to })+ assert.ok(steps.every((step, index) => index === 0 || step.at > steps[index - 1].at))+ assert.ok(steps.slice(0, -1).every(step => step.at % 14 === 0))+ for (const key of ['x', 'y', 'width', 'height']) {+ const toward = Math.sign(to[key] - from[key])+ let previous = from[key]+ for (const { rect } of steps) {+ assert.ok((rect[key] - previous) * toward >= 0, `${key} turns back`)+ previous = rect[key]+ }+ }+ // At least one size between the two: a growth, not a jump.+ assert.ok(steps.some(({ rect }) => rect.width > from.width && rect.width < to.width))+ // The same rects from wherever the start window was dragged to.+ const dragged = { x: 40, y: 30, width: 720, height: 540 }+ assert.deepEqual(growthSteps(dragged, mainRect(dragged, AREA)).at(-1).rect, { x: 0, y: 0, ...MAIN_SIZE })+})++test('the team window shows by itself after 2.5 s on a first start or a celebration, else 0.8 s', () => {+ assert.equal(fallbackMs({ start: 'first', celebrate: true }), 2500)+ assert.equal(fallbackMs({ start: 'first', celebrate: false }), 2500)+ assert.equal(fallbackMs({ start: 'later', celebrate: true }), 2500)+ assert.equal(fallbackMs({ start: 'later', celebrate: false }), 800)+})++test('a failure gets one of the five reasons of the failure page', () => {+ const coded = (code, message) => Object.assign(new Error(message), { code })+ assert.equal(failureReason(coded('EACCES', 'EACCES: permission denied, mkdir \'D:\\data\\profiles\'')), 'permission')+ assert.equal(failureReason(new Error('EPERM: operation not permitted, open \'x\'')), 'permission')+ assert.equal(failureReason(coded('ENOSPC', 'ENOSPC: no space left on device, write')), 'space')+ assert.equal(failureReason(new Error('There is not enough space on the disk.')), 'space')+ assert.equal(failureReason(new Error('The DSH Host stopped (exit 1):\nError: Cannot find module \'@deepseek-ai/dsh-base\'')), 'files')+ assert.equal(failureReason(new Error('The app could not load its own bundles:\nds-bot: missing')), 'files')+ assert.equal(failureReason(new Error('The DSH Host stopped (exit 1):\nError: EACCES: permission denied, open \'state.json\'')), 'permission')+ assert.equal(failureReason(new Error('The DSH Host stopped (exit 3221225477)')), 'engine')+ assert.equal(failureReason(new Error('The profile in D:\\x does not start the engine\'s web server and connection.')), 'engine')- assert.equal(failureReason(new Error('DeepSeek Bot: no free port on 127.0.0.1')), 'other')++ assert.equal(failureReason(new Error('DS Bot: no free port on 127.0.0.1')), 'other')+ assert.equal(failureReason('a string'), 'other')+ assert.equal(failureReason(undefined), 'other')+})++test('only a missing file of the app\'s own says that the install is incomplete', () => {- const program = join(tmpdir(), 'DeepSeek Bot')++ const program = join(tmpdir(), 'DS Bot')+ const where = { program: [join(tmpdir(), 'electron'), program] }+ const missing = (path, message) => Object.assign(new Error(message), { code: 'ENOENT', path })- const exe = join(program, 'DeepSeek Bot.exe')++ const exe = join(program, 'DS Bot.exe')+ assert.equal(failureReason(missing(exe, `spawn ${exe} ENOENT`), where), 'files')+ assert.equal(failureReason(missing(exe, `spawn ${exe} ENOENT`)), 'other')+ // A saved data folder on a drive that is gone.- const data = join(tmpdir(), 'gone', 'DeepSeek Bot', 'data', 'profiles', 'ds-bot')++ const data = join(tmpdir(), 'gone', 'DS Bot', 'data', 'profiles', 'ds-bot')+ assert.equal(failureReason(missing(data, `ENOENT: no such file or directory, mkdir '${data}'`), where), 'other')+ // A Host that stopped: its error output names the missing file.+ const bundle = join(program, 'resources', 'app.asar.unpacked', 'node_modules', 'x', 'index.js')+ assert.equal(failureReason(new Error(`The DSH Host stopped (exit 1):\nError: ENOENT: no such file or directory, open '${bundle}'`), where), 'files')+ assert.equal(failureReason(new Error(`The DSH Host stopped (exit 1):\nError: ENOENT: no such file or directory, open '${join(data, 'state.json')}'`), where), 'engine')+})++test('the main process takes only its own acts, each in its own views', () => {+ assert.deepEqual([...START_ACTS].sort(), ['answer', 'copyDetails', 'handoffDone', 'handoffShow', 'openLogs', 'pick', 'reloadView', 'retry', 'wait'])+ assert.equal(acceptsAct('handoffShow', 'handoff'), true)+ // 「换个位置…」 while the start boots and 〔重新选〕 on its cards; a card's answer only on a card.+ assert.equal(acceptsAct('pick', 'boot'), true)+ assert.equal(acceptsAct('pick', 'card'), true)+ assert.equal(acceptsAct('pick', 'watchdog'), true)+ assert.equal(acceptsAct('pick', 'failed'), false)+ assert.equal(acceptsAct('pick', 'viewFailed'), false)+ assert.equal(acceptsAct('answer', 'card'), true)+ assert.equal(acceptsAct('answer', 'boot'), false)+ assert.equal(acceptsAct('handoffShow', 'boot'), false)+ assert.equal(acceptsAct('handoffDone', 'handoff'), true)+ assert.equal(acceptsAct('retry', 'failed'), true)+ assert.equal(acceptsAct('retry', 'watchdog'), true)+ assert.equal(acceptsAct('retry', 'boot'), false)+ assert.equal(acceptsAct('retry', 'handoff'), false)+ assert.equal(acceptsAct('wait', 'watchdog'), true)+ assert.equal(acceptsAct('wait', 'failed'), false)+ assert.equal(acceptsAct('reloadView', 'viewFailed'), true)+ assert.equal(acceptsAct('reloadView', 'failed'), false)+ for (const view of ['boot', 'failed', 'viewFailed', 'watchdog', 'handoff', 'moving']) {+ assert.equal(acceptsAct('openLogs', view), true)+ assert.equal(acceptsAct('copyDetails', view), true)+ }+ // The cards of later pull requests, and names that are not acts at all.+ for (const name of ['reload', 'toggleDetails', 'freshStart', 'installUpdate', 'manualDownload', 'stopCopy', 'keepCopying', 'importModel', 'importOption', '__proto__', 'constructor', 'toString', '']) {+ assert.equal(acceptsAct(name, 'failed'), false, name)+ }+ assert.equal(acceptsAct(undefined, 'failed'), false)+ assert.equal(acceptsAct(42, 'failed'), false)+})++test('acts come only from the start page that was loaded', () => {+ // A Windows path is a file URL only on Windows.+ const win32 = process.platform === 'win32'- const page = win32 ? 'C:\\Program Files\\DeepSeek Bot\\resources\\app.asar\\src\\start\\start.html' : '/opt/DeepSeek Bot/resources/app.asar/src/start/start.html'++ const page = win32 ? 'C:\\Program Files\\DS Bot\\resources\\app.asar\\src\\start\\start.html' : '/opt/DS Bot/resources/app.asar/src/start/start.html'+ const loaded = startUrl(page, 'first')- assert.equal(loaded, win32 ? 'file:///C:/Program%20Files/DeepSeek%20Bot/resources/app.asar/src/start/start.html?start=first' : 'file:///opt/DeepSeek%20Bot/resources/app.asar/src/start/start.html?start=first')++ assert.equal(loaded, win32 ? 'file:///C:/Program%20Files/DS%20Bot/resources/app.asar/src/start/start.html?start=first' : 'file:///opt/DS%20Bot/resources/app.asar/src/start/start.html?start=first')+ assert.equal(isStartPage(loaded, loaded), true)+ assert.equal(isStartPage(`${loaded}#x`, loaded), false)+ assert.equal(isStartPage(loaded.replace('first', 'later'), loaded), false)+ assert.equal(isStartPage(loaded.replace('start.html', 'other.html'), loaded), false)+ assert.equal(isStartPage('http://127.0.0.1:52817/src/start/start.html?start=first', loaded), false)+ assert.equal(isStartPage('not a url', loaded), false)+ assert.equal(isStartPage(undefined, loaded), false)+})++const state = (change = {}) => ({+ lang: 'zh', start: 'first', motion: 'normal', frame: 'band', view: 'boot', done: [], celebrate: true,+ explain: explainOf(), clock: { base: 0, from: 1000, running: true }, hint: undefined, failure: undefined, ...change,+})++test('the snapshot carries the phase, the stages done and the clock', () => {+ const now = 1_700_000_000_000+ const booting = startSnapshot(state({ clock: { base: 0, from: now - 6400, running: true } }), now)+ assert.deepEqual(booting, {+ v: 1, lang: 'zh', start: 'first', motion: 'normal', frame: 'band', view: 'boot', phase: 'data', done: [],+ clock: { ms: 6400, at: now, running: true, rate: 1 },+ explain: { mode: 'new', nextStep: true, previewNotice: true }, celebrate: true,+ })+ assert.equal(startSnapshot(state({ done: ['data'] }), now).phase, 'engine')+ const ready = startSnapshot(state({ view: 'handoff', done: ['team', 'data', 'engine'] }), now)+ assert.equal(ready.phase, 'team')+ assert.deepEqual(ready.done, ['data', 'engine', 'team'])+ // A paused clock (a dialog, the 180 s question, a failure) stays where it stopped.+ assert.deepEqual(startSnapshot(state({ view: 'watchdog', clock: { base: 180_000, from: 5, running: false } }), now).clock, { ms: 180_000, at: now, running: false, rate: 1 })+ assert.equal(clockMs({ base: 1000, from: now - 500, running: true }, now), 1500)+ assert.equal(clockMs({ base: 1000, from: now + 500, running: true }, now), 1000)+ const failed = startSnapshot(state({ view: 'failed', failure: { reason: 'engine', log: ['a', 'b'] } }), now)+ assert.deepEqual(failed.failure, { reason: 'engine', log: ['a', 'b'] })+ assert.equal('card' in failed, false)+ assert.equal('hint' in failed, false)+ assert.deepEqual(startSnapshot(state({ hint: { drive: 'C', free: '1.2 GB' } }), now).hint, { drive: 'C', free: '1.2 GB' })+ assert.equal('place' in startSnapshot(state(), now), false)+ assert.deepEqual(startSnapshot(state({ place: { drive: 'C', free: '412 GB' } }), now).place, { drive: 'C', free: '412 GB' })- assert.deepEqual(startSnapshot(state({ view: 'card', card: { kind: 'picked', path: 'D:\\DeepSeek Bot' } }), now).card, { kind: 'picked', path: 'D:\\DeepSeek Bot' })++ assert.deepEqual(startSnapshot(state({ view: 'card', card: { kind: 'picked', path: 'D:\\DS Bot' } }), now).card, { kind: 'picked', path: 'D:\\DS Bot' })+ // The page gets copies: it cannot change the main process's state.+ const source = state({ failure: { reason: 'other', log: ['x'] } })+ const sent = startSnapshot(source, now)+ sent.explain.mode = 'import'+ sent.failure.log.push('y')+ assert.equal(source.explain.mode, 'new')+ assert.deepEqual(source.failure.log, ['x'])+})++test('what the hint row can prepare for: a new team, a reinstall or an import', () => {+ // DSH shows its preview notice on a data folder without a team, which has no Session yet.+ assert.deepEqual(explainOf(), { mode: 'new', nextStep: true, previewNotice: true })+ assert.deepEqual(explainOf({ team: { bots: 6, rooms: 2 } }), { mode: 'reinstall', bots: 6, groups: 2, nextStep: false, previewNotice: false })+ assert.deepEqual(explainOf({ offered: true }), { mode: 'import', nextStep: false, previewNotice: false })+ assert.deepEqual(explainOf({ offered: true, team: { bots: 1, rooms: 0 } }).mode, 'import')+ // The greeting names the kept team's first Main Bot; without a readable name it names none.+ const state = { mainBotIds: ['b2', 'b1'], bots: { b1: { name: 'Chief' }, b2: { name: ' Ada ' } } }+ assert.equal(explainOf({ team: { bots: 2, rooms: 0, team: state } }).name, 'Ada')+ assert.equal(explainOf({ team: { bots: 1, rooms: 0, team: { mainBotId: 'b1', bots: state.bots } } }).name, 'Chief')+ assert.equal(Object.hasOwn(explainOf({ team: { bots: 1, rooms: 0, team: { mainBotIds: ['gone'], bots: {} } } }), 'name'), false)+ assert.equal(Object.hasOwn(explainOf({ team: { bots: 1, rooms: 0, team: { mainBotIds: ['b1'], bots: { b1: { name: ' ' } } } } }), 'name'), false)+})++test('the copied details name the version and the reason before the log', () => {- assert.equal(detailsText({ version: '0.2.2', platform: 'win32', arch: 'x64', reason: 'engine', lines: ['l1', 'l2'] }), 'DeepSeek Bot 0.2.2 (win32 x64)\nreason: engine\n\nl1\nl2')++ assert.equal(detailsText({ version: '0.2.2', platform: 'win32', arch: 'x64', reason: 'engine', lines: ['l1', 'l2'] }), 'DS Bot 0.2.2 (win32 x64)\nreason: engine\n\nl1\nl2')+})++test('the start window remembers the theme and the motion tier in its own file', (t) => {+ const dir = mkdtempSync(join(tmpdir(), 'ds-bot-start-frame-'))+ t.after(() => { rmSync(dir, { recursive: true, force: true }) })+ const file = join(dir, 'start-frame.json')+ assert.deepEqual(readStartFrame(file), { themeSource: 'system', motion: 'normal' })+ assert.equal(writeStartFrame(file, { themeSource: 'dark' }), true)+ assert.equal(writeStartFrame(file, { themeSource: 'dark' }), false)+ assert.equal(writeStartFrame(file, { motion: 'lively', themeSource: 'moonlight' }), true)+ assert.deepEqual(readStartFrame(file), { themeSource: 'dark', motion: 'lively' })+ assert.deepEqual(readdirSync(dir), ['start-frame.json'])+ writeFileSync(file, '{"themeSource":"neon","motion":7}')+ assert.deepEqual(readStartFrame(file), { themeSource: 'system', motion: 'normal' })+ writeFileSync(file, 'not json')+ assert.deepEqual(readStartFrame(file), { themeSource: 'system', motion: 'normal' })+})++// Onboarding acceptance: no dialog during the first start without a window it belongs to.+test('every dialog belongs to a window', () => {+ const src = new URL('../src/', import.meta.url)+ const files = readdirSync(src).filter(name => /\.m?js$/u.test(name))+ const loose = files.flatMap((name) => {+ const code = readFileSync(new URL(name, src), 'utf8')+ return [...code.matchAll(/dialog\.(show\w+)\(\s*(\{|\))/gu)].map(match => `${name}: dialog.${match[1]}`)+ })+ assert.deepEqual(loose, [])+ assert.ok(files.every(name => !readFileSync(new URL(name, src), 'utf8').includes('showErrorBox')))+})++// Just enough of Electron for StartWindow: windows that record what is done to them, and the+// start page's act channel.+function fakeElectron() {+ const windows = []+ let act+ class Contents extends EventEmitter {+ sent = []+ reloads = 0+ mainFrame = { url: '' }+ send(channel, state) { if (channel === START_STATE) this.sent.push(state) }+ setWindowOpenHandler() {}+ toggleDevTools() {}+ reload() { this.reloads += 1; this.emit('dom-ready') }+ }+ class Window extends EventEmitter {+ webContents = new Contents()+ calls = []+ destroyed = false+ minimized = false+ focused = true+ constructor({ x = 0, y = 0, width = 800, height = 600, show = true } = {}) {+ super()+ this.bounds = { x, y, width, height }+ this.visible = show+ windows.push(this)+ }+ loadURL(url) { this.webContents.mainFrame.url = url; return Promise.resolve() }+ setContentBounds(rect) { this.bounds = { ...rect } }+ setBounds(rect) { this.bounds = { ...rect }; this.calls.push('setBounds') }+ getBounds() { return { ...this.bounds } }+ getNormalBounds() { return { ...this.bounds } }+ isDestroyed() { return this.destroyed }+ destroy() { if (!this.destroyed) { this.destroyed = true; this.emit('closed') } }+ isMinimized() { return this.minimized }+ isFocused() { return this.focused }+ restore() { this.minimized = false }+ minimize() { this.minimized = true; this.calls.push('minimize') }+ show() { this.visible = true; this.calls.push('show') }+ showInactive() { this.visible = true; this.calls.push('showInactive') }+ hide() { this.visible = false; this.calls.push('hide') }+ focus() { this.calls.push('focus') }+ flashFrame(on) { this.calls.push(`flash ${String(on)}`) }+ setSkipTaskbar(skip) { this.calls.push(`skipTaskbar ${String(skip)}`) }+ setTitleBarOverlay() {}+ setBackgroundColor() {}+ getMediaSourceId() { return 'window:1:0' }+ moveAbove() {}+ }+ const display = { workArea: AREA }+ const electron = {+ BrowserWindow: Window,+ ipcMain: { handle: (channel, handler) => { if (channel === START_ACT) act = handler } },+ screen: { getCursorScreenPoint: () => ({ x: 10, y: 10 }), getDisplayNearestPoint: () => display, getDisplayMatching: () => display, getPrimaryDisplay: () => display },+ shell: { openPath: async () => '' },+ clipboard: { writeText() {} },+ nativeTheme: Object.assign(new EventEmitter(), { shouldUseDarkColors: false }),+ systemPreferences: { getAnimationSettings: () => ({ prefersReducedMotion: false }) },+ }+ return { electron, windows, act: (event, name, payload) => act(event, name, payload) }+}++function startWindow(t) {+ t.mock.timers.enable({ apis: ['setTimeout', 'Date'], now: 1_000_000 })+ t.mock.method(console, 'log', () => {})+ const fake = fakeElectron()+ const main = new fake.electron.BrowserWindow({ show: false })+ const calls = { retry: 0, reload: 0, close: 0, pick: [], answer: [] }+ const start = new StartWindow({+ electron: fake.electron, page: join(tmpdir(), 'start', 'start.html'), preload: 'preload.cjs', icon: 'icon.ico', mica: false, devTools: false,+ lang: () => 'en', motion: 'normal', version: '0.0.0', program: [], log: { dir: 'logs', tail: () => ['a log line'] },+ mainWindow: () => main,+ onRetry: () => { calls.retry += 1 }, onReload: () => { calls.reload += 1 }, onClose: () => { calls.close += 1 },+ onPick: (value) => { calls.pick.push(value) }, onAnswer: (value) => { calls.answer.push(value) },+ })+ const win = () => fake.windows.at(-1)+ const page = () => ({ sender: win().webContents, senderFrame: win().webContents.mainFrame })+ return {+ start, main, calls, win,+ tick: (ms) => { t.mock.timers.tick(ms) },+ state: () => win().webContents.sent.at(-1),+ act: (name, payload, event = page()) => fake.act(event, name, payload),+ other: () => new fake.electron.BrowserWindow(),+ }+}++test('the start window takes acts only from its own page, each in its own view', (t) => {+ const s = startWindow(t)+ s.start.open('first')+ const own = s.win()+ const ownFrame = { sender: own.webContents, senderFrame: own.webContents.mainFrame }+ const other = s.other()+ assert.equal(s.act('openLogs', undefined, { sender: other.webContents, senderFrame: other.webContents.mainFrame }), false)+ assert.equal(s.act('openLogs', undefined, { sender: own.webContents, senderFrame: { url: own.webContents.mainFrame.url } }), false)+ const loaded = own.webContents.mainFrame.url+ own.webContents.mainFrame.url = loaded.replace('first', 'later')+ assert.equal(s.act('openLogs', undefined, ownFrame), false)+ own.webContents.mainFrame.url = loaded+ assert.equal(s.act('openLogs', undefined, ownFrame), true)+ assert.equal(s.act('retry', undefined, ownFrame), false)+ assert.equal(s.act('freshStart', undefined, ownFrame), false)+ assert.equal(s.calls.retry, 0)+})++test('the 180 s question comes on the start\'s clock while the engine is not up', async (t) => {+ const s = startWindow(t)+ s.start.open('first')+ s.start.done('data')+ // A dialog stops the clock: the user's thinking time is not the engine's.+ let answer+ const asked = s.start.asking(new Promise((resolve) => { answer = resolve }))+ s.tick(WATCHDOG_MS)+ assert.equal(s.state().view, 'boot')+ answer()+ await asked+ s.tick(WATCHDOG_MS - 1)+ assert.equal(s.state().view, 'boot')+ s.tick(1)+ assert.equal(s.state().view, 'watchdog')+ assert.equal(s.state().clock.running, false)+ // 〔继续等待〕: another 180 s on the clock.+ assert.equal(s.act('wait'), true)+ assert.equal(s.state().view, 'boot')+ s.tick(WATCHDOG_MS - 1)+ assert.equal(s.state().view, 'boot')+ s.tick(1)+ assert.equal(s.state().view, 'watchdog')+ // The engine comes up meanwhile: the question goes, and does not come back.+ s.start.done('engine')+ assert.equal(s.state().view, 'boot')+ assert.deepEqual(s.state().done, ['data', 'engine'])+ s.tick(2 * WATCHDOG_MS)+ assert.equal(s.state().view, 'boot')+})++test('a retry after the engine was up guards the new engine, while the whale keeps its stop', (t) => {+ const s = startWindow(t)+ s.start.open('first')+ s.start.done('data')+ s.start.done('engine')+ s.start.teamLoading()+ s.start.fail(new Error('The DSH Host stopped (exit 1)'))+ assert.equal(s.state().view, 'failed')+ assert.equal(s.state().failure.reason, 'engine')+ assert.equal(s.act('retry'), true)+ assert.equal(s.calls.retry, 1)+ assert.deepEqual(s.state().done, ['data', 'engine'])+ assert.equal(s.state().phase, 'team')+ // The old team view cannot hand over before the new engine is up.+ s.start.ready()+ assert.equal(s.state().view, 'boot')+ s.tick(WATCHDOG_MS)+ assert.equal(s.state().view, 'watchdog')+ assert.equal(s.act('retry'), true)+ s.start.done('engine')+ s.tick(2 * WATCHDOG_MS)+ assert.equal(s.state().view, 'boot')+ s.start.ready()+ assert.equal(s.state().view, 'handoff')+ // The first success after a retry celebrates.+ assert.equal(s.state().celebrate, true)+})++test('the team view has 20 s to call ready(); a late ready() hands over without a celebration', (t) => {+ const s = startWindow(t)+ s.start.open('first')+ s.start.done('data')+ s.start.done('engine')+ s.start.teamLoading()+ s.tick(TEAM_VIEW_MS - 1)+ assert.equal(s.state().view, 'boot')+ s.tick(1)+ assert.equal(s.state().view, 'viewFailed')+ assert.deepEqual(s.state().failure, { reason: 'other', log: ['a log line'] })+ // 〔重新载入〕: the hidden team view loads again and has another 20 s.+ assert.equal(s.act('reloadView'), true)+ assert.equal(s.calls.reload, 1)+ assert.equal(s.state().view, 'boot')+ s.tick(TEAM_VIEW_MS)+ assert.equal(s.state().view, 'viewFailed')+ s.start.ready()+ assert.equal(s.state().view, 'handoff')+ assert.equal(s.state().celebrate, false)+ assert.equal('failure' in s.state(), false)+})++for (const [kind, wait] of [['first', 2500], ['later', 800]]) {+ test(`without handoffShow the team window shows by itself after ${String(wait)} ms on a ${kind} start`, async (t) => {+ const s = startWindow(t)+ s.start.open(kind)+ s.start.done('data')+ s.start.done('engine')+ s.start.ready()+ s.tick(wait - 1)+ assert.equal(s.main.visible, false)+ s.tick(1)+ assert.equal(s.main.visible, true)+ assert.deepEqual(s.main.calls.slice(-2), ['show', 'focus'])+ assert.ok(s.win().calls.includes('skipTaskbar true'))+ await s.start.teamShown+ s.tick(300)+ assert.equal(s.win().destroyed, true)+ // Gone after the hand-off, the start window does not quit the app.+ assert.equal(s.calls.close, 0)+ })+}++test('after handoffShow the start window grows into the team window\'s rect, and the team window shows on it', (t) => {+ const s = startWindow(t)+ s.start.open('later')+ s.start.done('data')+ s.start.done('engine')+ s.start.ready()+ const from = s.win().getBounds()+ assert.equal(s.act('handoffShow'), true)+ const target = mainRect(from, AREA)+ assert.deepEqual(s.main.bounds, target)+ s.tick(GROWTH.delay - 1)+ assert.deepEqual(s.win().bounds, from)+ s.tick(1)+ const widths = []+ for (let step = 0; step < 40 && !s.main.visible; step += 1) {+ s.tick(GROWTH.step)+ widths.push(s.win().bounds.width)+ }+ assert.equal(s.main.visible, true)+ assert.deepEqual(s.win().bounds, target)+ assert.ok(widths.some(width => width > from.width && width < target.width), 'the start window jumps instead of growing')+ // A second handoffShow does nothing.+ assert.equal(s.act('handoffShow'), true)+ assert.equal(s.main.calls.filter(call => call === 'show').length, 1)+})++for (const how of ['behind', 'minimized']) {+ test(`the team window comes up ${how} when the start window is`, (t) => {+ const s = startWindow(t)+ s.start.open('later')+ if (how === 'behind') s.win().focused = false+ else s.win().minimized = true+ s.start.done('data')+ s.start.done('engine')+ s.start.ready()+ s.act('handoffShow')+ for (let step = 0; step < 60 && !s.main.calls.includes('flash true'); step += 1) s.tick(GROWTH.step)+ assert.deepEqual(s.main.calls.slice(-2), [how === 'behind' ? 'showInactive' : 'minimize', 'flash true'])+ assert.equal(s.main.calls.includes('focus'), false)+ })+}++test('closing the start window before the hand-off quits, and its timers go with it', (t) => {+ const s = startWindow(t)+ s.start.open('first')+ s.start.done('data')+ const sent = s.win().webContents.sent.length+ s.win().destroy()+ assert.equal(s.calls.close, 1)+ s.tick(WATCHDOG_MS + TEAM_VIEW_MS)+ assert.equal(s.win().webContents.sent.length, sent)+ assert.equal(s.start.owner(), undefined)+})++test('a failure during the hand-off draws the failure page on a fresh page', (t) => {+ const s = startWindow(t)+ s.start.open('first')+ s.start.done('data')+ s.start.done('engine')+ s.start.ready()+ s.act('handoffShow')+ s.tick(GROWTH.delay + GROWTH.step)+ s.start.fail(new Error('The DSH Host stopped (exit 1)'))+ assert.equal(s.state().view, 'failed')+ assert.equal(s.win().webContents.reloads, 1)+ // The growth is undone, and the team window stays hidden.+ assert.deepEqual(s.win().bounds, centred(startSize(AREA), AREA))+ s.tick(5000)+ assert.equal(s.main.visible, false)+ assert.equal(s.act('handoffShow'), false)+})++test('a failure after the hand-off opens a fresh start window over the hidden team window', (t) => {+ const s = startWindow(t)+ s.start.open('first')+ s.start.done('data')+ s.start.done('engine')+ s.start.ready()+ s.tick(2500)+ const handed = s.win()+ assert.equal(s.main.visible, true)+ s.start.fail(new Error('The DSH Host stopped (exit 1)'), 'later')+ assert.equal(handed.destroyed, true)+ assert.notEqual(s.win(), handed)+ assert.equal(s.main.visible, false)+ assert.equal(s.state().view, 'failed')+ assert.equal(s.state().start, 'later')+ assert.equal(s.start.owner(), s.win())+ assert.equal(s.calls.close, 0)+})++test('the place line, its picker and its cards, and a start over in another folder', (t) => {+ const s = startWindow(t)+ s.start.open('first')+ s.start.done('data')+ assert.equal('place' in s.state(), false)+ s.start.place({ drive: 'C', free: '412 GB' })+ assert.deepEqual(s.state().place, { drive: 'C', free: '412 GB' })+ // 「换个位置…」 from the line, with its detail; the picker's own wait is the main process's.+ assert.equal(s.act('pick', { value: 'changePlace' }), true)+ assert.deepEqual(s.calls.pick, ['changePlace'])+ assert.equal(s.act('answer', { value: 'use' }), false)+ // A layer the app added: the 「会放在…」 card waits for the answer, and the clock with it.- s.start.card({ kind: 'picked', path: 'D:\\DeepSeek Bot' })++ s.start.card({ kind: 'picked', path: 'D:\\DS Bot' })+ assert.equal(s.state().view, 'card')- assert.deepEqual(s.state().card, { kind: 'picked', path: 'D:\\DeepSeek Bot' })++ assert.deepEqual(s.state().card, { kind: 'picked', path: 'D:\\DS Bot' })+ assert.equal(s.state().clock.running, false)+ assert.equal(s.act('pick', undefined), true)+ assert.deepEqual(s.calls.pick, ['changePlace', undefined])+ assert.equal(s.act('answer', { value: 'use' }), true)+ assert.equal(s.act('answer', 'use'), true)+ assert.deepEqual(s.calls.answer, ['use', undefined])+ s.start.card(undefined)+ assert.equal(s.state().view, 'boot')+ assert.equal('card' in s.state(), false)+ assert.equal(s.state().clock.running, true)+ // A rejected place names the reason and the path.+ s.start.card({ kind: 'rejected', reason: 'onedrive', path: 'C:\\Users\\me\\OneDrive' })+ assert.equal(s.state().card.reason, 'onedrive')+ s.start.card(undefined)+ // Under the 180 s question the place can still change; the question comes back after a card.+ s.tick(180_000)+ assert.equal(s.state().view, 'watchdog')+ assert.equal(s.act('pick', { value: 'changePlace' }), true)- s.start.card({ kind: 'picked', path: 'D:\\DeepSeek Bot' })++ s.start.card({ kind: 'picked', path: 'D:\\DS Bot' })+ assert.equal(s.state().view, 'card')+ s.start.card(undefined)+ s.tick(1)+ assert.equal(s.state().view, 'watchdog')+ // Starting over: the stages go back, the clock starts from 0, the engine is guarded again,+ // and the place line stays for the new folder.+ s.start.done('engine')+ s.tick(30_000)+ s.start.restart()+ s.start.place({ drive: 'D', free: '412 GB' })+ assert.equal(s.state().view, 'boot')+ assert.deepEqual(s.state().done, [])+ assert.equal(s.state().clock.ms, 0)+ assert.equal(s.state().celebrate, true)+ assert.deepEqual(s.state().place, { drive: 'D', free: '412 GB' })+ s.start.done('data')+ s.tick(180_000)+ assert.equal(s.state().view, 'watchdog')+ s.start.done('engine')+ assert.equal(s.state().view, 'boot')+ assert.deepEqual(s.state().done, ['data', 'engine'])+ // No card after a failure: the failure page has its own buttons.+ s.start.fail(new Error('The DSH Host stopped (exit 1)'))- s.start.card({ kind: 'picked', path: 'D:\\DeepSeek Bot' })++ s.start.card({ kind: 'picked', path: 'D:\\DS Bot' })+ assert.equal(s.state().view, 'failed')+ assert.equal(s.act('pick', { value: 'changePlace' }), false)+})++// The picker is open when the team view becomes ready: the window, the picker's owner, stays.+test('the hand-off waits while the picker is open', async (t) => {+ const s = startWindow(t)+ s.start.open('first')+ s.start.done('data')+ s.start.done('engine')+ s.start.teamLoading()+ let answer+ const asked = s.start.asking(new Promise((resolve) => { answer = resolve }))+ s.start.ready()+ assert.equal(s.state().view, 'boot')+ s.tick(2500)+ assert.equal(s.main.visible, false)+ answer()+ await asked+ assert.equal(s.state().view, 'handoff')+})++test('a card holds the hand-off the same way, and the ready is not lost when the card goes', (t) => {+ const c = startWindow(t)+ c.start.open('first')+ c.start.done('data')+ c.start.done('engine')- c.start.card({ kind: 'picked', path: 'D:\\DeepSeek Bot' })++ c.start.card({ kind: 'picked', path: 'D:\\DS Bot' })+ c.start.ready()+ assert.equal(c.state().view, 'card')+ c.start.card(undefined)+ assert.equal(c.state().view, 'handoff')+})++test('a start over in another folder drops the old engine\'s held ready', (t) => {+ const o = startWindow(t)+ o.start.open('first')+ o.start.done('data')+ o.start.done('engine')- o.start.card({ kind: 'picked', path: 'D:\\DeepSeek Bot' })++ o.start.card({ kind: 'picked', path: 'D:\\DS Bot' })+ o.start.ready()+ o.start.restart()+ assert.equal(o.state().view, 'boot')+ o.tick(3000)+ assert.equal(o.state().view, 'boot')+ o.start.done('data')+ o.start.done('engine')+ o.start.ready()+ assert.equal(o.state().view, 'handoff')+})++test('the 20 s check\'s verdict waits for a card\'s answer instead of being lost', (t) => {+ const v = startWindow(t)+ v.start.open('first')+ v.start.done('data')+ v.start.done('engine')+ v.start.teamLoading()+ v.start.card({ kind: 'rejected', reason: 'onedrive', path: 'C:\\OneDrive' })+ v.tick(20_000)+ assert.equal(v.state().view, 'card')+ v.start.card(undefined)+ assert.equal(v.state().view, 'viewFailed')+})diff --cc docs/plans/2026-10-10-bot-runtime.mdindex 105716fa,5271ff47..1a86c692--- a/docs/plans/2026-10-10-bot-runtime.md+++ b/docs/plans/2026-10-10-bot-runtime.md@@@ -80,4 -81,4 +83,5 @@@- 2026-10-14:新的 Bot 会话、群会话和分段显式用 `standard`,修好 PTC 预设下群聊不接力(#37)。- 2026-10-19:Bot 用 DSH 的 `working_directory` 换到工作文件夹以外时,当作给自己设工作文件夹(同样的检查和批准),换到新的一段;在工作文件夹里面换只是走进去(#345)。- 2026-10-20:用户能在设置里换总工作区;中文名「团队工作区」改叫「总工作区」(#364)。+- 2026-10-26:DS Bot 自己选模型时只选能用的(缺 key 的不选);先打字不再丢掉第一个 Main Bot 的开场白;凭据类失败记在 Bot 上,供修复卡和「重试」用([Windows 上手流程](2026-10-26-windows-onboarding.md) M1)。+ - 2026-11-01:Bot 不再派 DSH 子代理:委派工具和子代理控制工具不出现在 Bot 会话里,goal、workflow 的用法说明也从 Bot 的系统提示里去掉(#798)。diff --cc docs/plans/2026-10-16-desktop-app.mdindex 63515606,abe09af7..d0947d7a--- a/docs/plans/2026-10-16-desktop-app.md+++ b/docs/plans/2026-10-16-desktop-app.md@@@ -68,10 -67,9 +68,10 @@@### 首次启动和导入- - 首次启动分别选数据位置(默认 `~/.ds-bot`)和总工作区(默认 `~/DeepSeek Bot`),以后能在设置里改(见下面「改位置」)。两个位置不能一个在另一个里面,也不能在用户 DSH 的数据里。用的是系统对话框。+ - 首次启动分别选数据位置(默认 `~/.ds-bot`)和总工作区(默认 `~/DS Bot`),以后能在设置里改(见下面「改位置」)。两个位置不能一个在另一个里面,也不能在用户 DSH 的数据里。用的是系统对话框。- 发现用户 DSH 里已有团队时,问要不要导入,只在首次启动问一次。导入复制 Bot、群、记忆、会话、附件、模型设置和密钥,旧位置一个字节都不改。导入以后两个团队各走各的,不同步。- - DSH 正在用这个团队时,请用户先关掉。+ - DSH 正在用这个团队时,请用户先关掉。「正在用」和插件的 home-lock 同一个规则:锁在 60 秒内刷新过,且同一台机器上锁里的进程还活着(Windows 会重用进程号,只看进程号会把旧锁当成活的)。+ - 目标里已经有 `.credentials.yaml` 或 `.env` 时不覆盖,导入结果里记成「保留」;只含引擎自己写的 `client-connection/` 记录的 `.credentials.yaml` 不算用户的,照常换成旧的。复制用的暂存文件夹不论成功、失败还是中途退出都会删掉。- 引擎先在新数据位置启动一次再复制,这样 DSH 不会把旧团队的文件夹当成自己的项目。- 旧团队工作文件夹里的文件复制到新的总工作区,不覆盖已有的文件。- 模型设置只取 profile 里模型的那几行(DeepSeek API 和账号、其他服务商、默认模型、预设)。几个 profile 都有时让用户选一份。DSH 里另外配的 MCP、技能和 DSH Agent 不导入。@@@ -99,14 -97,14 +99,14 @@@### 安装和更新- - 应用标识(appId)是 `io.github.fei2411.deepseekbot`,以后不改:Windows 靠它认出这个应用和它的更新,macOS 用它当应用标识。- - Windows(x64):安装向导,可以改程序位置,装完可以直接运行。只给当前用户安装:不问「为所有用户还是只为我」,不要管理员权限,默认装在 `%LOCALAPPDATA%\Programs\DeepSeek Bot`。卸载不删数据位置。+ - 应用标识(appId)是 `io.github.fei2411.dsbot`。Windows 安装器的 GUID 保持已发布版本的值,改程序名后仍覆盖原安装,并更新快捷方式和卸载入口。+ - Windows(x64):安装向导,可以改程序位置,装完可以直接运行。只给当前用户安装:不问「为所有用户还是只为我」,不要管理员权限,默认装在 `%LOCALAPPDATA%\Programs\DS Bot`。卸载不删数据位置。- Windows 自动更新:后台下载,校验 sha512,下载完在窗口里提示重启以更新;不重启的话,下次退出时装上。- 启动时查一次 GitHub 上最新的 Release,之后每 4 小时查一次。Release 里的 `latest.yml` 写着安装包的文件名和 sha512。- - 提示是窗口上的系统对话框:「立即重启」先停掉引擎再装;「稍后」等下次退出。+ - 提示是窗口上的系统对话框:「立即重启」先停掉引擎再装;「先不重启」等下次退出([启动页文案](2026-10-29-start-copy.md))。- 引擎起不来时也能更新:检查在引擎启动前开始(首次启动的导入之后)。启动失败时,错误框里说有新版本,关掉错误框后等下载完,装上并重新打开。- - 应用里的 ds-bot 和 DSH 随应用一起更新:插件不自己查这两项的更新,关于页写「随 DeepSeek Bot 应用一起更新」。- - 发版:发布 Release 时,工作流打 Windows 安装包,把它、它的 `.blockmap` 和 `latest.yml` 传到 Release。应用和 ds-bot 用同一个版本号,Release 的标签就是这个版本号。各平台的包都传完后,工作流再传 `SHA256SUMS.txt` 和不带版本号的安装包(如 `DeepSeek-Bot-win-x64.exe`),在说明开头加「下载 / Download」表,最后才把 Release 标为最新;所以发布时不勾「Set as the latest release」。+ - 应用里的 ds-bot 和 DSH 随应用一起更新:插件不自己查这两项的更新,关于页写「随 DS Bot 应用一起更新」。-- 发版:发布 Release 时,工作流打 Windows 安装包,把它、它的 `.blockmap` 和 `latest.yml` 传到 Release。应用和 ds-bot 用同一个版本号,Release 的标签就是这个版本号。++- 发版:发布 Release 时,工作流打 Windows 安装包,把它、它的 `.blockmap` 和 `latest.yml` 传到 Release。应用和 ds-bot 用同一个版本号,Release 的标签就是这个版本号。各平台的包都传完后,工作流再传 `SHA256SUMS.txt` 和不带版本号的安装包(如 `DS-Bot-win-x64.exe`),在说明开头加「下载 / Download」表,最后才把 Release 标为最新;所以发布时不勾「Set as the latest release」。- macOS(Apple 芯片和 Intel):zip;不能自动更新,有新版时提示下载。不用 dmg:macOS 26 上下载的未签名 dmg 显示「已损坏」,打不开。- 安装包带着锁定的 DSH 装上的全部文件,不按 profile 删减。- 不用开发者证书签名,也不公证;macOS 包只做 ad-hoc 签名。macOS 第一次打开会被拦下,要到「系统设置 → 隐私与安全性」点「仍要打开」。@@@ -154,4 -153,5 +155,5 @@@- 2026-10-20:窗口改为加载引擎的本机地址,不再用 `dsh-app://app`:DSH 的账号登录把页面地址当作浏览器登录完回来的地址,只接受本机 http 地址。DSH 打开的登录窗口交给系统浏览器,Issue #376。弹出对话框时标题栏一起变暗。- 2026-10-23:应用里接上 Bot 浏览器:应用自己提供 webview 桥,每个 Bot 的登录存在壳自己的数据里,删掉 Bot 时一起清掉,Issue #449。- 2026-10-25:关掉窗口只是藏起来,应用留在系统托盘;托盘的「打开」找回窗口,「退出」是唯一的正常退出入口,Issue #500。-+- 2026-10-26:关掉 DSH 网页版的自动凭据引导,模型在 DS Bot 自己的模型页和 key 卡片里配;导入时判断团队「正在用」加上锁的刷新时间,不覆盖已有的 key,总会删掉暂存文件夹;建窗口不再依赖「下载」文件夹;启动失败后再双击也能把窗口叫到前面;Release 最后才标为最新,并附 `SHA256SUMS.txt`、不带版本号的安装包和下载表([Windows 上手流程](2026-10-26-windows-onboarding.md) M1)。+ - 2026-11-01:程序、可执行文件和安装包统一使用 DS Bot / dsbot;保留已有安装、数据、浏览器加密身份和旧客户端更新入口的兼容。diff --cc docs/plans/2026-10-26-start-window.mdindex 4432ea47,00000000..13227b35mode 100644,000000..100644--- a/docs/plans/2026-10-26-start-window.md+++ b/docs/plans/2026-10-26-start-window.md@@@ -1,413 -1,0 +1,413 @@@+# 启动窗口:领航鲸++- 日期:2026-10-26+- 相关:[Windows 上手流程](2026-10-26-windows-onboarding.md) 第 3、4、5、6、8 节,#559+- 一起改:[Windows 上手流程](2026-10-26-windows-onboarding.md)(第 3 节、第 4 节、第 5 节、第 8 节、用词、「改动的已定设计」、分批上线、验收、待定、已知限制)、[桌面应用](2026-10-16-desktop-app.md)(结构、窗口)、[UI 标准](../design/ui-standard.md)(1、3.1、4.4、8.3、8.4、12、14)+- 代码:新的 `app/src/start/`(`start.html`、`start.css`、`start.js`、`whale.js`、`text.mjs`)、`app/src/start-window.mjs`、`app/src/start-frame.mjs`、`app/scripts/start-assets.mjs`;`app/src/main.mjs`、`preload.cjs`、`window-frame.mjs`++## 为什么++- 引擎第一次启动要 3 到 20 秒,以后要 3 到 12 秒。第 3 节定了这段时间显示什么(真实阶段、卡片、恢复页),没定它怎么动。+- 主 Bot 的鲸鱼是 DS Bot 自己生成的形象,用户进团队后第一眼看到的也是它。启动时让它替用户「干活」,用户进门前就认识了它,也先见过它的状态动作。+- 双击以后的这几秒里做不了有用的事。窗口只做四件事:证明应用活着、在动;一眼说清下一步;只问等不了的事(导入、盘不够);把形象带进团队窗口。所以鲸鱼在哪里,进度就在哪里,字都是它说的,一次一句短话:窗口显示用户感受到的东西,不显示实现的结构(维护者 2026-10-27 的反馈)。+- 等待只取这些原则:+ - 有事做、有解释的等待显得短(Maister)。+ - 看得见真实的工作更让人放心,假进度适得其反(Buell 和 Norton;Harrison 等)。+ - 1 秒内不显示进度;超过 10 秒,要看得见进度和出路(NN/g)。+ - 入场不超过 1 秒,不为动画推迟启动(Android 启动画面)。+ - 天天看的画面动得越少越好(Kowalski)。+- 启动页是本地文件,引擎的页面在 `http://127.0.0.1`,两者跨源。同一个窗口里 `loadURL` 时,Chromium 不保留旧画面,也做不了跨文档过渡;不改 DSH 就接不上。窗口会先空一下,再露出 DSH 自己的加载过程,「打开团队」这一步用户其实看不到。+- 所以启动页放进单独的小窗口,团队界面在隐藏的主窗口里加载,挂载好了才露面。小窗口一直有 Mica,交接时没有空白帧。交接时小窗口先长成主窗口的矩形,主窗口再在同一个矩形上露面,不再从小窗口一下跳成大窗口。++## 已定的行为++### 1. 两个窗口(待定)++- 每次启动先出来**启动窗口**:+ - 内容区 720 × 540;显示器工作区不到 588 高时为 720 × 500。+ - 不能缩放、最大化和全屏,只有最小化和关闭两个系统按钮。+ - 无边框,40 px 的标题带可以拖动,里面什么都不放。+ - Windows 11 22H2 及以后用 Mica。+ - 在光标所在的显示器上居中。+- 启动窗口在交接之前不改大小:首次启动、以后的启动、卡片、失败页都在这一个尺寸里。只在交接时改一次:主进程把它长成主窗口的矩形(第 8 节)。+- **主窗口**照旧 1320 × 860:+ - 启动窗口第一次画好以后,主窗口隐藏着建好,就建在它最后的矩形上:以启动窗口的中心居中,不超出工作区;启动窗口被拖动过时,交接前按它那时的位置重新放好。露面时不再改位置和大小。+ - 引擎起来后,在里面加载引擎的本机地址(同一个地址和端口)。例外:导入卡开着、用户还没回答时不加载(插件一收到 `state` 就会建出空白团队),等回答以后、〔复制过来〕的第一段复制完以后才加载。+ - `dsBotApp.ready()` 之后才显示:启动窗口先长到同一个矩形,主窗口在它上面露面,启动窗口随后销毁(第 8 节)。+- 交接前关掉启动窗口(× 或 Alt+F4)就退出应用,走现在的退出流程:停引擎,正在复制的就停下。+- 交接前再双击图标,恢复并聚焦启动窗口;交接后聚焦主窗口。+- 首次启动的选择框和提示都挂在启动窗口上。选择框从不自己弹出,只在用户点了选文件夹的按钮或链接之后出现。+- 登录窗口([上手流程](2026-10-26-windows-onboarding.md) 第 5 节)是主窗口的子窗口,只在交接之后、用户点了某个登录入口(设置卡的〔登录 DeepSeek 账号〕、〔重新登录〕、修复卡、鲸鱼菜单)时出现;启动窗口阶段没有登录,也没有它。- - 换位置时(〔移到…〕,今天的 `notePage(t.moving)`),主窗口先隐藏,启动窗口按「以后的启动」的样子显示「正在搬 DeepSeek Bot 的数据…」(同一个卷上只是改名,这一页一闪而过)。任务栏进度照旧,搬完照旧重开;工作文件在重开后由应用后台复制,不经过启动窗口。++- 换位置时(〔移到…〕,今天的 `notePage(t.moving)`),主窗口先隐藏,启动窗口按「以后的启动」的样子显示「正在搬 DS Bot 的数据…」(同一个卷上只是改名,这一页一闪而过)。任务栏进度照旧,搬完照旧重开;工作文件在重开后由应用后台复制,不经过启动窗口。++### 2. 布局++首次启动的布局(坐标是内容区里的 DIP):++| 部分 | 没有卡片时 | 有卡片时 | 内容 |+|---|---|---|---|+| 标题带 | y 0–40 | 同左 | 空,可以拖动 |+| 已用秒数 | 右对齐 x 672,y 54–72 | 同左位置,隐藏(卡片等回答时暂停,第 4 节) | 「已用 N 秒」,13/18,`--bt-ink-2`,等宽数字,宽度固定 |+| 水道 | x 48–672,y 156–260 | x 48–672,y 76–180 | 88 px 的鲸鱼,停在三站之一;水线以下的部分被裁掉 |+| 水线 | y 260 | y 180 | 1 px `--bt-line`,首尾各 12% 渐隐;上面什么都不画 |+| 圈 | 在水线上,中心 x 180、372 | 同左,跟着水线 | 56 × 12 的细线椭圆,1 px `--bt-line-2`,停住后不透明度 .5;鲸鱼离开第 1 站、第 2 站时各留下一个,第 3 站不留;交接时淡出 |+| 鲸鱼的话 | y 274–294,居中 | y 194–214,居中 | 15/20、600,`--bt-ink`;只有一行,不换行,实在放不下才用省略号 |+| 提示行 | y 300–328,居中 | y 220–248,隐藏 | 13/18,`--bt-ink-2`;最多约 22 个字,或者只有〔打开日志文件夹〕;没有要提前知道的事时空着 |+| 纸面 | 空 | x 48–672,y 260–496 | 只放卡片 |+| 底注 | x 48,y 504–522 | 同左 | 「社区开源项目,不是 DeepSeek 官方产品」,13/18 |+| 位置行 | 右对齐 x 672,y 504–522,和底注同一行,挤不下时位置行的字省略 | 同左 | 「数据放在 C 盘(剩 412 GB)· 换个位置…」,13/18,`--bt-ink-2`;「换个位置…」是链接(第 6 节)。只在新团队和要导入的首次启动有,重装没有;导入一开始复制就收起;失败页和「团队界面没有加载出来」时隐藏,180 秒的问题开着时还能点。剩余空间按资源管理器的算法(1024 进制)。Windows 以外写文件夹(`~/.ds-bot`)代替盘;查不到剩余空间时不写括号 |++- 三站是鲸鱼停的三处:x 168 / 360 / 552,依次对应「准备数据文件夹」「启动本机引擎」「打开团队」三个阶段。站上不画标记、名字和连线:鲸鱼停在哪一站,进度就到了哪里。+- 没有卡片时,水道、水线、圈、鲸鱼的话和提示行整组比有卡片时低 80 px,鲸鱼落在窗口的视觉中心。要出卡片时,整组用 `SPRING_SHAPE` 上移 80 px,卡片出现在下面的纸面里;卡片收回后,整组再回到低处。已用秒数、底注和位置行不动。页面不能滚动(第 11 节)。+- 鲸鱼的话和提示行直接写在 Mica 上。+- 卡片是不透明的 `--bt-card`:1 px `--bt-line` 边,圆角 12,内边距 16 × 20。卡片正文比纸面高时,正文在卡片里滚动,按钮行固定在卡片底部。+- 以后的启动:+ - 没有水线、圈和底注,右上角也没有已用秒数(10 秒起写在下面的提示行里,第 5 节)。+ - 64 px 的鲸鱼在 x 360,下面一行字(15/20、600,居中)。没有卡片时整组同样低 80 px,落在窗口的视觉中心;出卡片时一样上移。++### 3. 鲸鱼的总规则++- 只为真实的事动:阶段开始和完成、出卡片、失败、就绪,以及用户的指针、点击、键盘焦点和回到窗口。唯一的例外是卡片等用户回答时的呼吸和眨眼(下面第二张表)。+- 鲸鱼面朝右。主进程报告一个阶段完成时,它向右游到下一站,身后留下一个圈:不会提前,也从不往回游。+- 等用户回答时停下:正常档和活泼档只有探身、呼吸和眨眼这几个小动作(活泼档另有越跳越稀的跳)。等得越久动得越慢,从不变快。+- 换动作时从当前姿势接着走:读出当前的 `transform`,停掉循环,再用弹簧走到下一个动作的起点。不跳回原位。+- 一个阶段等满 250 ms 才算「进行中」:鲸鱼换成这个阶段的动作,鲸鱼的话换成这一站的那句;更快完成的阶段不显示进行中,鲸鱼直接游走。+- 循环状态出现后至少停 400 ms;失败和交接不等。+- 游动排队:前一段游完才游下一段,排着的那段不再下蹲。排队不会让交接晚超过 600 ms。+- 大动作只放在 SVG 外面的 HTML 包层上,用 `translate`、`rotate`、`scale`、`transform`,交给合成线程。SVG 里只动眼睛和尾巴。+- 循环用 CSS 动画,按 `html` 上的状态属性选。一次性动作用 WAAPI,结束时 `commitStyles()` 再 `cancel()`。+- 每段一次性动作带序号,新状态到了就丢掉旧的。等动画结束的地方都配一个计时器兜底,因为最小化的窗口不走动画。+- 弹簧只用 `motion.js` 的常量。头像动作的关键帧沿用插件的写法(`styles.js` 的 `bt-hop`、`bt-bob` 等),换算成像素。+- 鲸鱼说话:+ - 鲸鱼一次只说一句短话,写在水线下面那一行(第 2 节),用 Main Bot 自己的口吻。窗口里没有大段的文字:旁边只有已用秒数、一行提示、卡片、底注和位置行(第 2 节)。+ - 问候里的名字是 Main Bot 的名字(待定):新团队用界面语言的默认名字(中文「总管」,英文 Chief,见 [上手流程](2026-10-26-windows-onboarding.md)「待定」);重装时用团队里 Main Bot 自己的名字,主进程和第 2 站提示里的 Bot、群聊数一起读出来;要导入、或者读不出名字时不带名字:「嗨,我来了」。导入卡答完之前,进门后的 Main Bot 是哪一个还没定:答〔先不复制〕就是新的空白团队。+ - 那一行跟着鲸鱼走:它停在哪一站、那一站的阶段是不是进行中、它是不是正在游、是不是已经就绪。只看主进程的快照不够,所以话从不跑到鲸鱼前面。+ - 每句话停够了才换:一般 0.9 秒,问候 1.5 秒,「找到了」0.7 秒;除了失败和 180 秒的问题,一句话至少能读满 300 ms 才被换掉。这期间被跳过的话不补说。失败和 180 秒的问题不等,立刻换上。「进去吧」等上一句能读满 400 ms 就出来。+ - 换句时淡出 .16 s,再淡入 .16 s。首次启动的这一行没有流光。+ - 卡片在时这一行空着,由卡片自己的第一行说(第 6 节);入场时就来的卡要等问候读满 1.5 秒才空(第 6 节)。180 秒的卡和失败页例外:180 秒的问题由鲸鱼问,卡上只有按钮;失败页上是已定的标题(第 7 节)。鲸鱼沉下去重新开始时(第 7 节),这一行和提示行也空着。++| 时刻 | 鲸鱼 | 时长和曲线 |+|---|---|---|+| 首次启动入场 | 从水线下浮上来,12° 的倾斜回正;尾巴甩一下;睁眼 | `SPRING_STRETCH` 560 ms;睁眼 160 ms |+| 准备数据文件夹 | 搜索:前倾探头,眼睛左右扫 | 1 s;眼睛 1.6 s |+| 一个阶段完成 | 下蹲 120 ms,向右滑 192 px,尾巴划两下,眼睛晚 80 ms 跟上;滑出 90 ms 后,身后留下一个圈:从 .5 倍张开到原大,不透明度从 .9 落到 .5,之后不再动(第 3 站不留);到站点一下头 | `SPRING_SHAPE` 420 ms;圈 `SPRING_SHAPE`,不透明度 420 ms |+| 启动本机引擎 | 工作:上下晃、尾巴摆、眨眼 | 1.6 s、1.1 s、2.4 s;52.8 s 内不完全重复 |+| 10 秒 | 看向用户 600 ms,慢眨一次眼;所有循环放慢到 0.85 倍 | 看 600 ms |+| 45 秒 | 换成思考:歪头慢慢起伏、眯眼;尾巴停下 | 2.2 s;换动作用 `SPRING_SHAPE` |+| 打开团队 | 发消息:向前冲,每冲一次尾巴划两下 | 1.1 s |+| 应用主动问(卡片、180 秒) | 跳两下,然后停下,看着卡片(停下以后见下一张表) | 1.3 s × 2 |+| 用户自己引出的卡片 | 不跳,停下 | 无 |+| 失败 | 从当前姿势下沉 4 px、低头 4°,眼皮变重,然后完全静止 | `SPRING_SHAPE` |+| 就绪(首次启动,包括重试或重新开始后第一次成功) | 「进去吧」出来 300 ms 后:压扁再拉长,「^ ^」眼;拉到最长时潜下去,深到鲸鱼身高的 1.25 倍 | 460 ms 加 `SPRING_SHAPE` |+| 就绪(以后的启动,重试或重新开始后第一次成功) | 字照旧,不说「进去吧」:压扁回弹一次,「^ ^」眼,然后潜下去,同样深到身高的 1.25 倍 | 920 ms 加 `SPRING_TAP` 290 ms |+| 就绪(以后的启动) | 直接潜下去,同样深到身高的 1.25 倍 | `SPRING_TAP` 290 ms |++鲸鱼还有下面这些小反应,每一个都有原因:卡片在等、用户做了什么,或者交接;第 9 条是唯一一个没有外因的,让工作时的上下晃不那么像循环。它更有反应,不是动得更多。安静档没有 1 到 7 和 9;减少动态效果时 1 到 9 都没有;失败页(启动失败、团队界面没有加载出来、复制失败)上也都没有。++| # | 动作 | 什么时候 | 怎么动 |+|---|---|---|---|+| 1 | 探身 | 应用主动问的卡片:最后一跳落地时(跳开始后 2.0 s;导入时空间不够的卡 0.7 s)。用户自己引出的卡片:变形开始 70 ms 后。复制中、正在下载和复制失败的卡没有 | 朝卡片前倾 2.5°(`translate(1.5px, -1px) rotate(2.5deg)`,以后的启动按 64/88 缩小),`SPRING_SHAPE`;眼睛仍看着卡片。回答时随点头收回,卡片还在时(比如换了模型设置)1 秒后再探身;抚摸时收回,指针离开后再来 |+| 2 | 呼吸 | 停下 600 ms 后 | 身体轻轻起伏(`scale` 1 → 1.008 1.018 → 1),4.2 s 一次;按这张卡自己的时钟,30 秒后放慢到 .8 倍,90 秒后 .6 倍,不再变快;状态一变,240 ms 回到原样 |+| 3 | 眨眼 | 停下后 1.4–2.2 s 第一次,以后每 3.2–6.8 s 一次(30 秒后间隔乘 1.4,90 秒后乘 2);五次里有一次连眨两下,隔 340 ms | 270 ms:眼睛压到 .03 再回来;抚摸、跳、点击转圈、看用户时不眨,眼皮重、眯眼和「^ ^」眼时也不眨 |+| 4 | 回到窗口时看你 | 窗口失去焦点 5 秒以上后又拿到焦点,或者隐藏 5 秒以上后又看得见 | 和 10 秒那次一样:看向用户 600 ms,慢眨一次眼。和 10 秒那次合算,20 秒内最多一次;只在启动循环里或停在卡片前时有,游动、跳、抚摸、潜下去和失败的姿势时没有 |+| 5 | 眼睛跟着键盘焦点 | 键盘把焦点移到纸面或提示行里的按钮、勾选框上 | 眼睛看向那个控件的中心,限幅和跟随指针一样;指针一动就交回指针。卡片出现时焦点自动移到主按钮,那一次不跟,眼睛仍看着卡片 |+| 6 | 按下预备 | 在回答卡片的按钮上按下指针(展开「详细」「详细信息」、打开模型设置的「更换」、〔复制详细信息〕不算回答) | 身体微蹲:`scale` 1.03 .97,120 ms;点下去时用 `SPRING_TAP` 弹回并点头,移开或取消只弹回;键盘只点头。卡片的动作照旧在点击时才发出 |+| 7 | 活泼档越跳越稀 | 活泼档,应用主动问、要跳两下的卡片 | 在 0、1.3、3.9、9.1 秒开始跳,以后每 9 秒一次,中间停下来呼吸、眨眼;抚摸或回答后不再跳;导入时空间不够的卡只跳一次 |+| 8 | 潜得更深 | 交接 | 潜到鲸鱼身高的 1.25 倍(首次启动 110 px,以后的启动 80 px),约 200 ms 内整个到水线下,窗口长大之前水道就空了 |+| 9 | 张望 | 第 2 站工作时(「热身中」的循环),每 5 到 9 秒一次,间隔随机 | 眼睛随机向左或向右看 600 ms:`#eye-pair` 平移 14%,150 ms 过去、停 270 ms、180 ms 回来,`ease-in-out`,叠在上下晃上。10 秒放慢后照常,45 秒换成思考后没有;眼睛跟着指针或键盘焦点时、看向用户的那 600 ms 里、抚摸和跳时都不张望,窗口看不见时也不;正张望着要看向用户时,眼睛先用 120 ms 回正。只在首次启动的第 2 站:以后的启动和搬数据的页面、复制中的卡也用工作的循环,但不张望 |++- 动画三档用团队里设的那一档:主窗口的页面报告给应用,应用记在自己的 userData 里,下次启动时用。没有记录时(首次启动)按「正常」。+ - 安静:只有第一张表的状态动作。没有眼睛跟随、点击转圈、抚摸、尾巴、点头、看向用户、涟漪和「^ ^」眼,也没有第二张表的 1 到 7 和 9。留下的圈只淡入(160 ms),不张开。+ - 正常:加上眼睛跟随指针、尾巴、点头、看向用户、涟漪、「^ ^」眼,以及第二张表的 1 到 6 和 9。首次启动等待时,点鲸鱼它会转一圈;等用户回答时可以抚摸(UI 标准 8.5)。+ - 活泼:再加上第二张表的第 7 条:等用户回答时越跳越稀,代替 UI 标准 8.4 的「一直跳」。+- 涟漪是一个 56 × 12 的细线椭圆,只在首次启动出现两次:浮上来和潜下去的地方。潜下去的那一次 160 ms 就淡完,窗口开始长大时已经没有了。以后的启动没有涟漪。鲸鱼离开一站时留下的圈也是这个椭圆,张开后就停在那里(第 2 节)。+- 鲸鱼和圈对读屏隐藏(`aria-hidden`)。三个阶段留在一个看不见的列表里(「启动进度」,每项带状态词,当前一项 `aria-current="step"`),礼貌朗读区照旧说「{阶段}:进行中」「{阶段}:已完成」。鲸鱼的话是普通文字,不进朗读区;失败的标题例外,会读出来。卡片出现时朗读它的第一行和第一句话(180 秒的卡读鲸鱼的问题)。++### 4. 首次启动,逐拍++时间从页面拿到 `?start=first` 的那一帧算起。++1. 入场:+ - 0 ms,鲸鱼在第 1 站从水线下浮上来。+ - 120 ms,涟漪。+ - 160 ms,鲸鱼的话「嗨,我是总管」淡入(重装和导入时的名字见第 3 节)。+ - 220 ms,水线淡入。+ - 360 ms,睁眼。+ - 420 ms,底注和位置行淡入。+ - 560 ms,到位。+ 入场全是 CSS,不等脚本。入场时来的卡片和就绪,等它到位再处理。问候至少停 1.5 秒,之后有新消息才换;入场时就来的卡片也等它读满(第 6 节)。+2. 到 560 ms「准备数据文件夹」还没完成、并且已经等了 250 ms,第 1 站才进入进行中,鲸鱼搜索;问候停够以后,鲸鱼说「先找个地方放东西」。鲸鱼先打招呼再出发:这一步完成得再早,它也等问候读满(淡入 160 ms 加 1.5 秒,页面画出来后 1.66 秒)才离开第 1 站,等的时候在第 1 站用工作的循环晃着(搜索到一半完成的也换过来),不说「先找个地方放东西」。这 1.66 秒只是鲸鱼在等:主进程建好数据文件夹就接着启动引擎,不等页面画出来,也不等问候;等的这段时间里引擎已经在后台热身。离开第 1 站时,只有真的说过「先找个地方放东西」,才接一句「找到了」(停 0.7 秒)。一般的首次启动里,数据阶段在页面画出来以前就结束了(主进程建文件夹要 0.3 到 1.2 秒,页面要 1 秒上下、冷启动时好几秒才画出来),所以这两句只在这个阶段慢、出过卡片或者换了新文件夹之后才出现。重新开始(第 7 节)不等问候;入场时就来的就绪照第 1 拍。+3. 「启动本机引擎」:鲸鱼在第 2 站工作,说「热身中,等我一下」。它到了第 2 站,提示行写接下来要知道的事:+ - 新团队(没有要导入的团队,数据文件夹里也没有团队):「待会儿要接一个模型:DeepSeek 账号或 API Key」。+ - 重装:「上次的 6 个 Bot 和 2 个群聊都在」(第 6 节)。+ - 要导入:没有提示。+ - 盘不够、又没有更好的盘时,前 10 秒(从第 1 站起)提示行先写「C 盘只剩 1.2 GB」,之后才换成上面这一句(第 6 节)。+4. 5 秒起,右上角显示「已用 N 秒」(`--bt-ink-2`,第 2 节),每秒改一次,数字不滚动,一直留到「进去吧」。没有百分比。+5. 10 秒,引擎还没起来:鲸鱼说「第一次会慢一点」,看向用户一次,循环放慢;提示行不变。+6. 45 秒,引擎还没起来:鲸鱼说「有点久,可能是杀毒软件在查新文件」,提示行只剩 28 px 的〔打开日志文件夹〕。鲸鱼改成思考。+7. 180 秒:见第 6 节。+8. 引擎起来:主进程在隐藏的主窗口里加载引擎的页面,开始 20 秒的就绪检查。鲸鱼游到第 3 站,改成发消息,一出发就说「开门去了」。DSH 会挂出「预览版说明」时(上手流程第 3 节的条件),提示行换成「里面先有一页说明,点「继续」就行」;不会挂出时,第 2 站的提示留着。导入卡开着、还没回答时只算第 2 站完成:不加载页面、不游到第 3 站、不开始 20 秒检查,三件事都等回答以后(〔复制过来〕的等第一段复制完)。+9. `dsBotApp.ready()`:鲸鱼说「进去吧」,见第 8 节。++- 卡片等用户回答时,已用秒数暂停并隐藏,回答后接着走。10 秒、45 秒和 180 秒都按这个时钟算:用户自己想了多久,不算在引擎头上。+- 位置行(第 2 节)从入场起就在:新团队和要导入时写「数据放在 C 盘(剩 412 GB)· 换个位置…」,什么都不点就按它走,不问。点「换个位置…」才开系统选择框(第 6 节),选择框开着时时钟也停。交接时随整组淡出(第 8 节)。++### 5. 以后的启动++- 0 ms:64 px 的鲸鱼在窗口中间浮上来(`SPRING_TAP` 290 ms),不倾斜,眼睛睁着,没有涟漪。60 ms 后,「正在打开你的团队…」淡入。- - 没有水线和圈,也没有首次启动的那些话和提示:鲸鱼下面只有这一行已定的字(换位置时是「正在搬 DeepSeek Bot 的数据…」)。++- 没有水线和圈,也没有首次启动的那些话和提示:鲸鱼下面只有这一行已定的字(换位置时是「正在搬 DS Bot 的数据…」)。+- 前 1 秒什么都不再动。1 秒后鲸鱼开始工作(只上下晃和眨眼),那行字带流光。+- 10 秒起,下面显示「已用 N 秒」。+- 45 秒:「比平时慢,请再等一会儿」〔打开日志文件夹〕。+- 180 秒:和首次启动一样。+- 就绪时没有庆祝(重试或重新开始后第一次成功时例外,第 8 节):字淡出 .16 s,鲸鱼从当前姿势潜下去;120 ms 时发 `handoffShow`,启动窗口和首次启动一样长成主窗口的矩形,主窗口在就绪后约 0.6 秒露面(第 8 节)。+- `DS_BOT_HOME` 的一次性运行用这一套,只是不出卡片。++### 6. 卡片、180 秒和导入++- 所有卡片用同一套变形:+ - 出现:鲸鱼的话和提示行淡出 .16 s(问候还没读满 1.5 秒时,等它读满再淡出,见下面);整组先上移 80 px(第 2 节,首次启动和以后的启动一样);卡片的底色和边线两层从 0 高长到内容的高度(`clip-path`,走 `SPRING_SHAPE`;底色 .22 s 淡入);内容先按最终尺寸排好,晚 70 ms 淡入;焦点移到主按钮。+ - 回答后:内容 .16 s 退场(下沉 6 px、缩到 .975、模糊 3px),卡片收回,整组再回到低处,鲸鱼的话接着跟着鲸鱼走(第 3 节)。+- 卡片在时鲸鱼的话空着、提示行隐藏。入场时就来的卡(导入、推荐盘):问候读满 1.5 秒才淡出,这段时间(约 1 秒)它和卡片的第一行同时在,问候不会只闪一下。卡片自己的第一行是鲸鱼说的一句(15/20、600,一行),写在已定的内容上面,内容本身不变:+ - 导入卡:「找到你以前的团队了」。+ - 推荐盘:「C 盘有点挤」(空间不够),「这里不让我放东西」(默认位置不能用)。+ - 「会放在…」:「我多加了一层文件夹」。+ - 被拒绝的卡:「这里放不了」。+ - 找不到数据文件夹:「数据不在原来的地方了」。+ - 导入时空间不够:「地方不够放」。+ - DSH 正在用这个团队:「DeepSeek Harness 还在用这个团队」。+ - 更新版本的对话,和它的「正在下载」:「这些对话比我新」。+ - 复制中:标题就是「正在搬过来」。+ - 恢复卡、团队界面没有加载出来和复制失败的卡没有这一行,也不说俏皮话(第 7 节)。180 秒的卡也没有,问题由鲸鱼问。+- 鲸鱼跳不跳:+ - 应用主动问的卡片(推荐盘、找不到数据文件夹、导入、180 秒),跳两下,最后一跳落地时探身看着卡片,然后停下(第 3 节第二张表)。+ - 用户自己引出的卡片(「其他位置…」选完后的「会放在…」、停止复制的确认),不跳,变形开始 70 ms 后探身。+ - 同一件事又出了新问题(复制时空间不够),跳一下。+- 选位置的卡片只有推荐盘这一种,只在首次启动出现,〔放到 D 盘〕〔仍然放在 C 盘〕都已经试写通过(上手流程第 3 节);以后的启动还会出「找不到数据文件夹」卡:- - 推荐盘:「C 盘只剩 1.2 GB。放到 D 盘(剩 412 GB)?」〔放到 D 盘〕(主按钮,拿到焦点)〔仍然放在 C 盘〕,按钮行末尾一个小链接「其他位置…」。默认位置不能用时,第一句换成原因(「DeepSeek Bot 没有权限在 `C:\Users\<用户名>` 里写文件。」),第二句一样;按钮只有〔放到 D 盘〕(主按钮)和小链接「其他位置…」,没有〔仍然放在 C 盘〕;没有可推荐的盘时只有〔选择其他位置…〕。- - 「其他位置…」打开系统选择框,卡片留在后面。定出的根就是用户选的文件夹时(上手流程第 3 节的规则),卡片直接收回,照常启动,不确认。应用在里面加了一层 `DeepSeek Bot` 时,同一张卡变形成「会放在 `D:\DeepSeek Bot`。」〔继续〕(主按钮)〔重新选…〕。选的位置不能用,同一张卡写一句原因(「DeepSeek Bot 没有权限在 `D:\Data` 里写文件。」「`C:\Users\<用户名>\OneDrive\文档` 在 OneDrive 里,同步会打断正在写入的对话。」「`D:\Projects\DeepSeek Bot` 里已经有别的文件。」),〔重新选…〕(主按钮),来时那张卡的〔放到 D 盘〕〔仍然放在 C 盘〕照旧留着;选择框被取消就回到来时的卡。「会放在…」和被拒绝的卡也有脚注。++ - 推荐盘:「C 盘只剩 1.2 GB。放到 D 盘(剩 412 GB)?」〔放到 D 盘〕(主按钮,拿到焦点)〔仍然放在 C 盘〕,按钮行末尾一个小链接「其他位置…」。默认位置不能用时,第一句换成原因(「DS Bot 没有权限在 `C:\Users\<用户名>` 里写文件。」),第二句一样;按钮只有〔放到 D 盘〕(主按钮)和小链接「其他位置…」,没有〔仍然放在 C 盘〕;没有可推荐的盘时只有〔选择其他位置…〕。++ - 「其他位置…」打开系统选择框,卡片留在后面。定出的根就是用户选的文件夹时(上手流程第 3 节的规则),卡片直接收回,照常启动,不确认。应用在里面加了一层 `DS Bot` 时,同一张卡变形成「会放在 `D:\DS Bot`。」〔继续〕(主按钮)〔重新选…〕。选的位置不能用,同一张卡写一句原因(「DS Bot 没有权限在 `D:\Data` 里写文件。」「`C:\Users\<用户名>\OneDrive\文档` 在 OneDrive 里,同步会打断正在写入的对话。」「`D:\Projects\DS Bot` 里已经有别的文件。」),〔重新选…〕(主按钮),来时那张卡的〔放到 D 盘〕〔仍然放在 C 盘〕照旧留着;选择框被取消就回到来时的卡。「会放在…」和被拒绝的卡也有脚注。+ - 脚注都是「以后可以在 设置 → 通用 → 位置 里改。」+ - 没有更好的盘时不出卡片:前 10 秒提示行写「C 盘只剩 1.2 GB」,之后换成这一站的提示(第 4 节)。- - 位置行的「换个位置…」(第 2 节)不等推荐盘的卡:新团队和要导入的首次启动期间随时能点,引擎正在起也可以,走和「其他位置…」同一条路。选完先定根(上手流程第 3 节「一个位置」):根就是选的文件夹时不出卡,直接重新开始;加了一层 `DeepSeek Bot` 时出「会放在 `D:\DeepSeek Bot`。」〔继续〕(主按钮)〔重新选…〕;不能用时出「这里放不了」加一句原因(上面三句,再加「`D:\Data` 是 DeepSeek Harness 的数据。」「`C:\Program Files\DeepSeek Bot\data` 在程序文件夹里,卸载时会删掉。」),〔重新选…〕(主按钮);这两张卡都是用户自己引出的,不跳。选择框被取消就回到位置行:这一路没有来时的卡,「会放在…」和「这里放不了」也一起收回,仍按默认位置走。选了现在的根或数据文件夹就当没选;选在现在的数据文件夹里面、或者定出的根和它重叠,出「这里放不了」加「`C:\Users\<用户名>\.ds-bot\旧` 和现在放数据的位置重叠。」,总工作区里已经有东西时也一样,还空着的(这次启动刚建的)可以成为新的根:默认位置下选用户文件夹,就是「会放在 `C:\Users\<用户名>\DeepSeek Bot`。」;读不了的文件夹按没有权限处理;检查都穿过链接和联接看真正的路径,DSH 的家那句写用户选的文件夹。选择框或这两张卡开着时团队就绪了,交接和 20 秒的界面检查都等答完再走:交接会把启动窗口连同挂在它上面的选择框一起收掉。定好以后按第 7 节〔换个位置…〕的路重新开始:鲸鱼立刻沉下去,位置行立刻写新的盘;旧引擎直接结束,不等它起完、也不等它有序退出(两者都要 3 到 10 秒,鲸鱼会一直在水下;那个文件夹马上就删,没有要保全的东西),默认位置上这一次建的文件夹删掉(数据文件夹整个删,总工作区只在还是空的时候删),位置这时就记下,鲸鱼在第 1 站重新浮上来;沉下去时这一行立刻空着,不等上一句停够。导入复制进行中不接这一下,复制完以后这一行收起:搬一个复制好的团队是 设置 → 通用 → 位置 的事。++ - 位置行的「换个位置…」(第 2 节)不等推荐盘的卡:新团队和要导入的首次启动期间随时能点,引擎正在起也可以,走和「其他位置…」同一条路。选完先定根(上手流程第 3 节「一个位置」):根就是选的文件夹时不出卡,直接重新开始;加了一层 `DS Bot` 时出「会放在 `D:\DS Bot`。」〔继续〕(主按钮)〔重新选…〕;不能用时出「这里放不了」加一句原因(上面三句,再加「`D:\Data` 是 DeepSeek Harness 的数据。」「`C:\Program Files\DS Bot\data` 在程序文件夹里,卸载时会删掉。」),〔重新选…〕(主按钮);这两张卡都是用户自己引出的,不跳。选择框被取消就回到位置行:这一路没有来时的卡,「会放在…」和「这里放不了」也一起收回,仍按默认位置走。选了现在的根或数据文件夹就当没选;选在现在的数据文件夹里面、或者定出的根和它重叠,出「这里放不了」加「`C:\Users\<用户名>\.ds-bot\旧` 和现在放数据的位置重叠。」,总工作区里已经有东西时也一样,还空着的(这次启动刚建的)可以成为新的根:默认位置下选用户文件夹,就是「会放在 `C:\Users\<用户名>\DS Bot`。」;读不了的文件夹按没有权限处理;检查都穿过链接和联接看真正的路径,DSH 的家那句写用户选的文件夹。选择框或这两张卡开着时团队就绪了,交接和 20 秒的界面检查都等答完再走:交接会把启动窗口连同挂在它上面的选择框一起收掉。定好以后按第 7 节〔换个位置…〕的路重新开始:鲸鱼立刻沉下去,位置行立刻写新的盘;旧引擎直接结束,不等它起完、也不等它有序退出(两者都要 3 到 10 秒,鲸鱼会一直在水下;那个文件夹马上就删,没有要保全的东西),默认位置上这一次建的文件夹删掉(数据文件夹整个删,总工作区只在还是空的时候删),位置这时就记下,鲸鱼在第 1 站重新浮上来;沉下去时这一行立刻空着,不等上一句停够。导入复制进行中不接这一下,复制完以后这一行收起:搬一个复制好的团队是 设置 → 通用 → 位置 的事。+- 重装(`C:\Users\<用户名>\.ds-bot` 里有团队、没有保存的位置)不出卡片,盘不够也不出:鲸鱼到了第 2 站,提示行写「上次的 6 个 Bot 和 2 个群聊都在」,不写路径,也没有接模型的提示。+- 180 秒:鲸鱼立刻问「等太久了,要不要重试?」,卡片里只有〔继续等待〕(主按钮)〔重试〕〔打开日志文件夹〕,读屏读的是这句问话。+ - 〔继续等待〕:卡片收回,180 秒后再问。+ - 〔重试〕:重启引擎,时钟从 0 开始,鲸鱼抖一抖,回到工作。+ - 卡片还在时引擎起来了:卡片收回,照常游到第 3 站。+- 找不到数据文件夹(多见于以后的启动):文字和按钮按第 3 节已定的,主按钮在前。〔重试〕后还是找不到:按钮下面出现「还是找不到这个文件夹。」(`--bt-danger`,4 秒后淡出)。鲸鱼的眼睛左右看一遍,不跳。+- 导入(第 4 节)都在纸面里,用同一套变形:+ - 导入卡一句话:「DeepSeek Harness 里有 6 个 Bot 和 2 个群聊(对话 1.2 GB,工作文件 3.4 GB)。复制过来?」,下面一行小字「复制后会多占 4.6 GB,DeepSeek Harness 里的原件不动。」,〔复制过来〕(主按钮,拿到焦点)〔先不复制〕,脚注「也可以在 设置 → 通用 → 位置 里复制。」「详细」是和失败页一样的折叠区:找到的名字和段数、会复制什么、「模型设置:DeepSeek API · DeepSeek-V4-Pro 更换」、两个勾选框;展开时卡片的边用 `SPRING_SHAPE` 长高,内容晚 70 ms 淡入。+ - 卡片一出现,第 2 站就开始预热,没被 DSH 占着时检查对话同时进行,鲸鱼在第 2 站跳两下后停下;预热好了也只算第 2 站完成,不游到第 3 站。答〔先不复制〕时鲸鱼点一下头,预热好的引擎接着当正式引擎用,不重启。+ - 空间不够(只查第一段):「空间不够:复制要约 1.7 GB,C 盘只剩 1.5 GB,还差 0.2 GB。」〔选择其他位置…〕(主按钮)〔先不复制〕+ - 复制中:+ - 卡片标题「正在搬过来」,三步竖着排,各带一个 16 px 的标记(没开始:一圈细线;进行中:`--bt-ink` 圈加 6 px 实心点;完成:`--bt-green` 圆底对勾,`SPRING_POP` 弹出):「检查对话 23/143」→「复制 Bot 和对话 820 MB / 1.2 GB」→「启动团队」。+ - 当前一步下面是 4 px 的真实进度条(`scaleX`,`SPRING_LIST`),不往回走。+ - 剩余时间按整分钟写:「还要大约 2 分钟」「不到 1 分钟」。变动满一分钟才改,不倒数到 0。+ - 任务栏进度显示在启动窗口上。+ - 鲸鱼工作,每完成一步点一下头。+ - 停止复制:确认在卡片里就地展开:「停下后不会留下复制了一半的团队,DeepSeek Harness 里的团队不受影响。」〔继续复制〕(主按钮)〔停止复制〕(危险色文字)。鲸鱼停下。+ - DSH 正在用这个团队(答〔复制过来〕后):鲸鱼停下,不晃。每 2 秒重查一次,不显示任何东西;锁一放开,卡片直接变成复制中。卡上一个〔先不复制〕(主按钮)。「正在下载」的卡也有〔先不复制〕(主按钮),加「下载太慢?手动下载」;下载失败时〔重试〕〔手动下载〕。+ - 复制失败:鲸鱼用失败的姿势。+ - 工作文件不经过启动窗口:团队打开后由应用在后台复制,进度在 设置 → 通用 → 位置 和 Main Bot 聊天里的「复制好了」卡上。++### 7. 失败、更新和界面没加载出来++- 失败后 1 秒内:- - 鲸鱼的话立刻换成「DeepSeek Bot 没能启动」,读屏读出这一句。++ - 鲸鱼的话立刻换成「DS Bot 没能启动」,读屏读出这一句。+ - 鲸鱼在它停的那一站换成失败的姿势(第 3 节),站上不画叉:失败只靠鲸鱼的姿势和这一句。+ - 已用秒数和提示行淡出。+ - 纸面变成恢复卡:一句原因、五个按钮、「详细信息」。卡片没有鲸鱼的第一行。+ - 焦点移到〔重试〕。窗口不隐藏。+- 〔复制详细信息〕点过后,按钮上的字变成「已复制」,1.6 秒后变回来。「详细信息」最多展开 168 px,日志在框里滚动。+- 有新版本时:+ - 恢复卡在原因和按钮之间展开一条更新条。〔下载并安装〕成为唯一的主按钮,〔重试〕变成普通按钮。+ - 下载中显示「正在下载 {版本}(37%,78/212 MB)」、4 px 的进度条和「下载太慢?手动下载」。+ - 下载完显示「正在安装,装好后会重新打开。」+ - 下载失败显示「下载失败。」〔重试〕〔手动下载〕。+ - 鲸鱼抬一次头,看向更新条,然后又静止。+- 恢复卡上的选择:+ - 〔重试〕:已完成的阶段保持完成,留下的圈不动;失败的那个阶段回到进行中,鲸鱼抖一抖,回到工作,鲸鱼的话回到这一站的那句。+ - 〔换个位置…〕和〔用新的空白团队开始…〕:先选文件夹(定根和首次启动同一条规则);然后鲸鱼的话和提示行空着,鲸鱼沉到水线下,留下的圈一起淡出(.16 s),三个阶段回到未开始,鲸鱼在第 1 站重新浮上来,说「先找个地方放东西」。位置行的「换个位置…」(第 6 节)走同一条路;阶段被收回时,就算下一个快照里第 1 站马上又完成了,鲸鱼也先沉下去。+ - 重试或重新开始后第一次成功时庆祝一次:首次启动照第 8 节的表,先说「进去吧」;以后的启动不说「进去吧」,字照旧,压扁回弹 920 ms 后潜下去(第 8 节)。+- 团队界面 20 秒没加载出来:+ - 主窗口始终不显示。+ - 鲸鱼在第 3 站换成失败的姿势,它的话换成「团队界面没有加载出来」,不画叉;卡片里是〔重新载入〕〔打开日志文件夹〕〔复制详细信息〕,没有鲸鱼的第一行。+ - 〔重新载入〕:在隐藏的主窗口里重新载入,回到第 3 站,20 秒重新算。+ - `ready()` 晚到了也直接交接,不庆祝。++### 8. 交接++首次启动(重试或重新开始后第一次成功也一样)。`t0` 是 `ready()` 到达后、鲸鱼停在第 3 站的那一刻;`c` 是「进去吧」在屏幕上满 300 ms、庆祝开始的那一刻:++| 时间 | 启动窗口 | 主进程 |+|---|---|---|+| `t0` | 上一句能读满 400 ms 后,鲸鱼的话换成「进去吧」(淡出、淡入各 .16 s) | |+| `c`(「进去吧」出来 300 ms 后) | 「^ ^」眼;开始压扁 | |+| `c` + 160 ms | 已用秒数和提示行淡出 | |+| `c` + 460 ms | 拉到最长时潜下去,深到身高的 1.25 倍;鲸鱼的话、水线、圈、纸面和底注淡出 .16 s | |+| `c` + 560 ms | 涟漪,160 ms 淡完 | |+| `c` + 620 ms(`t0` 后约 1.1 s) | 发 `handoffShow` | 主窗口已经隐藏着放在最后的矩形上(以启动窗口的中心居中,不超出工作区);任务栏上仍是启动窗口的按钮 |+| `handoffShow` + 160 ms | 页面已经空了:字淡完,鲸鱼潜下去,涟漪没了,只剩 Mica | 把启动窗口从 720 × 540 长到主窗口的矩形,300 ms,逐步 `setBounds`,约 14 ms 一步 |+| `c` + 880 ms | 潜完,发 `handoffDone` | |+| `handoffShow` + 460 ms | | 长到位;主窗口在同一个矩形上、在启动窗口上面露面,用系统自己的打开过渡;启动窗口同时离开任务栏,应用的任务栏按钮一直在 |+| `handoffShow` + 760 ms | | 主窗口露面 300 ms 后销毁启动窗口 |++- 首次启动时主窗口在就绪后约 1.6 秒露面。+- 长大由主进程做:Electron 44 在 Windows 上不理 `setBounds` 的 `animate` 参数,只能一步一步改大小。每一步页面都重新排版,但只重画其中一部分(探针里 23 步重画了 8 次),所以长大时页面上除了 Mica 什么都不能有。+- 以后的启动:字淡出 .16 s,鲸鱼 290 ms 潜下去;120 ms 时发 `handoffShow`,290 ms 时发 `handoffDone`。长大和露面和首次启动一样从 `handoffShow` 算起,主窗口在就绪后约 0.6 秒露面。+- 以后的启动重试或重新开始后第一次成功(第 7 节):字照旧,不说「进去吧」;压扁回弹 920 ms,「^ ^」眼,然后 290 ms 潜下去;`handoffShow` 约在就绪后 1.04 秒(920 ms 加 120 ms),长大和露面照旧从它算起,主窗口约 1.5 秒露面。+- 页面没发 `handoffShow` 时,主进程自己显示主窗口:首次启动在 2.5 秒后(最坏 1.17 秒,加上最多 600 ms 的排队游动,再留余量);以后的启动在 0.8 秒后,只有庆祝的那次(重试或重新开始后第一次成功,约 1.04 秒才发 `handoffShow`)也是 2.5 秒。+- 减少动态效果:不长大。首次启动「进去吧」照样先停 300 ms,「^ ^」眼再停 300 ms,内容淡出 .12 s 后发 `handoffShow`(就绪后约 0.86 秒),主窗口直接出现在它最后的矩形上(第 9 节)。+- 启动窗口有焦点时,主窗口直接显示并拿到焦点。+- 启动窗口没有焦点时,主窗口不抢焦点,放在启动窗口原来的层次上,任务栏按钮闪烁。+- 启动窗口最小化着时不长大,主窗口也最小化着出现,任务栏按钮闪烁。+- 鲸鱼不跨窗口:两个窗口、两个渲染进程、两个来源,画不了一条跨窗口的路。它在启动窗口里潜下去,首次启动时在团队界面侧栏 Main Bot 的磁贴上浮上来一次(待定):+ - 主窗口露面时,磁贴上的鲸鱼从 `translate(0, 18%) rotate(-8deg)` 用 `SPRING_STRETCH` 560 ms 浮到原位,不透明度 .16 s 淡入;眼睛先闭着,300 ms 时睁开(160 ms);400 ms 时主 Bot 星标淡入(.22 s)。Main Bot 聊天里的第一张卡(新团队的设置卡,导入来的团队的「复制好了」卡,[上手流程](2026-10-26-windows-onboarding.md) 第 4、5 节)等它浮上来,640 ms 起才出现。+ - 浮上来由插件做。在这之前磁贴上的鲸鱼和星标不画;页面从主进程经 `dsBotApp` 发的露面事件知道主窗口露面了、这是不是首次启动(主进程每次显示主窗口都发,兜底显示时也发;这个事件待定,见「待定」)。没有 `dsBotApp`(DSH Desktop、DSH Web)、不是首次启动、或者减少动态效果时不浮:鲸鱼、星标和第一张卡从第一帧起就在。安静档照样浮上来:它是状态动作,和启动窗口的入场一样。+ - 「预览版说明」盖着侧栏时怎么办,见「待定」。+- 主窗口第一次露面时,DSH 的加载、第一次挂载侧栏(#559)都已经做完,「预览版说明」已经显示出来。+- 两个窗口各用各的颜色:启动窗口是 DeepSeek 主题的浅色或深色,主窗口是用户自己的主题。++### 9. 减少动态效果++- 跟随 `prefers-reduced-motion`(Windows 上是 设置 → 辅助功能 → 视觉效果 → 动画效果)。窗口开着时切换,也立刻生效:正在跑的动画直接到终点。+- 鲸鱼一直是静止的画面:没有浮上来、游动、循环、跳、涟漪、尾巴、跟随和抚摸,也没有第 3 节第二张表的八种动作。换站时淡出 .12 s,换到新的一站,再淡入 .12 s。+- 状态只靠眼睛直接切换:平时睁眼,45 秒起眯眼,就绪时显示「^ ^」600 ms,失败时眼皮变重。+- 圈、鲸鱼的话、复制中的对勾、卡片、提示行和更新条只淡入 .12 s、淡出 .16 s,没有模糊、位移和缩放。圈不张开;卡片高度直接到位(内容先是透明的);整组上移、回到低处也直接到位;没有流光。+- 交接时不长大:内容淡出 .12 s,然后发 `handoffShow`,主窗口直接出现在它最后的矩形上(第 8 节)。+- 信息一样不少:已用秒数照常走,鲸鱼的话、提示行、按钮、看不见的阶段列表和朗读都在。++### 10. 颜色、Mica 和标题带++- 颜色是 UI 标准 2.1 节的 DeepSeek 主题,浅色、深色各一套,定义在 `start.css` 的 `:root` 上。由 `start-assets.mjs` 从 `themes.js` 和 `inks.js` 生成,用 `--check` 对照。鲸鱼用 `--bt-ink-deepseek`(`#4D6BFE` / `#6A84FF`)。+- 浅色还是深色看 `nativeTheme.themeSource`:+ - 主进程把团队界面最后一次报告的值和动画档,记在 userData 的 `start-frame.json` 里,建启动窗口之前先设好。+ - 没有记录时跟随系统。+ - 不写 `DSH_HOME` 和 `~/.dsh`。+- Windows 11 22H2 及以后:+ - 窗口用 `backgroundMaterial: 'mica'`,背景 `#00000000`;页面的 `html`、`body` 透明。+ - 系统按钮颜色 `#00000000`,符号用 `--bt-ink`,按钮下面也是 Mica。+ - Mica 上最浅的字用 `--bt-ink-2`,不用 `--bt-ink-3`:已用秒数和提示行也是。+- 其他 Windows:窗口背景和系统按钮颜色都用 `--bt-main`。页面照样透明,自己不用分辨是哪种情况。+- 一屏最多两处大面积强调色:鲸鱼和唯一的主按钮。+- 没有警告色(`--bt-warn` 未定):空间不足、OneDrive 和慢的提示都用中性墨色。+- 字体:`-apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI", system-ui, sans-serif`;路径和日志用 `ui-monospace, Consolas, monospace`。字号只有 13/18、14/22、15/20(600),数字用等宽数字。+- macOS 和 Linux:系统标题栏,没有标题带,其余一样。++### 11. 实现++- `main.mjs` 启动时的顺序:+ 1. `setMenu`。+ 2. 读 `start-frame.json`,设 `themeSource`。+ 3. `hostPort()`,挪到建窗口之前。+ 4. 建启动窗口(`show: true`),`loadFile`。+ 5. 动态导入其余模块。+ 6. 位置检查(结果变成卡片)。+ 7. 启动引擎。+ 启动窗口画好后,再在最后的矩形上建隐藏的主窗口。+- 启动页的文件:+ - `start.html`:CSP `default-src 'self'; base-uri 'none'; object-src 'none'`,没有内联样式和脚本。+ - `start.css`。+ - `start.js`:桥和界面。+ - `whale.js`:鲸鱼的状态机。+ - `text.mjs`:中英文的唯一一张表,启动页和主进程的系统对话框都用。层、键名、写法规则和测试见 [启动页文案](2026-10-29-start-copy.md):键的第一段是那里定的层(`voice`、`say`、`hint`、`card`、`reason`、`btn`、`note`、`foot`、`status`、`dialog`),说的是这行字在页面的哪里,每层一条写法规则。+ - 预算:这五个文件合计不超过 45 KB(未压缩,原型定的目标);原型超了,怎么办见「待定」。+- 所有状态的 DOM 一开始就在页面里,用 `hidden` 和属性切换,运行时不插入大块节点。+- 三个阶段在页面里是一个看不见的列表(`ol`,「启动进度」),`aria-current` 和状态词照旧更新;看得见的只有鲸鱼、水线和圈。+- 鲸鱼的话不直接跟快照走:`whale.js` 的 `stage()` 报告鲸鱼在哪一站、哪个阶段显示进行中、是不是在游、是不是正沉下去、是不是「进去吧」,`start.js` 照它选这一句,按第 3 节的停留时间排队。「进去吧」上屏的时刻由 `start.js` 告诉 `whale.js`(`readyLine`,最多等 600 ms),庆祝从那以后 300 ms 开始。+- `html` 是 `overflow: hidden`,`body` 是 `overflow: clip`:整组低着时超出的部分被裁掉,焦点、滚动锚点和恢复的滚动位置都移不动页面。+- 鲸鱼的 SVG 由 `start-assets.mjs` 从 `characterMarkup('whale', 'deepseek')` 生成后写进 `start.html`,遮罩 id 固定。同一个脚本把 `motion.js` 的弹簧和主题色写进 `start.css`。`npm test` 跑它的 `--check`。+- 预载只在页面地址正好是启动页时暴露 `dsBotStart`(`onState`、`act`)。+- 主进程每次都发完整的状态,页面重新载入后再发一次。预载记住最后一份,有人订阅时先补发。+- 主进程只接受来自启动窗口主框架、地址完全相同的 `act`,而且名字要在白名单里。+- 主进程管:阶段、180 秒和 20 秒两个计时器、交接的兜底计时器、任务栏进度、更新状态。页面按时钟算 5 秒、10 秒和 45 秒。+- 交接时的长大也由主进程做:主窗口一建就在最后的矩形上,`handoffShow` 后 160 ms 用逐步的 `setBounds` 把启动窗口长过去,460 ms 显示主窗口、同时让启动窗口离开任务栏,再过 300 ms 销毁启动窗口(第 8 节)。兜底计时器按这次交接是不是首次启动、有没有庆祝选 2.5 秒或 0.8 秒。启动页只发 `handoffShow` 和 `handoffDone` 两个事件,和原来一样;主窗口露面时主进程告诉团队界面,让磁贴上的鲸鱼浮上来(第 8 节,待定)。+- `main.log` 记三个阶段各用了多久。+- 启动窗口在交接时销毁,它的渲染进程一起退出。++## 改动的已定设计++| 原来的设计 | 现在 |+|---|---|+| [Windows 上手流程](2026-10-26-windows-onboarding.md) 第 3 节「启动页和引擎的页面共用这个窗口」 | 启动页在单独的启动窗口里;引擎的页面在隐藏的主窗口里加载,`dsBotApp.ready()` 之后主窗口才显示(待定) |+| 同上「选择框挂在窗口上」 | 挂在启动窗口上,从不自己弹出 |+| 同上 首次启动说明的第三条「聊天和设置保存在这台电脑上……· 社区开源项目,不是 DeepSeek 官方产品」 | 「社区开源项目,不是 DeepSeek 官方产品」是首次启动每一屏的底注,卡片不盖住它;前半句随说明一起去掉(见下面「首次启动的说明」那一行) |+| 同上 20 秒没就绪时「回到启动页」 | 启动窗口一直在,主窗口不显示 |+| 同上「首次启动期间再双击图标:恢复并聚焦已有窗口」 | 聚焦正在显示的那个窗口 |+| 同上 第 8 节 以后的启动「只写『正在打开你的团队…』」 | 另外 10 秒起显示已用秒数;45 秒显示「比平时慢,请再等一会儿」;180 秒同首次启动 |+| 同上「改动的已定设计」:窗口先加载启动页,再加载引擎的本机地址 | 启动窗口先出来;主窗口隐藏着加载引擎的本机地址(同一个地址和端口),就绪后才显示 |+| 同上 验收「进程启动后 2 秒内窗口可见」「没有一个 `dialog.show*` 不挂在主窗口上」 | 两条里的窗口都指启动窗口 |+| [桌面应用](2026-10-16-desktop-app.md)「窗口」 | 加上启动窗口:720 × 540,不能缩放,只有最小化和关闭,Mica;交接时由主进程长成主窗口的矩形(第 8 节) |+| [UI 标准](../design/ui-standard.md) 4.4 头像尺寸 | 加 88(启动窗口,首次启动) |+| 同上 8.3 状态动作 | 加只在启动窗口里有的动作:浮上来、游到下一站、点头、潜下去、尾巴摆 |+| 同上 3.1 字族 | 启动窗口加 `"Microsoft YaHei UI"`,记进第 14 节 |+| 同上 12 可访问性 | 新出现的卡片和恢复页,焦点移到主按钮 |+| [Windows 上手流程](2026-10-26-windows-onboarding.md) 第 3 节「标题「正在准备你的 Bot 团队…」,下面三个真实阶段,各带进度勾」;本文首稿第 2 节的标题行和三站(16 px 标记的四种样子、阶段名、站间的细线、进行中的流光) | 没有标题行,阶段不画出来:鲸鱼停在哪一站就是进度,离开的站留下一个圈,水线上不画别的;三个阶段只留在看不见的列表「启动进度」里,朗读照旧;已用秒数移到右上角;没有卡片时整组低 80 px(第 2、3 节) |+| 同上 首次启动的说明(产品介绍、「下一步:接上一个模型…」、「聊天和设置保存在这台电脑上…」、写位置的小字、「接下来会先显示 DeepSeek Harness 的「预览版说明」…」);本文首稿第 4 节第 3 拍逐段出现的说明 | 不再有说明。鲸鱼一次说一句短话(第 3、4 节);提示行只写接下来要知道的一件事:「待会儿要接一个模型:DeepSeek 账号或 API Key」「里面先有一页说明,点「继续」就行」;首次启动不写完整路径,底注右边的位置行只写盘和剩余空间(2026-10-28 第二次补),路径只在卡片和 设置 → 通用 → 位置 里出现 |+| 本文 2026-10-28 首稿:首次启动没有自己选位置的入口,只有推荐盘的卡上才有「其他位置…」 | 位置行「数据放在 C 盘(剩 412 GB)· 换个位置…」随时能点(第 2、4、6 节)。维护者 2026-10-28:「给出建议,同时提供自行选择的接口,避免小弹窗」 |+| 同上 超过 10 秒、45 秒的提示「第一次启动会慢一些,Windows 可能在检查刚装好的文件。」「比平时慢,可能是杀毒软件在检查新文件,请再等一会儿。」 | 首次启动由鲸鱼说「第一次会慢一点」「有点久,可能是杀毒软件在查新文件」,45 秒时提示行只有〔打开日志文件夹〕;以后的启动不变 |+| 同上 启动超过 180 秒:「启动比平常慢很多。可以再等一会儿,或者重试。」 | 鲸鱼问「等太久了,要不要重试?」,卡片里只有〔继续等待〕〔重试〕〔打开日志文件夹〕 |+| 同上 重装时说明的小字「接着用上次的数据:6 个 Bot、2 个群聊(`C:\Users\<用户名>\.ds-bot`)。可以在 设置 → 通用 → 位置 里改。」(本文第 6 节照写) | 提示行写「上次的 6 个 Bot 和 2 个群聊都在」,不写路径 |+| 本文首稿 第 6 节 复制中的标题「正在复制 Bot 团队…」,三步「用和三站一样的标记」 | 标题「正在搬过来」;三步的标记照旧,写在第 6 节(三站已经没有标记) |+| 同上「不做什么」:「鲸鱼不说话、不冒气泡、不挡卡片和按钮,也不要用户做什么」;第 3 节「一个阶段完成……身后的标记弹出对勾」;第 7 节失败的那一站换成危险色的叉 | 鲸鱼说一句和它的状态有关的短话,卡片的第一行也是它说的(失败的卡除外);只有 180 秒那一句是问题,回答在卡片的按钮上;仍然不放轮播的提示和笑话,不冒气泡;完成时留下一个圈;失败只靠鲸鱼的姿势和已定的标题,不画叉 |+| 同上 第 1 节「启动窗口从不改大小」 | 交接之前不改;交接时由主进程把它长成主窗口的矩形,主窗口一建就在这个矩形上(第 1、8 节) |+| 同上 第 8 节 交接:`t0` 后 620 ms 发 `handoffShow`,这时启动窗口离开任务栏、主窗口显示,主窗口显示满 250 ms(最晚 400 ms)关掉启动窗口;以后的启动 120 ms 时显示主窗口;页面没发 `handoffShow` 时首次启动 1.5 秒兜底;「不做什么」「不为动画推迟启动」「庆祝只在首次启动和重试后第一次成功时有」 | 首次启动先说「进去吧」,300 ms 后庆祝;`handoffShow` 在就绪后约 1.1 秒;160 ms 后启动窗口用 300 ms 长到主窗口的矩形,主窗口在 460 ms 露面,启动窗口这时才离开任务栏,再过 300 ms 销毁;主窗口在就绪后约 1.6 秒露面(以后的启动约 0.6 秒,以后的启动庆祝的那次约 1.5 秒);兜底改成首次启动和庆祝的交接 2.5 秒,其余以后的启动仍是 0.8 秒;减少动态效果时不长大;不为动画推迟引擎和团队界面的加载,交接为了长大多等约 460 ms;以后的启动庆祝时不说「进去吧」 |+| [UI 标准](../design/ui-standard.md) 第 1 节第 4 条和 8.4「持续的环境动画只出现在「活泼」档」;8.4 活泼档「等你回答时一直跳」;8.3 状态动作 | 只在启动窗口里、卡片等用户回答时,正常档和活泼档也呼吸和眨眼;活泼档改成越跳越稀;另加探身、按下预备、眼睛跟着键盘焦点、回到窗口时看你一眼(第 3 节第二张表)。安静档和减少动态效果时都没有;插件里的头像不变 |+| 本文首稿 第 3 节「只为真实的事动:……以及用户的指针和点击」「等用户回答时静止」;第 3 节的表和第 6 节「跳两下,然后静止,看着卡片」「不跳,静止」 | 等用户回答时停下:探身、呼吸和眨眼(第 3 节第二张表),另为键盘焦点和回到窗口而动;安静档、减少动态效果和失败页上停下就不再动 |+| 本文 2026-10-28 第 4 节第 2 拍「已经完成的话,直接游到第 2 站」 | 等问候读满(页面画出来后 1.66 秒)才离开第 1 站,等的时候晃着(第 4 节)。维护者 2026-10-29 试用时「小鲸鱼看到的时候就在第二个位置」:主进程在页面画出来以前就建好了数据文件夹,鲸鱼一浮上来就游走,第 1 站像没有过 |- | 本文第 5、6、7 节:45 秒「比平时慢,请再等一会儿。」;「会放在 `D:\DeepSeek Bot`」〔继续〕〔重新选〕;「…同步会打断正在写入的聊天记录。」;鲸鱼的话「团队界面没有加载出来。」 | 「比平时慢,请再等一会儿」;「会放在 `D:\DeepSeek Bot`。」〔继续〕〔重新选…〕(被拒绝的卡上的〔重新选…〕一样);「…正在写入的对话。」;「团队界面没有加载出来」。按 [启动页文案](2026-10-29-start-copy.md) 每一层的写法规则 |++| 本文第 5、6、7 节:45 秒「比平时慢,请再等一会儿。」;「会放在 `D:\DS Bot`」〔继续〕〔重新选〕;「…同步会打断正在写入的聊天记录。」;鲸鱼的话「团队界面没有加载出来。」 | 「比平时慢,请再等一会儿」;「会放在 `D:\DS Bot`。」〔继续〕〔重新选…〕(被拒绝的卡上的〔重新选…〕一样);「…正在写入的对话。」;「团队界面没有加载出来」。按 [启动页文案](2026-10-29-start-copy.md) 每一层的写法规则 |++## 变更++- 2026-10-26:定下启动窗口的样子和动作。依据:三套独立方案和两轮评审的合成、Electron 44 上的探针(Mica、系统按钮颜色、隐藏窗口的渲染)、可以打开看的原型。+- 2026-10-26:位置卡片按上手流程第 3、4 节的简化改写:一张推荐盘的卡代替「找到以前的数据」「盘不够」「位置不能用」「总工作区在 OneDrive」四张,确认只在应用改了路径时出现;重装不出卡;导入卡一句话两个按钮,详情折叠;复制中三步,工作文件不经过启动窗口。评审后补正:默认位置不能用的卡没有〔仍然放在 C 盘〕;每张卡写明主按钮;跳两下的卡片加上「找不到数据文件夹」。- - 2026-10-27:导入卡加一行小字写明复制后多占多少、原件不动;换位置的页面改叫「正在搬 DeepSeek Bot 的数据…」(上手流程 §8 的〔移到…〕改成真正的搬)。评审后补正:导入卡开着时引擎起来只打勾、不加载页面(§1、§4 第 8 拍);占用卡和下载卡有〔先不复制〕;被拒绝的卡留着来时的按钮和脚注;空间例子改成 1.7 / 1.5 / 0.2 GB。++- 2026-10-27:导入卡加一行小字写明复制后多占多少、原件不动;换位置的页面改叫「正在搬 DS Bot 的数据…」(上手流程 §8 的〔移到…〕改成真正的搬)。评审后补正:导入卡开着时引擎起来只打勾、不加载页面(§1、§4 第 8 拍);占用卡和下载卡有〔先不复制〕;被拒绝的卡留着来时的按钮和脚注;空间例子改成 1.7 / 1.5 / 0.2 GB。+- 2026-10-27:第 1 节加登录窗口(上手流程第 5 节):主窗口的子窗口,只在交接之后、用户点了某个登录入口时出现,启动窗口阶段没有它。+- 2026-10-28:按维护者 2026-10-27 的反馈改写:小窗口显示的是实现的结构(一条带三个点和阶段名的线、几段说明),不是用户感受到的东西,最后一步跳进团队窗口也太突然。三部分一起定:(1)「鲸鱼即进度」的启动窗口:鲸鱼停在哪一站就是进度,离开的站留下一个圈,窗口里的字都是鲸鱼一次一句的短话,卡片的第一行也是它说的;去掉标题行、三站的标记和阶段名、说明和写位置的小字,180 秒的卡只留按钮,重装只写一句提示,复制中的标题改成「正在搬过来」;鲸鱼更有反应(探身、呼吸、眨眼、回到窗口时看你、眼睛跟着键盘焦点、按下预备、活泼档越跳越稀、潜得更深),呼吸和眨眼只在卡片等用户时有;交接时启动窗口长成主窗口的矩形,主窗口在同一个矩形上露面(就绪后约 1.6 秒,兜底 2.5 秒),鲸鱼在侧栏的磁贴上浮上来。(2)交接后的目标卡改成多选加〔确定〕。(3)AI-native 的后半段:开场白不调模型,目标卡、建议卡和第一件事由插件画,上手期间最多 3 次模型请求,模型关着也走得通。后两部分写在上手流程第 5、6 节,本文只写到交接为止。依据:原型和它的检查(82 个状态、22 个场景、交接和团队窗口的联合检查)、Electron 44 上长大窗口的探针。评审后补正:磁贴上的鲸鱼怎么浮上来写进第 8 节(数值照原型,由主进程经 `dsBotApp` 的露面事件开始,待定),不再指向上手流程第 5 节;问候里的名字跟着团队(重装用团队里的名字,导入和读不出时「嗨,我来了」);入场时就来的卡等问候读满 1.5 秒;300 ms 的最短停留和「卡片在时这一行空着」写明失败和 180 秒的例外;以后的启动重试或重新开始后第一次成功不说「进去吧」,压扁回弹 920 ms 后潜下去,兜底和首次启动一样 2.5 秒;启动窗口在主窗口露面时才离开任务栏;减少动态效果时「^ ^」眼再停 300 ms;卡片在时已用秒数隐藏;45 KB 的预算写进第 11 节,建议和上手流程一致;「淡圈」统一叫「圈」,和上手流程的用词一样;空 Mica 帧的退路、「不做什么」里的推迟和「不要用户做什么」按新的交接和会说话的鲸鱼改写;首稿里「等用户回答时静止」等规则记进「改动的已定设计」;文件头的「一起改」补全。- - 2026-10-28 位置行:落地第一批(启动窗口、交接、失败页、日志)时维护者看到首次启动仍弹「欢迎使用 DeepSeek Bot」的系统对话框,要求「给出建议,同时提供自行选择的接口,避免小弹窗」。首次启动不再弹这个对话框,底注右边一行「数据放在 C 盘(剩 412 GB)· 换个位置…」(第 2、4 节),点了才开系统选择框,定根、「会放在…」和「这里放不了」按第 6 节,被拒绝的原因加上 DSH 的家和程序文件夹两句,定好后按第 7 节沉下去重新开始,默认位置上这一次建的文件夹删掉;导入复制完以后收起。依据:桌面应用里的实现和它的检查(`place.test.mjs`、`start-window.test.mjs`、未打包的应用上的实测)。++- 2026-10-28 位置行:落地第一批(启动窗口、交接、失败页、日志)时维护者看到首次启动仍弹「欢迎使用 DS Bot」的系统对话框,要求「给出建议,同时提供自行选择的接口,避免小弹窗」。首次启动不再弹这个对话框,底注右边一行「数据放在 C 盘(剩 412 GB)· 换个位置…」(第 2、4 节),点了才开系统选择框,定根、「会放在…」和「这里放不了」按第 6 节,被拒绝的原因加上 DSH 的家和程序文件夹两句,定好后按第 7 节沉下去重新开始,默认位置上这一次建的文件夹删掉;导入复制完以后收起。依据:桌面应用里的实现和它的检查(`place.test.mjs`、`start-window.test.mjs`、未打包的应用上的实测)。+- 2026-10-28 张望:第 3 节第二张表加第 9 条,第 2 站工作时每 5 到 9 秒随机向一边看 600 ms,安静档和减少动态效果没有;维护者问「小鱼的摇晃改为摇晃-张望随机是否可行」,可行,叠在上下晃上。依据:原型 `alive.cjs` 的 wander 用例(正常档 30 秒内三次、间隔 7.8 到 8.5 秒,安静档和指针在页面上时零次)。+- 2026-10-29 先打招呼再出发:第 4 节第 2 拍,数据阶段已完成时鲸鱼也等问候读满才离开第 1 站,等的时候晃着。维护者试用落地的启动窗口时「小鲸鱼看到的时候就在第二个位置」:那次首次启动里主进程 2.9 秒就建好了数据文件夹,页面 8.6 秒才画出来(冷启动;之后两次启动 2 秒),鲸鱼浮上来 560 ms 就游到了第 2 站。依据:原型 `alive.cjs` 的 greet 用例(数据阶段在入场结束前完成时,鲸鱼入场后 1.66 秒离开第 1 站、再 0.6 秒说「热身中,等我一下」;搜索到一半完成的也一样,且不说「先找个地方放东西」)、试用副本上的实测(窗口 1.1 秒出现、数据 1.9 秒完成、页面 2.1 秒画出来;鲸鱼入场后 1.68 秒离开第 1 站;`main.mjs` 标记数据完成后紧接着就启动引擎,日志里「engine took」从那一刻起算,和问候无关)。+- 2026-10-29 文案分层:启动页的字按页面位置分层、一张表,见 [启动页文案](2026-10-29-start-copy.md);第 11 节 `text.mjs` 一条改成指向它;按各层规则改四处:45 秒的提示和「团队界面没有加载出来」去句号,「会放在 …」加句号、〔重新选〕加 …,OneDrive 的原因里「聊天记录」改成「对话」(第 5、6、7 节)。++## 待定++| 问题 | 选项 | 建议 |+|---|---|---|+| 启动页放在哪里? | 单独的启动窗口(本文);主窗口里叠一层透明的 `WebContentsView`,团队界面在下面加载,就绪后淡出;按原来的设计在同一个窗口里 `loadURL` | 单独的启动窗口:真正的小窗,一直有 Mica,交接没有空白帧,「打开团队」也是真的。覆盖层是第二选择:同样没有空白帧,但启动时就是大窗口,还要管两套焦点;Electron 44 上实测,看不见的 `WebContentsView` 不渲染,覆盖层只能不透明,启动时就没有 Mica。原来的做法会露出 DSH 自己的加载,游到第 3 站、庆祝和长大都只能不做 |+| 鲸鱼的尾巴能单独动吗? | 启动页把生成器的输出按尾柄(`27.9, 61.1`)裁成两层,不加新形状;生成器加一个尾巴单独成层的选项;尾巴不动 | 先用裁切,只在启动窗口里用。以后插件也要用时,再给生成器加选项。去掉也只少了尾巴,其余不变 |+| 1 px 的水线要不要留? | 留:1 px `--bt-line`,首尾渐隐,上面什么都不画;去掉,只留鲸鱼和它留下的圈 | 留:圈和三站要有一个面可以落,鲸鱼被裁掉的那条边也在这里 |+| 启动页超过 45 KB 的预算(第 11 节)怎么办?(原型实测:五个文件的源码 113 KB,压缩后 79 KB,gzip 约 35 KB;`text.mjs` 带中英两种语言) | 放宽预算;`text.mjs` 按语言拆开,只加载界面语言的那一份;打包时压缩 | 先按语言拆 `text.mjs`、打包时压缩,在 M4 实测启动页的第一帧;第一帧不晚就放宽预算:页面是本地文件,不走网络(同 [上手流程](2026-10-26-windows-onboarding.md) 的「待定」) |+| 启动窗口的问候用哪个名字?(第 3 节) | 按第 3 节:新团队用界面语言的默认名字,重装用团队里 Main Bot 的名字,要导入或读不出时不带名字;一律不带名字(「嗨,我来了」);一律用默认名字 | 按第 3 节。中文的默认名字和 [上手流程](2026-10-26-windows-onboarding.md)「待定」里「中文界面里第一个 Main Bot 叫什么?」一起定;一律用默认名字时,重装和导入的人在启动窗口里听到一个名字,进门后看到另一个 |+| 磁贴上的鲸鱼怎么知道该浮上来?「预览版说明」盖着侧栏时怎么办?(第 8 节) | 主进程显示主窗口时经 `dsBotApp` 发一个露面事件,带上这是不是首次启动([上手流程](2026-10-26-windows-onboarding.md) 第 3 节的 `dsBotApp` 列表要加一项);页面自己等 `visibilitychange` 第一次变成 `visible`(不加接口,但分不出是哪种启动;Electron 默认照常渲染隐藏的新窗口,这时页面第一次加载的 `document.visibilityState` 可能不对)。说明挂着时:照样在它下面浮上来;等它关掉再浮;不浮,鲸鱼从第一帧起就在 | `dsBotApp` 的露面事件:时刻和启动的种类都准。说明挂着时先照样浮,M4 看它在说明下面看不看得见;看不见就不浮:DSH 的说明关掉时没有事件,插件等不到「继续」 |++## 不做什么++- 不画百分比进度条:引擎不报百分比。复制和下载的进度条用真实的字节数。+- 不编造阶段,不为动画推迟引擎和团队界面的加载;交接为了长大多等约 460 ms(首次启动另有「进去吧」的 300 ms),见第 8 节。「进去吧」只在首次启动时有;庆祝只在首次启动和重试、重新开始后第一次成功时有。主窗口在 `ready()` 后约 1.6 秒露面(长大要等页面空了才开始),以后的启动约 0.6 秒,以后的启动庆祝的那次约 1.5 秒。+- 不放轮播的提示和笑话。鲸鱼只说一句和它的状态有关的短话(第 3 节),不冒气泡,不讲笑话,不挡卡片和按钮;鲸鱼的话里只有 180 秒那一句是问题,回答在卡片的按钮上,别的话都不要用户做什么(提示行只提前说接下来会遇到什么)。失败时不哭不闹,失败页上不说俏皮话。+- 鲸鱼没有「?」徽标(UI 标准 8.2:大头像不显示徽标),不侧身跃出水面,不喷水;等待时不乱游,不对每次按键都有反应,没有声音。+- 鲸鱼不从启动窗口飞进主窗口:它在小窗口里潜下去,首次启动时在侧栏的磁贴上浮上来(第 8 节)。+- 不画 DSH 的鲸鱼标志,不用其他产品的动画、插图、声音和字体。+- 不往引擎的页面里注入 CSS 或 DOM 来接画面,不改 DSH。+- 不用 Rive、Lottie 和网络字体:CSP `default-src 'self'` 不允许 WASM,也不另加运行时。+- 标题带里不放能点、能抚摸的东西。++## 已知限制++- 主窗口在隐藏时启动 DSH 和 ds-bot。`dsBotApp.ready()`、#559 的重新挂载检查和系统按钮颜色的测量,都在看不见的窗口里跑,要在 M4 验证。+- 从没显示过的 Mica 窗口第一次 `show()` 时,可能先露出一两帧空的 Mica。交接时启动窗口已经长成同样大小的空 Mica,主窗口在它上面露面,这一两帧和下面的一样。M4 用 60 帧录像确认主窗口第一帧之前没有白帧或黑帧;有的话,改成主窗口先在长大后的启动窗口下面露面,画出第一帧再放到上面、销毁启动窗口。+- `#00000000` 的系统按钮颜色,只在一台 Windows 11(26200,深色,窗口不在前台)上验证过是透明的。前台、浅色、悬停和按下都没验证。按钮画成不透明的系统,改用不透明的 `--bt-main` 窗口。+- 未打包、机器忙时实测:进程启动后 1.35–1.57 秒窗口才建好,页面第一次画出来还要再等 0.9–1.0 秒。启动页的第一帧和空窗口一模一样,这段看不出来,但入场会晚。+- SVG 里的尾巴和眼睛、内容的模糊淡入和流光不走合成线程。杀毒软件在扫描、引擎又在启动时,可能卡顿;那时先去掉尾巴。+- 动画档和浅深色要等团队界面报告一次才记得住。在应用外改过主题时,下次启动先用旧的。+- 第 2 站结束是从引擎的 HTTP 起来推断的:DSH 不报命名的阶段(「需要 DSH 提供的」第 11 条)。+- 工作区不到 588 高的显示器上,窗口只有 500 高,长卡片要在纸面里滚动。+- 启动时多一个渲染进程(约 40–60 MB),交接后销毁。+- 从开始长大到启动窗口销毁的约 600 ms 里两个窗口同时存在,主窗口露面后的 300 ms 里两个都看得见。启动窗口在主窗口露面时才离开任务栏,任务栏按钮不会消失再出现;但那 300 ms 里 Alt+Tab 可能短暂看到两个。+- 鲸鱼的话每句都要停够才换,阶段很快时会落在鲸鱼后面:比如换了新文件夹以后,鲸鱼已经到了第 2 站,「先找个地方放东西」还在淡入,「找到了」接着在第 2 站说。它从不说还没发生的事,只是不完全同步。+- 一般的首次启动里,数据阶段在「嗨,我是总管」读完以前就结束了,「先找个地方放东西」和「找到了」很少出现:用户读到的是「嗨,我是总管」「热身中,等我一下」「开门去了」「进去吧」。+- 首次启动时主窗口在就绪后约 1.6 秒才露面,以后的启动约 0.6 秒(庆祝的那次约 1.5 秒):长大要等页面空了才开始,主窗口长到位才显示。+- 长大靠逐步 `setBounds`:页面每一步都重新排版,但只重画其中一部分,所以长大时纸面必须是空的;机器忙时长大不平滑。+- 圈(不透明度 .5)和已用秒数在真的 Mica 上看不看得清,还没验证:原型的截图用的是不透明的 `--bt-main` 背景。+- 启动页的五个文件超过 45 KB 的预算(第 11 节,见「待定」)。+- 入场时就来的卡(导入、推荐盘)出来后,问候还要再留约 1 秒,和卡片的第一行同时在:这样问候不会只闪 240 ms 就被换掉(第 6 节)。diff --cc docs/plans/2026-10-26-windows-onboarding.mdindex 10cfd8e1,00000000..4a44ecf5mode 100644,000000..100644--- a/docs/plans/2026-10-26-windows-onboarding.md+++ b/docs/plans/2026-10-26-windows-onboarding.md@@@ -1,497 -1,0 +1,497 @@@+# Windows 上手流程:从下载到第一条有用的回复++- 日期:2026-10-26+- 相关:#523、#559、#384、#500、#551(PR #567)、#529、#561、#515、#423、#499、#428、#265;Discussions #530、#150+- 一起改:[桌面应用](2026-10-16-desktop-app.md)(结构、窗口、模型、首次启动和导入、改位置、安装和更新、暂时不做、已知限制)、[Bot 运行配置](2026-10-10-bot-runtime.md)(新 Bot 的模型来源、第一个 Main Bot 的开场白和那条已知限制)、[DSH 让步总账](2026-10-13-dsh-concessions.md)(预览版说明关不掉、设置卡借用 `settings.models.sign-in` 的操作、借 `settings.onboarding` 步骤打开「模型」)、[UI 标准](../design/ui-standard.md) 第 11 节(术语「提供商」);启动页的样子、鲸鱼的话和卡片的动作在 [启动窗口](2026-10-26-start-window.md),交接时启动窗口长成主窗口、鲸鱼在侧栏 Main Bot 的磁贴上浮上来在它的第 8 节,它和本文第 5、6 节一起改+- 代码:`app/src/main.mjs`、`first-run.mjs`、`import.mjs`、`updates.mjs`、`preload.cjs`、`host.mjs`、`host-process.mjs`、`downloads.mjs`、`move-data.mjs`、新的 `app/src/start/`;`app/electron-builder.yml`、`app/build/installer.nsh`;`ds-bot/index.js`;`ds-bot/src/client/model-menu.js`、`team-actions.js`、`sidebar.js`、`settings.js`、`diagnostics.js`、`i18n.js`、`ds-bot/src/client/index.js`;`ds-bot/src/host/models.js`、`roster.js`、`turns.js`、`providers.js`、`channel.js`、`parts.js`、`tools.js`;`.github/workflows/release.yml`、`.github/ISSUE_TEMPLATE/`;`README.md`、`README.zh.md`++## 为什么++### 谁在用++Windows 是桌面应用的主要平台:0.2.0 到 0.2.2 三个版本的安装包下载里,Windows 约 3850 次,macOS 约 1900 次,Linux 约 250 次(GitHub 下载计数,含自动更新)。这些 Windows 用户几乎不提 Issue:259 个 Issue 里能确认来自 Windows 桌面应用的只有 3 个左右。另一边,有 10 位不同的用户报告过「第一条消息就失败 / 没有回复」。大多数人是在半路悄悄放弃的。++典型用户:中文界面,可能不是开发者,可能在中国大陆(GitHub 慢或打不开),可能还没有 DeepSeek 账号或 API Key,可能从没用过 DeepSeek Harness(DSH)。++### 今天的路有多长++2026-10-26 在 `dev` 上用全新用户的身份实测:一次性的家目录、数据位置和壳数据,环境里没有任何 key,界面中文。实测用的是未打包的 Electron 和 `DS_BOT_HOME`,所以下表的下载、安装、首次启动对话框、导入、启动失败和卸载几行来自代码、CI 和用户报告,其余几行是实测。++| 步骤 | 用户看到的 | 问题 |+|---|---|---|+| 下载 | README 先是英文;Releases 页是英文更新日志加 11 个文件,按字母排,`.exe` 排第五,紧挨着 `.exe.blockmap` | 不知道下哪个;约 212 MB 只能从 GitHub 下,没有国内镜像 |+| 打开安装包 | 浏览器提示「不常下载」;「Windows 已保护你的电脑」,发布者「未知发布者」 | 没签名。开着「智能应用控制」的 Windows 11 直接拦下,没有「仍要运行」 |+| 安装 | NSIS 向导:选目录(点「安装」)→ 进度 → 完成(点「完成」) | 多两次点击,NSIS 默认图 |- | 首次启动 | 还没有窗口,先弹系统对话框「欢迎使用 DeepSeek Bot」,里面只有两个路径(`数据:C:\Users\<用户名>\.ds-bot`、`总工作区:C:\Users\<用户名>\DeepSeek Bot`) | 不说这是什么、下一步做什么。「更改位置…」连开两个从家目录起步的选择框,直接点两次「选择文件夹」,两个位置都是家目录,会被「数据文件夹不能放在总工作区里面。」拒绝,提示框只有一个英文「OK」。对话框没有父窗口,被挡住时再双击图标也没反应 |- | 已有 DSH 团队时 | 「要复制到 DeepSeek Bot 吗?」→ 可能「正在使用这个团队」反复重试(PID 被系统重用的旧锁)→ 可能「更新版本写的对话」,默认按钮是「退出」,而更新器这时还没启动 → 可能「用哪一份模型设置?」,`DSH Desktop`、`DSH Web` 以外的 profile 直接显示 `headless` 之类的原始名字,也看不出每份里有什么 | 只问一次,跳过、失败或「不带团队开始」后再也找不回来。复制在「正在启动 DeepSeek Bot…」后面进行,只有任务栏图标上不确定的进度 |- | 等待 | 一页白底黑字「正在启动 DeepSeek Bot…」,实测冷启动 21 秒(第二次 13 秒;CI 上约 2.5 秒) | 没有品牌、进度和解释;窗口拖不动。启动失败时还要再等 GitHub 最多 15 秒,然后弹出标题为英文「Error」的框,里面是 8 KB 英文 stderr,没有日志文件 |++| 首次启动 | 还没有窗口,先弹系统对话框「欢迎使用 DS Bot」,里面只有两个路径(`数据:C:\Users\<用户名>\.ds-bot`、`总工作区:C:\Users\<用户名>\DS Bot`) | 不说这是什么、下一步做什么。「更改位置…」连开两个从家目录起步的选择框,直接点两次「选择文件夹」,两个位置都是家目录,会被「数据文件夹不能放在总工作区里面。」拒绝,提示框只有一个英文「OK」。对话框没有父窗口,被挡住时再双击图标也没反应 |++| 已有 DSH 团队时 | 「要复制到 DS Bot 吗?」→ 可能「正在使用这个团队」反复重试(PID 被系统重用的旧锁)→ 可能「更新版本写的对话」,默认按钮是「退出」,而更新器这时还没启动 → 可能「用哪一份模型设置?」,`DSH Desktop`、`DSH Web` 以外的 profile 直接显示 `headless` 之类的原始名字,也看不出每份里有什么 | 只问一次,跳过、失败或「不带团队开始」后再也找不回来。复制在「正在启动 DS Bot…」后面进行,只有任务栏图标上不确定的进度 |++| 等待 | 一页白底黑字「正在启动 DS Bot…」,实测冷启动 21 秒(第二次 13 秒;CI 上约 2.5 秒) | 没有品牌、进度和解释;窗口拖不动。启动失败时还要再等 GitHub 最多 15 秒,然后弹出标题为英文「Error」的框,里面是 8 KB 英文 stderr,没有日志文件 |+| 进入窗口 | DSH 的「预览版说明」(讲 DeepSeek Harness 0.2、开发者、插件 API)→ DSH 的「开始使用」(登录 / 添加 API Key)→ DSH 的「添加一个 API Key 开始使用」;下面 Chief 的卡片又问一遍「我还没有可用的模型。你想怎么配置?」 | 四个面,两个重复。没有一个告诉用户 key 去哪里拿、要先充值、填的 key 对不对 |+| 先打字 | 红字「本轮运行失败」加英文原文 `llm-deepseek: no API key for provider route "deepseek-official"; … export DEEPSEEK_API_KEY in the launching environment`,代码 `MISSING_CREDENTIAL` | 中文界面里的开发者报错,没有按钮;这条消息还会删掉 Chief 留着的开场白 |+| 填了 key 之后 | Chief 再问一次「先给我选一个模型吧」,选完才打招呼 | key 从不校验:填错或余额为零,要到第一轮才报「API 密钥无效」或「额度已用尽」,只有文字,没有按钮 |+| 第一个小时 | 默认沙盒下 Bot 跑的每条命令都可能返回 `exit code 3221225794`(#523);Host 不读 Windows 系统代理,Clash、v2rayN 只开系统代理时请求不走代理(#529 的「连不上 GitHub」很可能是这个原因,推断);冷启动可能一个 Bot 都不显示(#559);导入后第一条消息可能 84 秒没有任何显示(#384) | 都没有说明和下一步 |+| 卸载 | 什么都不问,key、登录、对话全部留下;重装后跳过首次启动 | 想「重来一次」的人做不到 |+- 另外,「下载」文件夹解析不到时(被删掉,或者重定向到一个当前不可用的位置),`app.getPath('downloads')`(`main.mjs` 建窗口时调用)会抛错:窗口一直不显示,等最多 15 秒后弹出「DeepSeek Bot 没能启动」和 Electron 的英文报错,然后退出。已在 Electron 44 上复现这个抛错。++另外,「下载」文件夹解析不到时(被删掉,或者重定向到一个当前不可用的位置),`app.getPath('downloads')`(`main.mjs` 建窗口时调用)会抛错:窗口一直不显示,等最多 15 秒后弹出「DS Bot 没能启动」和 Electron 的英文报错,然后退出。已在 Electron 44 上复现这个抛错。++手里已经有 key、也没有 DSH 团队时,最快也要:两次 SmartScreen 点击,安装向导点两次,一个系统对话框,等 13 到 21 秒,再点「继续 → 添加 API Key → 粘贴 → 保存并继续 → 选模型」,一共 10 步,第一条回复才出来;有 DSH 团队时最多 13 步。没有 key 时还得自己离开应用去弄一个。++### 根因++1. **首次启动按实现来提问。** 数据位置、总工作区、DSH 的 profile 都是实现概念,却在还没有窗口的系统对话框里先问用户。+2. **接模型有三个入口,彼此重复,又都不完整。** DSH 网页版自己的两步引导,加上 Chief 的卡片。哪个都不说怎么拿 key、要付费、key 能不能用。+3. **失败不给下一步。** 凭据错误显示原文,启动失败弹英文框,导入遇到新版对话是死路,导入只给一次机会。+4. **分发只靠 GitHub,而且没签名。** 下载和自动更新都走 GitHub,SmartScreen 和智能应用控制把人挡在门外,发布页不告诉人下哪个文件。+5. **第一个小时的坑没人接。** Windows 特有的沙盒启动失败、系统代理、「下载」文件夹,以及各平台都有的冷启动不显示 Bot(#559,报在 Windows 上)和导入后漫长的换段(#384)。++### 取舍++- **每个阶段只有一个引导面,显示什么由状态决定,不存「已完成」标记。** 引擎起来之前,引导面是应用自己画的启动页;引擎起来以后,是 Main Bot 聊天里的设置卡。跳过的步骤哪里都不记,条件还在,它下次就自己回来。第 6 节的上手也不另存标记:Main Bot 的会话里有那行「上手结束」的灰字、或者有用户自己发的消息,就算结束;「跳过设置,直接开始」写下的那行灰字是它唯一的记录(第 8 节)。+- **模型在聊天卡里接,不在应用里另做欢迎向导。** 设置卡是插件的代码,DSH Desktop 和 DSH Web 里的用户也一起受益;应用里再做一套向导,就要维护两套。启动页只负责让人看见它在动、知道下一步是什么:鲸鱼游到哪一站就是到了哪一步,一次只说一句话,好让等待不是空等。+- **模型从「已接上」之后才开始帮忙。** 顺序倒不过来:Key 由引擎写进它自己的 `DSH_HOME`,DeepSeek 登录的回调也由引擎的 Host 处理,所以引擎必须先在某个数据位置上跑起来;`importTeam` 遇到已有 Bot 的位置直接拒绝,复制时还整个换掉 `bot/` 并重启引擎,先填的 Key 也会压过导入来的 Key 和登录。所以位置、导入、接模型三步保持卡片。模型只在两处比卡片好:把用户的一句话变成有名字、有角色的 Bot,以及自由的第一件事;它也更慢、先花钱、措辞每次不一样,所以每一步都留一张不靠模型也能走通的卡,限制写成代码里的机制,不写成提示词(第 6 节)。+- **先补悄悄流失的地方。** 下载页、信任提示、一键安装最便宜,影响面最大。签名和国内镜像要等外部审批和账号,所以最先开始办。+- **不改 DSH。** 只用有文档的开关和插槽。DSH 的「预览版说明」没有文档开关,就向 DSH 提需求,期间在启动页上先提醒一句;不伪装 `dshDesktop`。++## 已定的行为++下面写的是新流程。界面文字的源语言照旧:插件是英文加 `i18n.js` 里的中文,应用主进程用自己的中英文表;这里只列中文。文案里的 `{名字}` 是 Main Bot 的名字。标了「待定」的几处,按文末「待定」里的建议写,拍板后改成定下的那一种。++### 1. 下载++- `README.md` 和 `README.zh.md` 开头都是同一块中英双语的下载区(GitHub 默认显示英文 README):Windows 10/11(64 位)、约 212 MB,「国内镜像下载(推荐)」和「GitHub」两个直接下载链接。镜像没验证通过之前只放 GitHub 链接,不放死链。+- 下载区紧接着写清:双击就会安装,装好自动打开;不用管理员权限,不用另装 Node 或 DSH;需要一个 DeepSeek 账号(可以当场用手机号注册)或 DeepSeek API Key;DeepSeek 按用量收费,一轮对话大约多少钱(实测默认模型上三次第一件事的回合得出,附 DeepSeek 价格页链接);DS Bot 是社区开源项目,不是 DeepSeek 官方产品。+- 签名之前,下载区带一段信任说明(文字加自己画的示意图,不贴 Windows 或其他产品的截图):+ - Edge 提示「不常下载」:「···」→「保留」→「显示更多」→「仍然保留」。+ - 「Windows 已保护你的电脑」:「更多信息」→「仍要运行」。+ - 「智能应用控制已阻止…」且没有「仍要运行」:未签名的安装包没有安全的绕过办法,请改用 DSH Desktop 加 DS Bot 插件。不要关掉智能应用控制。+ - 杀毒软件拦截:先用 `certutil -hashfile <文件> SHA256` 和 `SHA256SUMS.txt` 核对,再选「信任」。- - 安装时提示卸载旧版失败:先关掉 DeepSeek Bot;杀毒软件拦了安装包时,按上面的方法核对后选「信任」,再运行一次安装包。++ - 安装时提示卸载旧版失败:先关掉 DS Bot;杀毒软件拦了安装包时,按上面的方法核对后选「信任」,再运行一次安装包。+- 每个 Release 的说明开头是 CI 生成的「下载 / Download」表:Windows 排第一(国内镜像、GitHub、大小、「双击安装」),然后是 macOS(Apple 芯片 / Intel)和 Linux(AppImage / deb);表下注明 `.blockmap`、`latest*.yml`、`ds-bot-*.tgz` 和源代码是给自动更新和插件用的,不用下载。之后才是更新日志。- - Release 附上不带版本号的文件(如 `DeepSeek-Bot-win-x64.exe`)和 `SHA256SUMS.txt`。标为 Latest 的 Release 带上这些文件之前,`releases/latest/download/` 的固定链接会 404,所以 README 先链到 `releases/latest` 页面;固定链接(不经过文件列表)和 M3 的固定链接检查一起上。README 里插件安装那一行也不写具体版本号(今天两份 README 都还写着 `ds-bot-0.2.1.tgz`)。++- Release 附上不带版本号的文件(如 `DS-Bot-win-x64.exe`)和 `SHA256SUMS.txt`。标为 Latest 的 Release 带上这些文件之前,`releases/latest/download/` 的固定链接会 404,所以 README 先链到 `releases/latest` 页面;固定链接(不经过文件列表)和 M3 的固定链接检查一起上。README 里插件安装那一行也不写具体版本号(今天两份 README 都还写着 `ds-bot-0.2.1.tgz`)。+- 发版顺序是「打包(→ 签名)→ 上传到 GitHub 和镜像 → 写下载表 → npm 发布 → 最后才标为 Latest」,不会再出现 Release 已经是 Latest、安装包几分钟后才到的情况。今天的工作流由 `release: published` 触发,没有公开的 Release 就没有标签,而工作流要靠标签检出代码、并检查它在 `main` 上;npm 的 Trusted Publishing 也绑定在 `release.yml` 上。所以起点是维护者发布时不勾「设为最新」,最后一步由工作流 `gh release edit --latest`;npm 发布留在 `release.yml`。+- 新增「安装问题」Issue 表单:不要求诊断信息(应用都没跑起来),只问系统版本和显示语言(主要是 Windows,macOS 和 Linux 的安装问题也用这张表)、卡在哪一步、对话框的文字或手机拍的照片。++### 2. 安装(一键安装待定)+- - 双击后只有一个小窗口「正在安装 DeepSeek Bot,请稍候…」和进度条,约 30 秒,没有页面要点。只装给当前用户,装到 `%LOCALAPPDATA%\Programs\DeepSeek Bot`,不要管理员权限。建桌面和开始菜单快捷方式「DeepSeek Bot」,装完自动打开应用。++- 双击后只有一个小窗口「正在安装 DS Bot,请稍候…」和进度条,约 30 秒,没有页面要点。只装给当前用户,装到 `%LOCALAPPDATA%\Programs\DS Bot`,不要管理员权限。建桌面和开始菜单快捷方式「DS Bot」,装完自动打开应用。+- 要换程序位置的用户用 `/D=`(README.md 和 README.zh.md 的进阶说明);数据和总工作区本来就可以放到别的盘。+- 安装语言 `[en_US, zh_CN]`:中文 Windows 用中文,其他语言用英文(今天其他语言会落到简体中文)。+- 在旧版向导装到自定义目录的基础上一键升级,保留原目录(CI 验证)。+- 签名后(路线待定),发布者显示签名主体;设置 `publisherName`,让 `electron-updater` 校验以后更新包的签名。+- electron-builder 自带的几条 NSIS 报错(卸载旧版失败、解压失败)没有中文,照样显示英文。不在 `installer.nsh` 里重新定义它们:electron-builder 默认把 NSIS 警告当错误,重复定义会让构建失败。中文翻译提给 electron-builder。++### 3. 首次启动:启动页++- 窗口先出来。进程启动约 1 秒内,启动窗口就显示应用自己的本地页(`app/src/start/`):和现在一样无边框,40 px 的标题带可以拖动,系统按钮在右上角,Windows 11 上用 Mica。启动页在单独的启动窗口里,引擎的页面在隐藏的主窗口里加载([启动窗口](2026-10-26-start-window.md) 第 1 节,待定)。整个启动期间,卡片和失败页也算,启动窗口都是 720 × 540(工作区矮时 720 × 500);它只在交接时改一次大小:长成主窗口的矩形,主窗口在同一个矩形上露面(同上第 8 节)。+- **鲸鱼就是进度。** 首次启动没有标题、三站的标记和说明:Main Bot 的鲸鱼(88 px)在水线上从第 1 站游到第 3 站,它停在哪里就是到了哪一步;它离开第 1、2 站时各在原处留下一个细线的圈,第 3 站没有。三个真实阶段照旧是「准备数据文件夹」→「启动本机引擎」→「打开团队」,但只给读屏:一个看不见的列表「启动进度」(`aria-current="step"`),朗读区照旧说「{阶段}:进行中」「{阶段}:已完成」。5 秒起右上方显示「已用 N 秒」,一直留到「进去吧」。布局、圈和鲸鱼的动作在 [启动窗口](2026-10-26-start-window.md) 第 2、3 节。+- **文字都是鲸鱼在说,一次一句短话。** 鲸鱼的话在水线下居中,只占一行,不折行;下面的提示行只说接下来要准备什么(接模型、预览版说明、重装接着用),最多约 22 个字,有卡片时隐藏。首次启动的话和提示:++| 时候 | 鲸鱼的话 | 提示行 |+|---|---|---|+| 入场,还没有新消息 | 「嗨,我是{名字}」,停 1.5 秒:新团队用界面语言的默认名字(中文「总管」),重装用团队里 Main Bot 的名字,要导入或读不出名字时不带名字「嗨,我来了」([启动窗口](2026-10-26-start-window.md) 第 3 节,待定) | 无 |+| 第 1 站:只在数据文件夹这一步比招呼久、出过卡片或换了新文件夹时 | 「先找个地方放东西」 | 无 |+| 离开第 1 站:只在上一句真的说过时 | 「找到了」,停 0.7 秒 | 无 |+| 第 2 站 | 「热身中,等我一下」 | 新团队:「待会儿要接一个模型:DeepSeek 账号或 API Key」;重装:「上次的 6 个 Bot 和 2 个群聊都在」;要导入时没有 |+| 10 秒(第 1、2 站) | 「第一次会慢一点」 | 同上 |+| 45 秒(第 1、2 站) | 「有点久,可能是杀毒软件在查新文件」 | 只有〔打开日志文件夹〕 |+| 游向第 3 站和在第 3 站 | 「开门去了」 | DSH 会挂出「预览版说明」时(会话准备好、主视图里没有非空会话):「里面先有一页说明,点「继续」就行」;否则留着第 2 站的提示 |+| 就绪 | 「进去吧」,300 ms 后庆祝、潜下去 | 同上,到庆祝开始 |+| 盘不够、又没有更好的盘 | 照那一站说 | 前 10 秒「C 盘只剩 1.2 GB」 |+| 180 秒 | 「等太久了,要不要重试?」 | 无;卡片上只有〔继续等待〕〔重试〕〔打开日志文件夹〕 |- | 启动失败、团队界面没加载出来 | 「DeepSeek Bot 没能启动」「团队界面没有加载出来」 | 无 |++| 启动失败、团队界面没加载出来 | 「DS Bot 没能启动」「团队界面没有加载出来」 | 无 |+| 有卡片时 | 空着,由卡片自己的第一句说(15/20、600,在已定的文字上面):推荐盘「C 盘有点挤」(盘不够)或「这里不让我放东西」(没有写入权限),「会放在…」那张「我多加了一层文件夹」,被拒绝的「这里放不了」,找不到数据文件夹「数据不在原来的地方了」;导入的几张见第 4 节;失败的卡没有 | 隐藏 |++- 话跟着鲸鱼走(停在哪一站、正在游哪一段、就绪),从不抢在它前面。每句至少能读 300 ms 才被换掉,一般停 0.9 秒(招呼 1.5 秒,「找到了」0.7 秒);中间跳过的话以后不补说。失败和 180 秒的问题马上说。「进去吧」等上一句能读满 400 ms 才上,上屏 300 ms 后开始庆祝。鲸鱼沉下去、换个新文件夹重新开始时,话和提示都空着。失败时不画叉,鲸鱼失败的姿势和那句话就是失败。一般的首次启动,用户读到的是「嗨,我是总管」→「热身中,等我一下」→「开门去了」→「进去吧」:数据文件夹这一步通常在招呼读完之前就做完了。+- **一般情况下什么都不问**,用默认位置,但页面上写着放在哪、能换:底注右边一行「数据放在 C 盘(剩 412 GB)· 换个位置…」([启动窗口](2026-10-26-start-window.md) 第 2、4、6 节),什么都不点就按它走;点「换个位置…」才开系统选择框,定根和下面「一个位置」一样,定好后引擎在新文件夹重新起、鲸鱼沉下去重新开始(启动窗口第 7 节),默认位置上这一次建的文件夹删掉。重装没有这一行,导入复制完以后收起。先看是不是重装(下一条),再看要不要出位置卡片。选位置的卡片只有推荐盘这一张,它上面的按钮都已经试写通过,不会点了再被拒绝;每张卡都说明以后在哪里改:+ - 数据所在的盘不到 5 GB(有团队要导入时,不到「5 GB + 导入卡上要多占的数」),而且有更好的盘:「C 盘只剩 1.2 GB。放到 D 盘(剩 412 GB)?」〔放到 D 盘〕〔仍然放在 C 盘〕,按钮行末尾一个小链接「其他位置…」。按 Enter 就是放到 D 盘。没有更好的盘就不出卡片,只在提示行写一句「C 盘只剩 1.2 GB」,照常启动。- - 默认位置不能用(没有写入权限):第一句换成原因「DeepSeek Bot 没有权限在 `C:\Users\<用户名>` 里写文件。」,第二句一样;按钮只有〔放到 D 盘〕和小链接「其他位置…」,没有〔仍然放在 C 盘〕。没有可推荐的盘时只有〔选择其他位置…〕。- - 保存过的数据文件夹找不到了(多见于以后的启动):「找不到数据文件夹 `D:\DeepSeek Bot\data`。可能是移动硬盘没插上,或者文件夹被移走、删除了。旧数据不会被改动。」〔重试〕〔重新找到它…〕〔用新的空白团队开始…〕。〔重新找到它…〕不走定根的规则:选中的文件夹本身或它下面的 `data` 里有 `.deepseek-bot` 标记和 `bot/state.json`(所以 `~/.dsh` 永远不算),又通过位置规则(不在 DSH 的家里、不在程序目录里),就把它写成数据文件夹;旁边有 `workspace` 时总工作区一起改过去,没有就不动。否则卡上写「这里没有 DeepSeek Bot 的数据。」,〔重新找到它…〕留着。++ - 默认位置不能用(没有写入权限):第一句换成原因「DS Bot 没有权限在 `C:\Users\<用户名>` 里写文件。」,第二句一样;按钮只有〔放到 D 盘〕和小链接「其他位置…」,没有〔仍然放在 C 盘〕。没有可推荐的盘时只有〔选择其他位置…〕。++ - 保存过的数据文件夹找不到了(多见于以后的启动):「找不到数据文件夹 `D:\DS Bot\data`。可能是移动硬盘没插上,或者文件夹被移走、删除了。旧数据不会被改动。」〔重试〕〔重新找到它…〕〔用新的空白团队开始…〕。〔重新找到它…〕不走定根的规则:选中的文件夹本身或它下面的 `data` 里有 `.deepseek-bot` 标记和 `bot/state.json`(所以 `~/.dsh` 永远不算),又通过位置规则(不在 DSH 的家里、不在程序目录里),就把它写成数据文件夹;旁边有 `workspace` 时总工作区一起改过去,没有就不动。否则卡上写「这里没有 DS Bot 的数据。」,〔重新找到它…〕留着。+- **重装不问。** 没有保存的位置、而 `C:\Users\<用户名>\.ds-bot` 里有团队时(重装过,或者 `%APPDATA%` 被清过),直接接着用:不出推荐盘的卡片,盘不够只在提示行写一句「C 盘只剩 1.2 GB」,要搬去 设置 → 通用 → 位置 →〔移到…〕;写不进去直接是恢复页。第 2 站的提示行写「上次的 6 个 Bot 和 2 个群聊都在」,不写路径,接模型的那句提示也不显示。旧团队登记的总工作区启动页不知道:插件启动后经 `teamWorkspaceChanged` 报告一次,应用据此写 `locations.json` 的 `workspace`。想要空白团队的人去 设置 → 通用 → 位置 →「用新的空白团队开始…」。只认默认位置:放在别处、又没有保存位置的旧数据找不到,和今天一样。- - **推荐的盘**怎么来:只在数据所在的盘不到门槛(5 GB,有团队要导入时加上要多占的数:对话 1.2 GB 加默认要复制的工作文件 3.4 GB,就是不到 9.6 GB)、或默认位置不能用时查一次(重装接着用时不查),正常启动不查。这一步在引擎预热之前,所以迁移用户先看到推荐盘的卡,再看到导入卡。用完整路径的 `%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive`(`windowsHide`,5 秒超时)读 `Win32_LogicalDisk` 和 `Get-Partition | Get-Disk`:只要固定盘(`DriveType` 3)、`FreeSpace` 不为空、总线不是 USB、SD、MMC 或虚拟盘的,再用 `fs.statfs` 确认一次。盘不够时排除数据现在所在的盘;默认位置不能用时可以推荐同一个盘上的 `X:\DeepSeek Bot`。取剩余空间最大、而且不少于 20 GB 的一个。`X:\DeepSeek Bot` 已经存在时按下面定根的规则判断,不能用就不推荐这个盘。试写只建缺的那几层,写完删掉自己建的。PowerShell 失败、超时或被策略禁掉,都当作没有更好的盘。macOS 和 Linux 不推荐盘,空间不够只在提示行写一句。- - **一个位置。** 用户换位置时只选一个文件夹,由它定出根 `R`:选的是磁盘根目录,`R` 是它下面的 `DeepSeek Bot`;选的文件夹不存在或是空的,`R` 就是它;选的文件夹是 DeepSeek Bot 以前的根(`data` 里有 `.deepseek-bot` 标记,没有团队或者只有一个没说过话的空白团队),`R` 也是它;其余非空的文件夹,`R` 是它下面的 `DeepSeek Bot`。`R` 已经存在、非空、又不是以前的根时,不能用。数据放在 `R\data`,Bot 的文件放在 `R\workspace`(子文件夹的名字待定);两者是兄弟,互不包含,和默认的 `~\.ds-bot`、`~\DeepSeek Bot` 一样是同一个父文件夹下的兄弟,所有规则不变。〔放到 D 盘〕就是 `D:\DeepSeek Bot\data` 加 `D:\DeepSeek Bot\workspace`。默认安装的路径不改(待定)。设置里也是一处:「位置」一行显示两个路径,一个〔移到…〕一起搬(第 8 节);要分开放的在「高级」里。- - 只有点了「其他位置…」才打开系统选择框,挂在窗口上,从推荐的盘开始,没有推荐的盘就从现在的数据文件夹的上一级开始。选完先定根,`R\data` 和 `R\workspace` 都对照现在的数据文件夹和总工作区过一遍位置规则,再试写。都通过了:`R` 就是用户选的文件夹时直接用,不再确认;应用加了一层 `DeepSeek Bot` 时,同一张卡片变成「会放在 `D:\DeepSeek Bot`。」〔继续〕〔重新选…〕,只在应用改了用户选的路径时才确认。没通过(没有写入权限、在 OneDrive 里、`R` 是别人的非空文件夹、在 DSH 的家里、在程序文件夹里),卡片写一句原因,〔重新选…〕作主按钮,来时那张卡的〔放到 D 盘〕〔仍然放在 C 盘〕照旧留着;选择框被取消就回到来时的卡。DSH 数据的规则只在那个文件夹真的存在时才检查。位置行的「换个位置…」走同一条路,没有来时的卡:取消就回到位置行,已经出的「会放在…」「这里放不了」也收回。选了现在的根或数据文件夹就当没选;选在现在的数据文件夹里面不行,总工作区还空着时可以成为新的根。++- **推荐的盘**怎么来:只在数据所在的盘不到门槛(5 GB,有团队要导入时加上要多占的数:对话 1.2 GB 加默认要复制的工作文件 3.4 GB,就是不到 9.6 GB)、或默认位置不能用时查一次(重装接着用时不查),正常启动不查。这一步在引擎预热之前,所以迁移用户先看到推荐盘的卡,再看到导入卡。用完整路径的 `%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive`(`windowsHide`,5 秒超时)读 `Win32_LogicalDisk` 和 `Get-Partition | Get-Disk`:只要固定盘(`DriveType` 3)、`FreeSpace` 不为空、总线不是 USB、SD、MMC 或虚拟盘的,再用 `fs.statfs` 确认一次。盘不够时排除数据现在所在的盘;默认位置不能用时可以推荐同一个盘上的 `X:\DS Bot`。取剩余空间最大、而且不少于 20 GB 的一个。`X:\DS Bot` 已经存在时按下面定根的规则判断,不能用就不推荐这个盘。试写只建缺的那几层,写完删掉自己建的。PowerShell 失败、超时或被策略禁掉,都当作没有更好的盘。macOS 和 Linux 不推荐盘,空间不够只在提示行写一句。++- **一个位置。** 用户换位置时只选一个文件夹,由它定出根 `R`:选的是磁盘根目录,`R` 是它下面的 `DS Bot`;选的文件夹不存在或是空的,`R` 就是它;选的文件夹是 DS Bot 以前的根(`data` 里有 `.deepseek-bot` 标记,没有团队或者只有一个没说过话的空白团队),`R` 也是它;其余非空的文件夹,`R` 是它下面的 `DS Bot`。`R` 已经存在、非空、又不是以前的根时,不能用。数据放在 `R\data`,Bot 的文件放在 `R\workspace`(子文件夹的名字待定);两者是兄弟,互不包含,和默认的 `~\.ds-bot`、`~\DS Bot` 一样是同一个父文件夹下的兄弟,所有规则不变。〔放到 D 盘〕就是 `D:\DS Bot\data` 加 `D:\DS Bot\workspace`。默认安装的路径不改(待定)。设置里也是一处:「位置」一行显示两个路径,一个〔移到…〕一起搬(第 8 节);要分开放的在「高级」里。++- 只有点了「其他位置…」才打开系统选择框,挂在窗口上,从推荐的盘开始,没有推荐的盘就从现在的数据文件夹的上一级开始。选完先定根,`R\data` 和 `R\workspace` 都对照现在的数据文件夹和总工作区过一遍位置规则,再试写。都通过了:`R` 就是用户选的文件夹时直接用,不再确认;应用加了一层 `DS Bot` 时,同一张卡片变成「会放在 `D:\DS Bot`。」〔继续〕〔重新选…〕,只在应用改了用户选的路径时才确认。没通过(没有写入权限、在 OneDrive 里、`R` 是别人的非空文件夹、在 DSH 的家里、在程序文件夹里),卡片写一句原因,〔重新选…〕作主按钮,来时那张卡的〔放到 D 盘〕〔仍然放在 C 盘〕照旧留着;选择框被取消就回到来时的卡。DSH 数据的规则只在那个文件夹真的存在时才检查。位置行的「换个位置…」走同一条路,没有来时的卡:取消就回到位置行,已经出的「会放在…」「这里放不了」也收回。选了现在的根或数据文件夹就当没选;选在现在的数据文件夹里面不行,总工作区还空着时可以成为新的根。+- 首次启动的位置检查和「移到…」用同一套规则检查定出的根:不能是整个磁盘、不能是别人的非空文件夹,外加一次试写。+- `locations.json` 只在引擎第一次成功启动(`ready`)、导入问题也答完之后才写。同时写一份 UTF-16LE 的 `locations.ini` 给卸载程序读。应用自己新建的数据文件夹里放一个不含任何机密的 `.deepseek-bot` 标记,这个标记在建文件夹时就写、不等 `ready`:首次启动没走完就退出时,留下的文件夹下次才认得出是自己建的(定根规则里的「以前的根」),不会被当成别人的非空文件夹。「首次启动没走完就退出时什么都不记」的规则不变:记的只是 `locations.json`。每次启动先删掉上次留下的暂存(路径记在 `%APPDATA%` 里,加上数据文件夹里所有的 `.import-*` 和 `.import-check-*`)。+- 然后加载引擎的页面:DSH 的「预览版说明」→「继续」。DSH 自己的「开始使用」和「添加一个 API Key」不再自动出现:应用在自己的 profile 补丁(和 `search-patch.mjs` 一样经 `runProfile` 的 `patchFiles` 传入)里设 `ui-settings-models` 的 `credentialOnboarding: false`,这是 DSH 有文档的配置。补丁会替换这一行的整个 `config`,所以每次升级锁定的 DSH 都对照新版本重写这一行。应用的补丁里只有这一行。- - **启动失败**时,启动页当场变成恢复页(不再等 GitHub、不再隐藏窗口、不再弹英文「Error」框):鲸鱼那一行写「DeepSeek Bot 没能启动」,不说俏皮话,下面一句对应的原因(没有写入权限 / 磁盘空间不够 / 程序文件不完整,可能被杀毒软件拦掉了一部分 / 本机引擎启动到一半停下了 / 出了点意外),每种都给〔重试〕〔换个位置…〕〔用新的空白团队开始…〕〔打开日志文件夹〕〔复制详细信息〕(换位置按第 3 节定根的规则,数据和总工作区一起搬,搬的规则同第 8 节:同一个卷上改名,不同的卷上复制完再删旧的;还没有团队时只是换个空文件夹),再加一个「详细信息」折叠区(日志最后 200 行,已脱敏)。++- **启动失败**时,启动页当场变成恢复页(不再等 GitHub、不再隐藏窗口、不再弹英文「Error」框):鲸鱼那一行写「DS Bot 没能启动」,不说俏皮话,下面一句对应的原因(没有写入权限 / 磁盘空间不够 / 程序文件不完整,可能被杀毒软件拦掉了一部分 / 本机引擎启动到一半停下了 / 出了点意外),每种都给〔重试〕〔换个位置…〕〔用新的空白团队开始…〕〔打开日志文件夹〕〔复制详细信息〕(换位置按第 3 节定根的规则,数据和总工作区一起搬,搬的规则同第 8 节:同一个卷上改名,不同的卷上复制完再删旧的;还没有团队时只是换个空文件夹),再加一个「详细信息」折叠区(日志最后 200 行,已脱敏)。+- 启动超过 180 秒:鲸鱼问「等太久了,要不要重试?」,卡片上只有〔继续等待〕〔重试〕〔打开日志文件夹〕,引擎同时继续启动。- - 后台更新器发现了新版本时,恢复页上显示「DeepSeek Bot {版本} 已经发布,可能修好了这个问题。」〔下载并安装〕,带下载百分比和「下载太慢?手动下载」(打开镜像页)。++- 后台更新器发现了新版本时,恢复页上显示「DS Bot {版本} 已经发布,可能修好了这个问题。」〔下载并安装〕,带下载百分比和「下载太慢?手动下载」(打开镜像页)。+- 引擎起来了但 DS Bot 界面 20 秒内没报告就绪(ds-bot 在界面挂载完成后调用 `dsBotApp.ready()`):回到启动页,显示「团队界面没有加载出来」〔重新载入〕〔打开日志文件夹〕〔复制详细信息〕。+- 首次启动期间再双击图标:恢复并聚焦已有窗口,失败页上也一样。+- 建窗口不再依赖「下载」文件夹:每次下载时才取它的位置,取不到就用家目录,再不行就不给默认位置,让用户自己选。- - 日志:`%APPDATA%\DeepSeek Bot\logs\main.log`,2 MB × 3 份轮换,收主进程和引擎的输出;写之前去掉 `token=…`、`sk-…` 和 `/oauth/callback?…` 的查询部分,把用户文件夹的完整路径(如 `C:\Users\<用户名>`)换成 `%USERPROFILE%`。++- 日志:`%APPDATA%\DS Bot\logs\main.log`,2 MB × 3 份轮换,收主进程和引擎的输出;写之前去掉 `token=…`、`sk-…` 和 `/oauth/callback?…` 的查询部分,把用户文件夹的完整路径(如 `C:\Users\<用户名>`)换成 `%USERPROFILE%`。+- 启动页是纯 DOM,CSP `default-src 'self'`;颜色取 [UI 标准](../design/ui-standard.md) 2.1 节 DeepSeek 主题的值,字号用标准里的 13 / 14 / 15 px。它只拿到 `dsBotStart`(`onState`、`act`),只在页面地址正好是启动页文件时才暴露。引擎页面上的 `dsBotApp` 只新增 `ready()`(上面的 20 秒检查)、`focus()`(第 5 节退回系统浏览器登录时回到前台)、`signIn`(第 5 节的登录窗口:`onClosed(原因, 代理)`、`close()`、`openOutside`)和 `foundKeys()` / `takeKey()`(第 5 节现成的 Key),以及主窗口露面时发给页面的一个事件(侧栏磁贴上的鲸鱼靠它浮上来,[启动窗口](2026-10-26-start-window.md) 第 8 节,待定),其余不变;新增的这些只在引擎的页面上、只对主窗口的主框架暴露。主进程对两者分别做精确的来源检查。+- `DS_BOT_HOME` 的一次性运行照旧:不问、不导入,但也显示启动页和失败页。++### 4. 已有 DSH 团队:导入卡++条件:`~/.dsh`(或 `DSH_HOME`)里有 Bot 团队,而数据文件夹里还没有。++- 导入卡在启动页上出现。卡片一出现,两件事就在后台开始,不等用户回答:引擎在新数据位置预热(已定的「先在新数据位置启动一次再复制」照旧),先查团队有没有被 DSH 占着(下面的判断规则):没占着才把对话复制进暂存文件夹 `.import-<时间>`(在数据文件夹里,和复制时用的是同一个),锁定版 DSH 以暂存为家读一遍它们;占着就只预热引擎,什么都不复制。复制暂存期间锁出现过或刷新过,这份暂存作废,锁放开后重新复制。这份暂存就是复制时要用的那一份:不再另建 `.import-check-<时间>`,对话只复制一次。暂存的路径记在 `%APPDATA%` 里;导入卡开着时关掉启动窗口、更新重开、被杀掉,下次启动都先删掉它。导入卡开着、第一段还没复制完时,主窗口不加载引擎的页面(插件一收到 `state` 就会建出一个空白团队),第 3 站「打开团队」和 20 秒的界面检查也等用户回答以后才开始。点〔先不复制〕:等检查用的引擎退出后删掉暂存,预热好的引擎接着当正式引擎用,主窗口这时才加载它的页面,一秒都不多等。点〔复制过来〕:预热的引擎拿着团队的锁,先停掉它再接着复制 Bot 和附件,复制完起正式引擎,和今天一样。+- 卡片的第一句是鲸鱼的话「找到你以前的团队了」,下面只有一句话和两个按钮:「DeepSeek Harness 里有 6 个 Bot 和 2 个群聊(对话 1.2 GB,工作文件 3.4 GB)。复制过来?」〔复制过来〕〔先不复制〕,下面一行小字「复制后会多占 4.6 GB,DeepSeek Harness 里的原件不动。」,脚注「也可以在 设置 → 通用 → 位置 里复制。」按 Enter 就是复制。「详细」展开才有:+ - 「在 `C:\Users\<用户名>\.dsh` 里找到 6 个 Bot(Chief、写手、程序员等)和 2 个群聊,143 段对话。」+ - 「会复制:Bot、群聊、记忆、对话、附件、模型设置和 API Key。不会复制:MCP、技能和 DSH Agent。DeepSeek Harness 里的内容不会改动,复制以后两边各用各的。」+ - 模型设置自动选一份:先选有 key 的,再按 desktop、web、行数最多的顺序。显示提供商和默认模型,旁边有「更换」,可以按同样的格式换另一份。+ - 可重新生成的文件夹(`node_modules`、`.venv`、`__pycache__`、`.pnpm-store`、`.next` 等)合计 200 MB 以上时,默认勾选「不复制可以重新生成的文件夹」;「先不复制工作文件」默认不勾。卡片上的「工作文件 3.4 GB」和「多占 4.6 GB」按勾选项算:默认已经扣掉可重新生成的文件夹,改勾选时两个数字跟着变。+- **复制分两段,小的先进去。** 第一段挡着启动:Bot、群聊、记忆、对话、附件、模型设置和 API Key(今天 `importTeam` 里除工作文件以外的全部),复制完就启动团队。第二段在团队打开以后由应用在后台做:旧团队工作文件夹里的文件复制到总工作区,不覆盖已有的文件,跳过勾掉的文件夹。导入后每个 Bot 本来就换到新文件夹的新一段,旧文件夹只当历史读,所以工作文件晚几分钟到不影响干活;Bot 在那之前新建了同名文件,旧文件就跳过,记在导入结果里。工作文件还没到齐时(`bot/work-files.json` 是 `pending`),插件在每个 Bot 的系统提示里加一句:工作文件还在从 `<旧文件夹>` 复制过来,还有 N 个,那里只读,要用旧文件先去那里看;跳过的文件数和第二段没开始的原因也写在「复制好了」卡上,不只在设置里。Bot 和群自己设的文件夹(`workDir`):在 `~/.dsh/bot/workspace` 里面的,改成新总工作区下同样的相对路径(应用的 Bot 不能写 `~/.dsh`);在别处的两边团队会共用,「详细」里列出这些 Bot 和群。+ - 第二段自己遍历目录树(不用 `fs.cp`),沿用 `copyTree` 的 leave、skip 和 relink(链接最后照旧重建):每个文件先写进总工作区旁边、同一个卷上的暂存文件夹(`.<总工作区名>.copying-*`,带标记,和换位置的暂存一样),写完用 `fs.link` 放到正式位置;同名文件已经存在时 link 以 EEXIST 失败,就把相对路径记进跳过列表,再删掉暂存里的这一份。不支持硬链接的文件系统(FAT、exFAT)退回到「查一次再改名」,那一小段竞态记进已知限制。Bot 永远读不到写了一半的文件。+ - 记录在 `bot/work-files.json`(`{ from, to, skip, state: 'pending' | 'done', done, total, skipped }`):`importTeam` 在最后改名之前把它写进暂存的 `bot/`,和团队一起落地;`imported.json` 只记导入的结果。进度在 设置 → 通用 → 位置 里:「正在复制工作文件 820 / 1,204 个,不到 1 分钟」〔停止〕;Main Bot 聊天里的「复制好了」卡上也带一行。退出应用时在文件之间停下,下次启动先删掉上次留下的暂存文件夹,再接着复制;停止后设置里显示「工作文件还有 384 个没复制」〔继续复制〕。第二段进行中,〔移到…〕和换总工作区先停下它。`DS_BOT_HOME` 的运行不续复制。+- **空间只占一份。** 从 DeepSeek Harness 复制时原件必须留下(应用从不写 `~/.dsh`,也不用硬链接连到它的文件:同一个文件两处可见,Bot 在新位置写就改掉了原件),所以多占的空间要在复制前写在卡片上,复制过程中盘上任何时刻最多只多出最后会留下的那一份,复制后设置里能看到原件在哪、占多少:+ - 卡片一出现先查第一段的空间:卡片上的「对话 1.2 GB」是第一段的全部(对话、记忆和附件),要求剩余不少于「第一段 + 500 MB」。够就开始往暂存复制对话并检查;不够就只预热引擎,答〔复制过来〕时出一张卡,第一句「地方不够放」,下面「空间不够:复制要约 1.7 GB,C 盘只剩 1.5 GB,还差 0.2 GB。」〔选择其他位置…〕〔先不复制〕。+ - 暂存在数据文件夹里,和目标同一个卷:对话、`bot/` 和附件都从暂存改名进位,不再把附件从暂存复制第二份。+ - 工作文件的空间在第二段开始前单独查,要求剩余不少于「要复制的工作文件 + 1 GB」,不够就不开始,只在设置里写「工作文件没有复制:D 盘还差 2.2 GB」〔重试〕,不打断启动;复制中剩余不到 500 MB 就停下,设置里写「工作文件没复制完:D 盘只剩 480 MB」〔继续复制〕。暂存加硬链接落位本来就不多占空间。- - 复制后,设置 → 通用 → 位置 里有一行「DeepSeek Harness 里的原团队还在 `C:\Users\<用户名>\.dsh`(4.6 GB),DeepSeek Bot 不会改动它。」〔打开文件夹〕;要不要删、什么时候删由用户在 DeepSeek Harness 里决定。++ - 复制后,设置 → 通用 → 位置 里有一行「DeepSeek Harness 里的原团队还在 `C:\Users\<用户名>\.dsh`(4.6 GB),DS Bot 不会改动它。」〔打开文件夹〕;要不要删、什么时候删由用户在 DeepSeek Harness 里决定。+ - 新用户从不复制任何东西:推荐盘和「其他位置…」只新建空文件夹,重装接着用原处的数据。应用自己的数据搬动时(第 8 节〔移到…〕、恢复页的〔换个位置…〕)旧位置不留副本。+- 第一段复制时卡片标题是「正在搬过来」,下面是分步进度和数字:「检查对话 23/143」→「复制 Bot 和对话 820 MB / 1.2 GB」→「启动团队」,带剩余时间估计和任务栏进度。〔停止复制〕会就地确认,并说明停下后会留下什么:不留下复制了一半的团队,DSH 里的团队不受影响。+- DSH 正在用这个团队:第一句「DeepSeek Harness 还在用这个团队」,下面「请完全退出 DSH Desktop(任务栏右下角的托盘图标也要退出),并关掉 DSH Web,这里会自动继续。」这张卡在答〔复制过来〕时才出现(卡片一出现就查到被占着时只是不暂存),每 2 秒自动重查,不用点重试,锁一放开就开始暂存和复制;卡上有〔先不复制〕,退不掉 DSH 的人有路可走。判断规则和 ds-bot 的 home-lock 一样:同一台机器上 PID 活着**而且**锁在 60 秒内刷新过(#428 的修法),被系统重用的旧 PID 不再算。- - 有更新版本 DSH 写的对话(下面两张卡的第一句都是「这些对话比我新」):更新器现在随应用一起启动,找到能读的版本时:「DeepSeek Bot 0.2.4 能读它们,正在下载(37%)。装好后会重新打开,再复制团队。」卡上有〔先不复制〕,还有「下载太慢?手动下载」;下载失败时〔重试〕〔手动下载〕(和恢复页的更新条一样)。位置在这之前不保存,重开后会再问导入。没找到时:「这些对话是更新版本的 DeepSeek Harness 写的,DeepSeek Bot 现在读不了。」主按钮是〔先不带团队开始〕(不再是「退出」),脚注「以后可以在 设置 → 通用 → 位置 里复制。」++- 有更新版本 DSH 写的对话(下面两张卡的第一句都是「这些对话比我新」):更新器现在随应用一起启动,找到能读的版本时:「DS Bot 0.2.4 能读它们,正在下载(37%)。装好后会重新打开,再复制团队。」卡上有〔先不复制〕,还有「下载太慢?手动下载」;下载失败时〔重试〕〔手动下载〕(和恢复页的更新条一样)。位置在这之前不保存,重开后会再问导入。没找到时:「这些对话是更新版本的 DeepSeek Harness 写的,DS Bot 现在读不了。」主按钮是〔先不带团队开始〕(不再是「退出」),脚注「以后可以在 设置 → 通用 → 位置 里复制。」+- 复制失败(失败的卡没有鲸鱼的第一句):「团队没有复制完:{原因}。DeepSeek Harness 里的团队没有变化。」常见原因翻成人话(文件被别的程序占用 / 没有权限读取 / 磁盘满了),其他放进「详细信息」。〔重试〕〔先不带团队开始〕〔复制详细信息〕。失败或停止时删掉 `.import-<时间>` 暂存文件夹。+- 导入的修正:群聊的接力 Session(`room.id`)也复制(#551,PR #567);目标里已有的 `.credentials.yaml` 存着用户自己的 key 或登录时不覆盖。引擎在新数据位置第一次启动时会写一份只有 `client-connection/` 记录(浏览器会话)的 `.credentials.yaml`,这样的文件照常换成旧的。+- 第一段复制完成后,窗口打开在导入来的 Main Bot 的聊天里,先显示一张一次性的卡片「复制好了:6 个 Bot、2 个群聊、143 段对话。工作文件正在后台复制(1,204 个,3.4 GB,还要大约 2 分钟)。」,然后是对模型的检查结果。检查通过显示「模型:DeepSeek-V4-Pro · DeepSeek API Key 可以用,余额 ¥23.50」;没通过就在用户打字前显示对应的修复卡(见第 6 节)。+- 导入后,Main Bot 在模型检查通过后马上(空闲时)换到新文件夹的新一段(只提前换 Main Bot 待定),并显示「正在把{名字}搬到新的工作文件夹(要读一遍最近的对话,大约 1 分钟)。现在发消息也可以,会排在后面。」其他 Bot 在各自的第一条消息时换段,换段期间先显示用户的消息和「正在搬到新文件夹…」,不再出现 84 秒什么都没有的情况(#384)。++### 5. 接上模型:Main Bot 的设置卡++设置卡是插件的功能,桌面应用、DSH Desktop 和 DSH Web 里都有,下面没注明的地方各形态一样;登录窗口和现成的 Key 一键用要靠应用(`dsBotApp`),只在桌面应用里。++- 桌面应用首次启动交接后,Main Bot 的鲸鱼在侧栏的磁贴上浮上来一次([启动窗口](2026-10-26-start-window.md) 第 8 节),随后是下面的气泡和设置卡。设置卡的检查、通过和失败驱动磁贴上鲸鱼已有的状态动作(检查时是搜索,通过时是完成);指针在侧栏里时它的眼睛跟着指针(安静档没有);减少动态效果时它不动,只有徽标。+- Main Bot 还没有能用的模型时,它的聊天里不再是三个按钮,而是一张卡片(按 UI 标准里提问卡的样式):+ - 气泡:「你好,我是{名字},负责管理你的 Bot 团队。开始之前,我需要先接上一个模型。选一种方式:」+ - A「用 DeepSeek 账号登录」,标「推荐」:「不用管理 API Key。没有账号的话,在登录页用手机号就能注册。费用从账号余额里扣;新账号如果有赠送额度,登录后会显示在这里。」主按钮在桌面应用里是〔登录 DeepSeek 账号〕,在 DSH Desktop 和 DSH Web 里是〔在浏览器中登录〕。profile 里没有 DeepSeek 账号功能时不显示 A。+ - B「粘贴 DeepSeek API Key」:掩码输入框(占位「sk-…」)、〔检查并保存〕、「去 DeepSeek 开放平台创建 Key ↗」(`https://platform.deepseek.com/api_keys`)和一句「API 按用量计费,账户里要先有余额。」+ - 底部「用其他模型服务…」打开 DS Bot 设置 → 模型的添加表单。+- **登录**:桌面应用里点〔登录 DeepSeek 账号〕,登录页在应用自己的**登录窗口**里打开,全程不离开应用:+ - 卡片变成「正在登录 DeepSeek 账号…」,带有效期、〔取消〕和一行小字「登录窗口没出来?在浏览器里打开 · 复制登录链接」。登录完成后登录窗口自己关掉,焦点回到主窗口,卡片接着走余额检查。+ - 登录窗口怎么来:DSH 的网页前端在点击时先 `window.open` 一个 `about:blank`(再把它的 `opener` 设成 null),拿到授权链接后用 `location.replace` 把它导过去(今天应用把这一步交给系统浏览器)。这个空白窗口不能当登录窗口:`window.open` 开出来的窗口由 Chromium 建在打开它的页面的 session 里(主窗口默认的、存在磁盘上的那个),`about:blank` 的 webPreferences 也照抄主窗口,`overrideBrowserWindowOptions` 改不了 partition。所以应用照今天的 `setWindowOpenHandler` 允许它、一直隐藏,只当作 DSH 手里的句柄;它第一次要导航时(主框架的 `will-navigate` 或 `will-redirect`),应用拦下这次导航:路径是 `/dsh/authorize` 的,用这个地址新建应用自己的登录窗口;不是的,照今天交给系统浏览器并销毁空白窗口。DSH 只会把它导到自己 `platformOrigin` 上这条固定路径的链接,所以授权页的来源从这次导航取,不读 DSH 的配置,CI 的 loopback 假平台也不用另配。+ - 登录窗口是主窗口的子窗口(`parent` 是主窗口):系统边框,标题固定为「登录 DeepSeek 账号」,不跟着登录页的标题变(拦下 `page-title-updated`);内容区 480 × 680,主窗口所在显示器的工作区不到 760 高时,高度改为工作区减 80,登录页在窗口里滚动;居中在主窗口上、整个落在工作区里;不能单独最小化和最大化,随主窗口最小化。`sandbox`、`contextIsolation`,没有 preload、Node 和 webview;用一个不持久的独立 partition(`deepseek-login`)。这种 partition 要到应用退出才没,所以每次关窗都清掉它的存储和缓存(`clearStorageData`、`clearCache`):应用不保存 DeepSeek 平台的登录状态,下一次登录不会带着上一次的账号,登录的 token 只在引擎的凭据里。新的登录窗口等上一个窗口的清理做完再开:每次登录用的是同一个 partition,清理还没做完就开的窗口,刚拿到的 cookie 会被一起清掉。这个 partition 照 Bot 浏览器的分区(`bot-browser.mjs` 的 `#configure`)拒绝权限请求、权限检查、设备权限和屏幕共享,取消下载;但不照抄它的 `onBeforeRequest`:那条拦下发往引擎本机地址的所有请求,回调就到不了。登录窗口的 session 用自己的 `onBeforeRequest`:发往引擎本机地址(任何本机名加引擎的端口)的请求只放行主框架的 `GET /oauth/callback`,子框架、脚本和其他路径一律拦下,登录页和里面的验证码、扫码框架都碰不到引擎。窗口先隐藏,授权页第一次画出来(`ready-to-show`)再显示。全是 Electron 有文档的接口,不碰 DSH。+ - 允许的地址(只管主框架的导航和重定向,看 `isMainFrame`;登录页里的子框架,比如验证码和扫码,照常加载和跳转):授权页的来源;主机名是 `deepseek.com` 或以 `.deepseek.com` 结尾的 https 页面;引擎本机地址加 `/oauth/callback` 这一个路径(DSH 的回调)。窗口里的 `window.open`(包括登录页上用户协议、隐私政策这类在新窗口打开的链接)不开新窗口,一律交给系统浏览器,登录窗口留在原来的页面上:登录窗口没有后退,在里面打开就回不到登录页。主框架要去名单外的地址时(比如第三方登录),这次登录换到系统浏览器:应用关掉登录窗口(不算取消),把这次登录的授权链接(不是那个地址)交给系统浏览器从授权页重新开始,并经 `onClosed('browser')` 告诉页面。设置卡和点了〔在浏览器里打开〕时一样,换成「已在浏览器打开 DeepSeek 登录页。登录完会自动回到这里;登录完成前请不要关闭这个窗口。」,有效期、〔取消〕和「复制登录链接」照旧,登录完成后调 `dsBotApp.focus()` 回到前台。同一次登录只在一处进行。+ - 回调一有回应,应用就关掉窗口,不加载回应的那一页(在登录窗口的 session 上用 `webRequest` 看 `/oauth/callback` 这次请求的回应,不论状态码)。有回应不等于登录成功:应用的页面没有 `dshDesktop`,DSH 按网页版回应:成功时回 302 到完成页,这时引擎已经把登录记下来;换取失败时回一页会自己关掉的说明(200);取消时回 204;作废或重复的回调回 410。登录成没成只看 DSH 的登录状态,卡片照它走。看到回应时,应用先记下这个窗口的回调已经有了回应,再关窗;这次关窗算应用自己关,不发 `onClosed`。之后这个窗口再来的 `did-fail-load`(比如拦下回应造成的 `ERR_BLOCKED_BY_CLIENT`,或 400、410 没有内容的错误页)不算登录页加载失败。+ - 两个窗口同生同灭:失败、过期、取消时 DSH 的前端关掉它手里的空白窗口,应用跟着关掉登录窗口;登录窗口不管因为什么关掉(回调有了回应、用户自己关、加载失败、交给了浏览器、页面调 `close()`),应用都销毁空白窗口:登录成功时 DSH 不关它已经导过的空白窗口,只丢掉引用,在别处登录完成时只有这一条能收掉它。DSH 再开始一次登录时(比如经典 Agent 模式里 DSH 账号菜单的「登录」,它直接调 `start()`),它先关掉旧的空白窗口再开一个新的,Host 回的还是同一次登录:旧登录窗口关掉,新的空白窗口一导航就开出新的登录窗口,这不算取消。登录窗口开着时点鲸鱼菜单的「登录 DeepSeek 账号」或修复卡的登录按钮,只打开 DSH 自己的登录框,显示等待中,它的〔登录〕是灰的,登录窗口不换;在那个登录框里点〔取消〕或 ×,DSH 取消这次登录,登录窗口跟着关掉,设置卡回到两种方式。不管登录在哪里完成,插件在账号变成已登录、或这次登录结束时调 `dsBotApp.signIn.close()` 关掉还开着的登录窗口。+ - 谁关的窗口,应用分得清。只有三种关窗,应用经 `dsBotApp.signIn.onClosed(原因, 代理)` 告诉页面(代理只在 `failed` 时有,见下一条):`user`(用户按 × 或 Alt+F4,回调请求还没从这个窗口发出)、`failed`(登录页加载失败)、`browser`(主框架去了名单外的地址,交给了系统浏览器)。跟着空白窗口关的、回调有了回应关的、页面调 `close()` 或 `openOutside` 时关的,以及回调请求发出之后用户再关的,都不发。用户关的、而且回调请求还没从这个窗口发出,等于取消:卡片在这次登录还在等浏览器(`waiting-browser`)时调用 DSH 的 `cancel`,回到两种方式的卡;回调请求发出之后再关(用户已经在登录页里登录完,DSH 正在换取和保存),不算取消,不发 `onClosed`,卡片等 DSH 的结果。`failed` 和 `browser` 都不取消。修复卡和鲸鱼菜单走的是 DSH 自己的登录框,没有这张卡:插件从 `settings.models.sign-in` 条目的账号状态取当前这次登录,按同样的规则调 `cancel`,不等它过期。+ - 登录页加载失败(比如断网、代理不对;看主框架的 `did-fail-load`,`isMainFrame` 为真,子框架打不开不算,回调有了回应之后的也不算):窗口关掉,`onClosed('failed', 代理)`,这次登录不取消;卡片显示「打不开 DeepSeek 登录页。」〔重试〕〔在浏览器里打开〕〔取消〕,有效期照旧;〔取消〕调用 DSH 的 `cancel`,回到两种方式的卡。代理由应用在主进程里取:用登录窗口的 session 对授权链接 `resolveProxy`,取结果第一项的地址(如 127.0.0.1:7890),第一项是 `DIRECT` 时为空;页面自己读不到系统代理。代理不为空时,加一句「登录页走的是系统代理 127.0.0.1:7890:如果代理软件没开,打开它。」,不提第 7 节的「跟随系统代理」开关:登录窗口走应用自己的 Chromium 网络,本来就跟随 Windows 系统代理,那个开关只管引擎。〔重试〕再开始一次登录:Host 回的还是这一次,DSH 开一个新的空白窗口,应用开一个新的登录窗口。+ - 〔在浏览器里打开〕和登录卡小字里的「在浏览器里打开」都走系统浏览器(`dsBotApp.signIn.openOutside`,用这一次的授权链接;登录窗口还开着就由应用关掉,不算取消),卡片换成「已在浏览器打开 DeepSeek 登录页。登录完会自动回到这里;登录完成前请不要关闭这个窗口。」,有效期、〔取消〕和「复制登录链接」照旧;登录完成后窗口回到前台(`dsBotApp.focus()`);Windows 不允许抢前台时,任务栏按钮闪烁。+ - 登录窗口的地址一律不写进日志,和 DSH 自己的诊断一样不记授权链接:`did-fail-load` 只记错误码和主机名,交给系统浏览器的地址也不记。+ - 登录窗口只在用户点了某个登录入口之后出现,从不自己弹出;它是主窗口的子窗口,启动窗口阶段没有它([启动窗口](2026-10-26-start-window.md) 第 1 节)。应用接的是 DSH 网页前端的每一次登录,所以桌面应用里不只设置卡:第 8 节的〔重新登录〕、第 6 节修复卡的〔用 DeepSeek 账号登录〕〔改用账号登录〕〔重新登录〕、第 7 节鲸鱼菜单的「登录 DeepSeek 账号」,以及 DSH 自己登录框里的登录,也都在登录窗口里登录。+ - DSH Desktop 和 DSH Web 里不变:按钮仍叫〔在浏览器中登录〕,DSH Web 开新标签页、DSH Desktop 开系统浏览器,卡片写「已在浏览器打开 DeepSeek 登录页。登录完会自动回到这里;登录完成前请不要关闭这个窗口。」。+ - 卡片用的是 `settings.models.sign-in` 条目注入的操作,取法和今天一样(`ctx.slots.entries('settings.models.sign-in')` 的第一个,即现有的 `actions.signInEntry()`)。这些操作有类型声明,但 DSH 没有写成给插件用的接口:每个要调的操作都先确认存在,缺了就退回今天的 `DeepSeekSignIn`。+ - 和 DSH 自己的做法一样:开始登录时 `setOnboarding(true)`;成功、取消、过期、失败,以及卡片卸载时,都调 `setOnboarding(false)` 和 `showLogin(false)`。否则切到经典 Agent 模式时,DSH 的账号菜单会再弹出一个登录框。`start()` 本身失败时按「登录没有完成」处理。+- **粘贴 key**:保存前先检查。只对 DeepSeek 官方地址:`GET https://api.deepseek.com/user/balance`,8 秒超时,不记录 key 和返回内容。`DEEPSEEK_BASE_URL` 指向本机地址时(mock 模型),检查发到那个本机地址的 `/user/balance`;其他自定义地址或中转服务不检查余额,交给第一轮的修复卡。key 只会发给 `api.deepseek.com` 或本机地址。+ - 401:「DeepSeek 不接受这个 Key(401)。请确认整段复制了,或者新建一个。」key 不保存,输入框保留内容和焦点。+ - 格式不对(带引号、带 `NAME=` 等,沿用现有规则):「只粘贴 Key 本身,不要带引号或 NAME=…」+ - 余额为零:key 保存,卡片显示「Key 没问题,但账户余额是 ¥0.00,充值后才能用。」〔去充值 ↗〕〔再查一次余额〕〔换一种方式〕(回到 A/B 两种方式的卡,已经保存的 key 留着)。+ - 连不上:「暂时连不上 api.deepseek.com,Key 还没保存。如果在用代理软件,确认它开着。」〔再试一次〕〔仍然保存〕。429 或 5xx:「DeepSeek 服务暂时繁忙({状态码}),Key 还没保存。」同样两个按钮。+ - key 来自环境变量 `DEEPSEEK_API_KEY` 而检查没通过(按 `describe` 的 `source` 认,不按 `writable`):「环境变量 DEEPSEEK_API_KEY 里的 Key 检查没通过。换一种方式接上就行,在这里保存的 Key 优先于环境变量。」〔换一种方式〕+- **现成的 Key 一键用**(只在桌面应用;看不看剪贴板待定):卡片出现时应用看两处,找到了就在 A、B 之上多一行「{来源}里有一个 Key:sk-1a2b3…」和〔用这个 Key〕,照样先检查再保存;Key 本身不显示、不进日志。这一行最多一行;它在的时候〔用这个 Key〕是卡上唯一的主按钮,A 的〔登录 DeepSeek 账号〕改成次按钮,「推荐」照旧标在 A 上(UI 标准 10.1:每个界面最多一个主按钮):+ - DeepSeek Harness 自己的凭据:和导入看同一个家(`DSH_HOME`,没设就是 `~\.dsh`)。先看 `.credentials.yaml` 里 `refs` 下的 `DEEPSEEK_API_KEY`,没有就看那里 `.env` 的同名行;只认 Key,不读 `records` 里的登录记录。那个家给 DeepSeek 设了别的地址时(`.env` 里的 `DEEPSEEK_BASE_URL`,或任何一个 `profiles/*/cordis.patch.yml` 里 `llm-deepseek` 的 `baseURL`,和导入读模型设置的是同一批文件)不出这一行:这把 Key 是给那个地址的,检查会把它发到 `api.deepseek.com`。这一行写「DeepSeek Harness 里有一个 Key:sk-1a2b3…」。装过 DSH、配过 Key、但没有团队可导入(或者答了〔先不复制〕)的人就是这种情况。导入过团队的人,Key 一般已经随 `.credentials.yaml` 或 `.env` 复制过来,设置卡不出现;导入来的 Key 检查没通过时设置卡会回来,这时找到的 Key 和数据位置里已经存的一样,就不出这一行。只读不写,和导入一样。+ - 剪贴板里正好是一个 DeepSeek 的 Key(整段去掉首尾空白后是 `sk-` 加 32 位十六进制,和下面聊天卡认 DeepSeek 格式的规则一样,以实测为准):这一行写「剪贴板里有一个 Key:sk-1a2b3…」。别家格式的 Key 不出这一行,不把别家的 Key 发去 `api.deepseek.com` 检查。只在设置卡显示期间读:卡片出现时读一次,之后窗口每次回到前台再读一次;只比对格式,不记录;整段值留在应用里,页面只拿到来源和前八位;之后再读到剪贴板变了(窗口回到前台、点〔用这个 Key〕时),这一行按新读到的结果换掉或消失。+ - 两处都有时仍然只有一行:应用在主进程里比对整段值,相同就只算 DeepSeek Harness 那把;不同就显示剪贴板那把,下面一行小字「改用 DeepSeek Harness 里的 Key(sk-1a2b3…)」。+ - 前八位和 DSH 掩码保留的位数一样。点按钮时应用才把值交给页面:`dsBotApp.foundKeys()` 只回来源和前八位,`dsBotApp.takeKey(来源)` 再读一次,读到的仍是一个 Key、前八位也和这一行上的一样时才回整个值,否则不回值、这一行按新读到的结果换掉或消失;页面走和粘贴 Key 完全一样的检查和保存(Host 的 `provider-key`)。401 或余额为零按上面处理,提示写明来源:「DeepSeek Harness 里的 Key 不能用(401)。」,这一行消失。检查没通过(401)的 Key,插件在页面内存里记下它的来源和前八位(应用不知道检查的结果,也不另加接口):这个页面里之后再读到同一来源、同样前八位的 Key(窗口回到前台、切到别的 Bot 再回来、卡片重新出现),都不出这一行;两处都有时改出另一处那把。重新加载页面后才会再出现。+ - 环境变量里的 `DEEPSEEK_API_KEY` 不用按钮:引擎继承应用的环境(`process.env`),数据位置的 `.credentials.yaml` 里没有这把 Key 时,DSH 的凭据层退回到它,`describe` 报已配置、`source` 是 `env`(`writable` 仍是 `true`),设置卡不出现;只有它检查没通过时才有上面「来自环境变量」那张卡。在这里保存的 Key 写进凭据文件,优先于环境变量,所以〔换一种方式〕之后粘贴或登录都能接上,不用改环境变量。+- **在聊天里粘了 Key 也认**(所有形态):真实用户会把 Key 直接发到 Bot 的聊天框里,发出去就进了对话记录、还会发给模型。没有能用的模型时 Bot 聊天的输入框本来就锁着(见下面「输入框不可用」那条),粘不进去;所以这张卡管的是接上模型以后的 Bot 聊天和群聊(比如修复卡报 AUTH 时用户把新 Key 发进来;新团队的 Main Bot 要等上手结束,上手期间粘进目标卡输入框的 Key 见第 6 节),以及模型列表还没出来的那一刻。插件观察每个 Bot 和群聊会话的输入稿(DSH 有文档的 `ctx.conversation.input`,每个会话的 `state`),整段去掉首尾空白后正好是一个 `sk-` 开头的 Key(`sk-` 后面 20 个以上的字母、数字、`_` 或 `-`,其中至少一个数字,和 DSH 掩码认 `sk-` Key 的规则一致;别家的 `sk-` Key 也算;DSH 掩码认的其他格式,如 `ghp_`、`AKIA`,不是模型服务的 Key,不拦;带 `NAME=` 或引号的也不拦,和句子里夹着 Key 一样),就给这个会话挂一个 `ComposerBlock`(DSH 有文档的 `ctx.conversation.blocks`:输入框变灰,不能编辑也不能发,输入稿留在里面),并在输入框上方的卡片槽(`conversation.input.dock`,和今天 Bot 要秘密的卡同一处)显示一张卡,按状态选文案:+ - DeepSeek API 还没有 Key:「这看起来是一个 API Key,还没有发出去。要保存成 DeepSeek API 的 Key 吗?」〔检查并保存〕〔当普通消息发送〕〔清掉〕,小字「改一下 · 保存到其他提供商…」。+ - DeepSeek API 已经有 Key:「这看起来是一个 API Key,还没有发出去。要把 DeepSeek API 的 Key 换成它吗?」〔检查并换上〕〔当普通消息发送〕〔清掉〕,小字同上。+ - 不是 DeepSeek 的格式(DeepSeek 的 Key 是 `sk-` 加 32 位十六进制,以实测为准):「这看起来是一个 API Key,还没有发出去,但不像 DeepSeek 的 Key。要保存到哪个提供商?」〔保存到提供商…〕〔当普通消息发送〕〔清掉〕,小字「改一下」。〔保存到提供商…〕打开 DS Bot 设置 → 模型的添加表单,Key 已经填好(只在页面里传);保存后 `setDraft('')`、撤掉 block;没保存就关掉表单时,输入稿和 block 留着。+ - 这个 Bot 正有一张要填值的 `request_secret` 卡在等时:「这看起来是{名字}正在要的 Key,还没有发出去。」〔填进那张卡〕〔当普通消息发送〕〔清掉〕,小字「改一下 · 保存成 DeepSeek API 的 Key」。〔填进那张卡〕把输入稿移进那张卡的输入框(卡在对话里时滚到它),`setDraft('')`、撤掉 block。+ - 〔检查并保存〕/〔检查并换上〕:从输入稿取值,走和设置卡完全一样的检查和保存;通过后 `setDraft('')` 清掉输入稿、撤掉 block。没通过时输入稿和 block 都留着,卡上换成检查的结果,〔当普通消息发送〕〔清掉〕和小字「改一下」照旧:401 写「DeepSeek 不接受这个 Key(401)。请确认整段复制了,或者新建一个。」,主按钮换成〔清掉〕,不再有〔检查并保存〕;连不上、429 或 5xx 写设置卡「粘贴 key」里的同一句(「Key 还没保存」),主按钮〔再试一次〕,旁边〔仍然保存〕(已经有 Key 时是〔仍然换上〕),保存后同样 `setDraft('')`、撤掉 block。余额为零时 Key 保存,同样清掉输入稿、撤掉 block,卡片留着,写「Key 已保存,但账户余额是 ¥0.00,充值后才能用。」〔去充值 ↗〕〔知道了〕,点〔知道了〕才收起;这里没有两种方式,不带〔再查一次余额〕〔换一种方式〕。设置卡由状态决定(第 8 节),不在这里写它。+ - 〔当普通消息发送〕:先把这段输入稿记成「放过」,撤掉 block,再调这个会话输入框自己的发送(`ctx.conversation.input.for(会话).submit()`,和点发送按钮同一条路):输入稿由 DSH 清掉,附件一起发出,发送失败时由 DSH 还原输入稿。DSH 发送时把输入稿清空不算改:输入稿空着、或者又变回这一段时「放过」仍在,所以还原回来的输入稿不再挂 block;输入稿变成别的非空内容时「放过」作废,按新的输入稿重新判断。这条路不带 DSH 的插话设置,回合进行中时一律排进队列。+ - 〔清掉〕:`setDraft('')`,撤掉 block;Key 不保存,也不发出。401 之后也靠它离开。+ - 「改一下」:撤掉 block,输入稿原样留着,焦点回到输入框(`focus()`);这段输入稿记成「放过」,不再拦;这样记下的「放过」输入稿一改就作废(和〔当普通消息发送〕记下的不同),按新的输入稿重新判断。+ - 一个会话只有一个 block(`ctx.conversation.blocks.set` 是替换,传 `undefined` 清掉的是整个 block),下面「没有能用的模型」的锁和第 6 节上手的锁也用它。所以插件只在一处算这个会话的 block:模型锁 > 上手锁 > Key 的 block,三样都没有才清空。上面说的「撤掉 block」,是去掉 Key 这一层再按这条重新算。+ - 挂着 block 时输入框是只读的(DSH 的 block 让编辑器不能编辑,占位里的原因也只在输入稿为空时显示),用户自己改不了输入稿,出口全在卡片上;输入稿被别处改成别的内容时(比如别的插件调了 `setDraft`),block 和卡片自己消失;切到别的会话再回来、或者重新加载时,按当时的输入稿和「放过」重新判断。「放过」按会话记在页面的内存里,记的是输入稿全文;切到别的会话再回来还在,重新加载就没了。只拦整段是 Key 的输入稿:句子里夹着 Key 不拦,DSH 的掩码只改显示,模型仍会收到。- - 拦着的时候 Key 只在这个页面里:点了〔检查并保存〕才交给 Host 的 `provider-key`;点了〔当普通消息发送〕,它就和别的消息一样进对话记录、发给模型。但 DSH 本来就把每个会话的输入稿存在浏览器的 localStorage 里(`dsh.conversation.<会话>`;桌面应用里在 `%APPDATA%\DeepSeek Bot` 下,DSH Web 里在用户的浏览器配置里),挂着 block 的这段时间 Key 也在那里,重开后还在,直到输入稿被清掉。++ - 拦着的时候 Key 只在这个页面里:点了〔检查并保存〕才交给 Host 的 `provider-key`;点了〔当普通消息发送〕,它就和别的消息一样进对话记录、发给模型。但 DSH 本来就把每个会话的输入稿存在浏览器的 localStorage 里(`dsh.conversation.<会话>`;桌面应用里在 `%APPDATA%\DS Bot` 下,DSH Web 里在用户的浏览器配置里),挂着 block 的这段时间 Key 也在那里,重开后还在,直到输入稿被清掉。+- **账号余额为零**(登录后):「已登录 DeepSeek 账号,但余额是 ¥0.00。充值后我就能开始;一般一轮对话只要{实测值},以 DeepSeek 价格页为准。」〔去充值 ↗〕〔再查一次余额〕〔换一种方式〕。key 余额为零时用上面「粘贴 key」里的卡片。这两张卡显示期间,窗口回到前台时、以及每 10 秒(最多 10 分钟)自动重查,余额一到就自己往下走。+- **自动选模型**(插件形态里是否也这样待定):只有一个提供商能用时,不再让用户选,直接用 DSH 默认模型(能用的话),否则用这个提供商的第一个模型。选之前先确认能用:有不调用模型的检查就用它(账号余额、`/user/balance`;后者是否计费没有文档),没有就发一次 8 token 的试连。通过后卡片收成一行「已接上 DeepSeek-V4.1-Flash · DeepSeek 账号 更换」,随即是 Main Bot 固定的开场白,不调用模型(第 6 节)。这次检查照旧要做:开场白不再用到模型,但检查也挡着 Main Bot 的第一个正常回合。两个以上提供商能用时,仍按提供商分组让用户选,DSH 默认模型标「推荐」。+- 登录 DeepSeek 账号后,DSH 的账号前端会尽力把账号模型存成默认,但这一步不保证完成、也不保证先于我们,所以只剩账号这一个提供商时,DS Bot 自己选账号的第一个模型,不等 DSH。+- 开场白只在确认能用之后才发。聊天记录不会以一行红字开头。+- 没有能用的模型、且模型列表已知时,Bot 聊天的输入框不可用,占位写「先在上面接上模型,我就能回复你」(DSH 有文档的 `ComposerBlocks`)。+- 万一消息在接上模型前就发出去了(比如别的入口),开场白不再被删掉:Main Bot 接上模型后先回答这条消息,再用一句话说明自己是管团队的(模型写的,和今天一样)。这是它的第一个正常回合,用原来的工具,不算在第 6 节上手的 3 次请求里;会话里已经有用户自己发的消息,上手算结束(第 8 节),不再出固定的开场白和目标卡。+- 判断「能用」:catalog 里标了 `needsKey` 的模型不算能用。Host 的默认模型(`pickDefault`、`defaultModel`、`cachedDefault`)、建 Bot、`create_bot` 不指定模型时的回退、模型不再被服务时 `desiredModel` 和 `memory.js` 里的回退、模型菜单(`ModelRows`)和选模型卡片,都只从能用的模型里挑。需要 key 的模型在列表里显示「需要 API Key」,点它打开 key 卡片。+- `needsKey` 只覆盖「profile 写了 `apiKeyEnv`、而凭据未配置」的提供商;DeepSeek 账号这类登录式的提供商永远不会标 `needsKey`,没登录时也在列表里。所以「能用」最终以上面的检查为准,`needsKey` 只是第一道过滤。+- 提供商的显示名:`deepseek-account` 显示「DeepSeek 账号」,`deepseek-official` 显示「DeepSeek API」。中文统一用「提供商」(替换 `i18n.js` 里的「服务商」)。++### 6. 第一条有用的回复++新团队(不是导入来的)接上模型以后,Main Bot 的聊天里先走两步引导,再做第一件事。每一步都是插件画的卡,答完留在聊天里:控件变灰,选过的保持高亮。每张卡都有「跳过设置,直接开始」,点了就结束上手。输入框锁着(`ComposerBlock`,占位「先在上面的卡片里回答」),到上手结束、或者点了第一件事卡的「自己说…」才打开。导入来的团队不走这些,它们是第 4 节的「复制好了」卡和模型检查。+- - **开场白**:设置卡收成「已接上 DeepSeek-V4.1-Flash · DeepSeek 账号 更换」那一行后,Main Bot 发一段界面语言的固定文字「你好,我是{名字},负责你的 Bot 团队。想先让我做点什么?在下面选,或者用自己的话说。」,不调用模型:开场白照旧作为一个回合送进 Main Bot 的会话,插件在它的 `llm/stream` 监听里直接回这段文字,和今天换段时回 `HANDOFF_ACK` 一样。下面照旧一行「工作文件夹:`C:\Users\<用户名>\DeepSeek Bot` 更换」。设置卡收成一行后约 420 ms 是开场白,约 900 ms 是目标卡。++- **开场白**:设置卡收成「已接上 DeepSeek-V4.1-Flash · DeepSeek 账号 更换」那一行后,Main Bot 发一段界面语言的固定文字「你好,我是{名字},负责你的 Bot 团队。想先让我做点什么?在下面选,或者用自己的话说。」,不调用模型:开场白照旧作为一个回合送进 Main Bot 的会话,插件在它的 `llm/stream` 监听里直接回这段文字,和今天换段时回 `HANDOFF_ACK` 一样。下面照旧一行「工作文件夹:`C:\Users\<用户名>\DS Bot` 更换」。设置卡收成一行后约 420 ms 是开场白,约 900 ms 是目标卡。+- **目标卡**:标题「最想让团队先帮你做什么?」,同一行一个灰色的「可以多选」。+ - 四个选项〔写东西:文章、周报、文案〕〔写代码、改程序〕〔查资料、做调研〕〔日常杂事:日程、邮件、整理〕是开关按钮(`aria-pressed`,在标签为「想先做什么,可以多选」的一组里):点一下选中,再点取消,几个都可以选中;选中的带对勾,不只靠颜色。+ - 一个输入框「用自己的话说…」。+ - 〔确定〕是卡上唯一的主按钮,选中至少一个选项、或者输入框里有字时才能点;在输入框里按 Enter 就是〔确定〕,输入法正在组字时不算。+ - 〔跳过〕:不建 Bot,直接出第一件事卡,上面是原来「试试:」的三个固定任务「你能帮我做什么?」「帮我建一个写周报的 Bot」「搜一下今天的科技新闻,挑 5 条讲给我」。这三件事不需要读文件、跑命令或日历权限,不依赖模型自己出题。+ - 答完后选中的选项保持高亮,所有控件变灰,输入框里的字留着;点的是〔跳过〕或「跳过设置,直接开始」时,没有一个选项算选中。+ - 只选了选项:不调用模型,马上出现成的建议(每个目标一组,写在代码里)。+ - 输入框里有字(选没选选项都一样):调用一次模型。这是一次不带工具的 JSON 调用,和上下文管家的 `askSteward` 同一种形态(固定的提示词,没有 `tools`,经 `ctx.llm.stream`,只回 JSON);这次调用自己的上限是 `maxTokens` 700、12 秒超时,回答按闭合的 schema 校验,不合就当没有回应。schema 里是 `goal`(`write`、`code`、`research`、`daily`、`general` 之一:四个选项各一个,再加通用的那一组)、一句不超过 18 个字的摘要、最多 3 个 Bot 草案(名字、角色、理由)和最多 3 个第一件事(各带它的草案序号)。+ - 输入框里整段是一个 Key 时(规则同第 5 节「在聊天里粘了 Key 也认」),〔确定〕不调用模型,目标卡下面出第 5 节那张卡(按状态选文案和按钮,没有〔当普通消息发送〕和「改一下」);保存或〔清掉〕之后输入框清空,目标卡等用户重新回答。输入框照样能改,只要整段还是一个 Key,〔确定〕就不调用模型。+- **合并**:选中的目标按卡上的顺序排,不按点的先后。有文字时,文字的那一组是模型的草案,它属于哪个目标看模型返回的 `goal`(模型没有回应时,文字按关键词对上一组现成的,见下面「模型不可用时」):`goal` 是所选目标之一时,那一组换成模型的草案,位置不变;是所选以外的目标时加在后面;是通用的、又选了选项时不加(只有文字时就用文字的那一组,通用的也算)。只有一个目标时就是它那一组。几个目标时 Bot 轮流取:先取每组的第一个,再取每组的第二个,以此类推,同名的只留一个,最多 5 个;第一件事是留下的每个 Bot 自己的任务(模型给的任务按它带的草案序号归到 Bot),按 Bot 的顺序,最多 3 个。摘要里每个目标是一个词(写东西 / 写代码 / 查资料 / 处理日常杂事,词里不带「、」),几个目标用「、」连起来;引号里是用户自己的话,超过 18 个字时换成模型给的那句摘要:+ - 只有选项:「想先写东西、查资料:建议建这 N 个 Bot,名字可以直接改。」+ - 选项加文字:「想先写东西,还说了「查一下竞品」:建议建这 N 个 Bot,名字可以直接改。」+ - 只有文字:「按你说的「…」,建议建这 N 个 Bot,名字可以直接改。」+- **建议卡**:摘要下面每个 Bot 一行:勾选框、它的鲸鱼(各用一种颜色)、可以改的名字(最多 12 个字)、角色标签(最多四个字)、一句理由。+ - 〔建这 N 个 Bot〕是主按钮,N 跟着勾选变,一个都没勾时不能点;〔只要{第一个名字}〕的名字跟着第一行的名字变。+ - 〔换一组建议〕:再调用一次模型(同样的调用和 schema),提示词里带上所选目标、用户的话和已经给过的草案,要一组不重复的,换掉卡上的几行,摘要写「换一组:建议建这 N 个 Bot,名字可以直接改。」。目标卡和建议卡合计最多 3 次请求,到了这个按钮就变灰,旁边写「已到上限」;两张卡底部都写着「模型请求 n/3」。+ - 「跳过设置,直接开始」。+- **建 Bot 和第一件事**:点〔建…〕才真的建,这些 Bot 用改过的名字一个个出现在侧栏里 Main Bot 的下面。它们不发模型写的招呼:每个 Bot 的聊天里先是一段固定文字,它的名字加建议卡上那一行的理由(如「你好,我是笔杆。起草文章、周报和文案,照你的口吻改稿。」),和 Main Bot 的开场白一样在 `llm/stream` 监听里回,所以〔建…〕不花一次请求。然后是第一件事卡「第一件事做什么?」:建议里的三个任务,写着用户起的名字(勾掉了 Bot、任务不够三个时,用上面三个固定任务补满),外加「自己说…」(打开输入框,焦点放进去)。点任务等于用户自己发这句话。第一件事(点的任务,或者「自己说…」之后发出的第一条消息)一发出,插件就调用 `restrict` 返回的解除函数、撤掉 guard:它是 Main Bot 的第一个正常回合,用原来的工具,不算在 3 次请求里,也不受下面每一步的 token 和时限。它回复以后,聊天里出现一行灰字「上手结束:{名字}的工具不再受限」,输入框打开。「跳过设置,直接开始」直接解除限制、出这行灰字、打开输入框。+- **模型不可用时**:选项照样给现成的建议。输入框里有字时,建议卡上面写「模型暂时没有回应。先用现成的建议,或者直接开始。」,下面是现成的建议(文字按关键词对上一组现成的,再照上面的规则合并),摘要只写「建议建这 N 个 Bot,名字可以直接改。」;〔换一组建议〕没有回应时显示同一句,原来的几行不变,这次请求照样计数。第一件事的回复失败时,就是下面的修复卡。+- **深度限制是机制,不是提示词**:+ - 步骤表写在代码里,Host 按卡片的回答往下走,模型从不选下一步。+ - 上手期间(开场白到第一件事发出之前),第一个 Main Bot 的会话用 `agent.ctx.tools.restrict({ allow })` 只留 `ask_user` 和输入稿模式的 `create_bot`(只出草案,用户点了才建),`tools.guard` 限制每一步的调用次数,超了就拒绝、要它直接回答。第一件事一发出就解除(上面)。+ - 每一步(每次按〔确定〕或〔换一组建议〕)最多一次请求,输出 400 到 700 token(`maxTokens` 700):8 秒内没有第一个字、或者 12 秒还没回完,就出这一步的兜底卡。上手期间 Main Bot 的会话里万一跑起一个回合(输入框锁着,只能来自别的入口),它也只有一次请求,8 秒内要有第一个字,整轮 20 秒内完成,否则同样出兜底卡。整个上手最多 3 次请求,就是卡上的「模型请求 n/3」;第一件事不算在里面,它发出时限制已经解除。+ - 每一步都有一张模型关着也能走通的卡。CI 用 mock 模型跑这几种情况:正常、断网、来回循环、答非所问、编造模型名、401、余额为零、把 Key 粘进目标卡的输入框。+- Bot 聊天里任何一轮失败,都由插件画一个修复卡,替换 DSH 的「本轮运行失败」那一行(DSH Agent 的普通会话不变)。原文、代码、HTTP 状态码和 request id 放在「技术详情」里,可以复制;AUTH 的原文照旧不显示。++| 代码 | 卡片 | 按钮 |+|---|---|---|+| MISSING_CREDENTIAL | 「{名字} 用的模型还没有 API Key。」 | 填入 API Key / 用 DeepSeek 账号登录 / 换个模型 |+| INVALID_CREDENTIAL | 「这个 API Key 的格式不对。」 | 重新填 Key / 换个模型 |+| AUTH | 「{提供商} 不接受现在的 API Key({状态码})。」 | 重新填 Key / 改用账号登录 / 换个模型 |+| QUOTA | 「{提供商} 的余额或额度不够了({状态码})。」 | 去充值 ↗(只有 DeepSeek 官方时)/ 重试 |+| ACCOUNT_QUOTA | 「DeepSeek 账号余额不足。」 | 去充值 ↗ / 重试 |+| ACCOUNT_SIGN_IN_REQUIRED、ACCOUNT_SIGNED_OUT、ACCOUNT_TOKEN_INVALID | 「DeepSeek 账号的登录失效了。」 | 重新登录 |+| TRANSPORT、TIMEOUT | 「连不上模型服务。」在用系统代理时加一句「现在走的是系统代理 127.0.0.1:7890:如果代理软件没开,打开它,或者在 设置 → 通用 → 网络 里关掉「跟随系统代理」。」 | 重试 |+| RATE_LIMIT | 「请求太频繁,稍等一会儿再试。」 | 重试 |+| SERVER | 「模型服务出错了。」 | 重试 |+| 其他 | 现有的简短说明 | 重试 |++- 卡片按失败代码选,不看原文(DSH 也是按代码分流的,原文和 `failureMessage` 都是它的内部细节)。提供商名字和状态码取自这次失败的路由和 HTTP 状态,不写死「402」或「DeepSeek」:QUOTA 也可能来自别的状态码和别的提供商。`noteTurnFailure` 今天只把状态码和 request id 写进诊断日志,要新增到 Bot 的状态里(`bot.blocked`),经 `api/bot` 给卡片读。+- 「重试」让 Bot 接着做,不会把用户的话再发一遍。充值回来后自动重查余额,并接着做。+- Bot 的招呼(第一个 Main Bot 的固定开场白和建议卡建的 Bot 的固定招呼除外,它们不调用模型)因为凭据或余额失败时,重新留着,下一次检查通过时再发。++### 7. 第一个小时++- **命令沙盒启动不了命令**(#523,`exit code 3221225794`,DSH 的问题):工具结果下面显示「这台电脑上,DeepSeek Harness 的沙盒启动不了命令(错误 0xC0000142),不是命令本身的问题。可以给 {名字}「完全权限」,或者在它请求时批准单条命令。」〔打开 {名字} 的权限设置〕〔先不改〕。给完全权限照旧要二次确认、照旧标红。Bot 也会收到一条说明,改为请求批准,而不是盲目重试。+- 没有装 PowerShell 7 的 Windows 上,提示词里写明命令跑在 Windows PowerShell 5.1:不能用 `&&` 和 `||`。+- **系统代理**(仅桌面应用;默认开待定):用户自己没设 `http_proxy` / `https_proxy` / `all_proxy`(任何大小写)、数据位置的 `.env` 里也没有时,应用用 `session.resolveProxy` 读 Windows 系统代理,作为启动环境传给引擎。- - `resolveProxy` 返回的是 Chromium 的 PAC 结果列表(`;` 分隔,可能有 `PROXY`、`HTTPS`、`SOCKS`、`DIRECT`):按顺序取第一个可用项,遇到 `DIRECT` 就停;`PROXY h:p` 写成 `http://h:p`,`HTTPS h:p` 写成 `https://h:p`,一律带协议(DSH 不认没有协议的 `h:p`);SOCKS 跳过(DSH 也不支持),相关提示改为「系统代理是 SOCKS 类型,DeepSeek Bot 用不了;请在代理软件里打开 HTTP 端口,或设置 https_proxy」。++ - `resolveProxy` 返回的是 Chromium 的 PAC 结果列表(`;` 分隔,可能有 `PROXY`、`HTTPS`、`SOCKS`、`DIRECT`):按顺序取第一个可用项,遇到 `DIRECT` 就停;`PROXY h:p` 写成 `http://h:p`,`HTTPS h:p` 写成 `https://h:p`,一律带协议(DSH 不认没有协议的 `h:p`);SOCKS 跳过(DSH 也不支持),相关提示改为「系统代理是 SOCKS 类型,DS Bot 用不了;请在代理软件里打开 HTTP 端口,或设置 https_proxy」。+ - 不设 `NO_PROXY`:DSH 自己会让本机地址直连,而 Windows 上同名不同大小写的环境变量只会传一个,设了反而可能盖掉用户的 `no_proxy`。PAC 可能对不同主机给出不同答案,按 `api.deepseek.com` 解析只是近似。+ - 代理变量只放在启动环境里,绝不写进 profile 文件夹的 `.env`(DSH 会拒绝那里出现代理变量)。应用自己的更新下载走 Chromium 网络栈,本来就跟随系统代理,不受这项影响。+ - 设置 → 通用 → 网络里有开关「跟随系统代理」,打开时旁边显示现在的系统代理(如 127.0.0.1:7890)。「连不上 GitHub」加一句代理提示。+ - 验证 `NODE_USE_SYSTEM_CA` 在 `ELECTRON_RUN_AS_NODE` 下有效后,才在引擎的启动环境里设它;验证不了就不设。+- 冷启动时 Bot 列表不会是空的(#559):第一次挂载后检查团队侧栏是否真的出来了,没有就重新挂载一次;「回到 Main Bot」的逻辑移出 `TeamSidebar`。+- Bot 还在干活时关窗口,先问「有 2 个 Bot 还在工作,关闭窗口会让它们停下。」〔仍然关闭〕〔取消〕(#500)。+- 鲸鱼菜单增加「模型和 API Key」,以及未登录时的「登录 DeepSeek 账号」。桌面应用里「切换经典 Agent 模式」只放在 设置 → 通用。++### 8. 以后的启动和回头入口++- 以后每次启动也显示启动页:64 px 的鲸鱼和「正在打开你的团队…」,没有水线和圈,也没有第 3 节鲸鱼的话和提示;10 秒起显示「已用 N 秒」,45 秒「比平时慢,请再等一会儿」〔打开日志文件夹〕,180 秒和首次启动一样([启动窗口](2026-10-26-start-window.md) 第 5 节)。然后打开上次的 Bot(预计 3 到 12 秒,以后的启动还没实测)。+- 设置卡由状态决定:没有能用的模型(跳过过、删了 key、退出了登录),Main Bot 的设置卡就回来;账号登录过期时显示「DeepSeek 账号的登录失效了。」〔重新登录〕(桌面应用里同样在登录窗口里登录)。+- 目标卡、建议卡和第一件事卡(第 6 节)只在新团队接上模型、上手还没结束时出现。上手结束看 Main Bot 的会话:里面有那行「上手结束」的灰字、或者有用户自己发的消息(第一件事也是),就算结束,从会话里读,不另存标记;结束以后它们不再回来,设置卡回来时也不带它们。上手中途关了应用、或者模型没了:重开或重新接上模型后从目标卡重新开始,开场白不再发,已经建好的 Bot 留着,`restrict` 和 guard 重新挂上(它们只在内存里),「模型请求 n/3」从 0 算起。导入来的团队从来不出。+- DS Bot 设置 → 模型在所有形态里都有(在 `team-actions.js` 里接上插件 Host 已有的 `providers`、`provider-key` 等接口,今天只有停用的 `app/ui` 接了),显示每个提供商的 key 状态(「已设置 Key」「需要 API Key」「Key 来自 DS Bot 之外」)和「添加提供商」。原来的「Harness 设置」改叫「高级设置(DeepSeek Harness)」。+- 要打开 DSH 自己的模型页时(「高级设置」里的模型、鲸鱼菜单的「模型和 API Key」在没有 DS Bot 模型页时),直接落在「模型」上,不再落在「通用设置」:插件注册一个自己的 `settings.onboarding` 步骤,自动检查时立刻完成、什么也不画;被 `openOnboarding(id)` 明确打开时调用 DSH 交给步骤的 `openSection('models')` 再完成。这些都是 DSH 有文档的接口。- - 设置 → 通用 → 位置(桌面应用):「位置」一行显示数据文件夹和总工作区,各有〔打开〕,一个〔移到…〕把两个一起搬到新的根 `R` 下面的 `data` 和 `workspace`(定根和首次启动同一条规则)。搬是搬,旧位置不留副本。确认写明会搬什么、删什么:「会把数据和工作文件搬到 `D:\DeepSeek Bot`。搬完后 `C:\Users\<用户名>\.ds-bot` 和 `C:\Users\<用户名>\DeepSeek Bot` 会删除。」〔搬过去〕〔取消〕。搬之前先查目标卷的剩余空间(不同的卷要「数据 + 要搬的工作文件 + 1 GB」),不够就在确认里说清差多少,不动手。- - 只搬应用自己建的文件夹。数据文件夹看 `.deepseek-bot` 标记;总工作区没有标记,应用建它时(默认的 `~\DeepSeek Bot`、`R\workspace`)在 `locations.json` 里记一笔 `workspaceCreated`。用户自己挑的现成文件夹(老版本允许过的 `D:\`、`D:\Projects`,「高级」里设的)不搬也不删:团队改用 `R\workspace`,旧文件夹原样留下,设置里写「旧的工作文件夹 `D:\Projects` 原样保留」。没有标记的数据文件夹按卸载的清单逐条搬(同一个卷逐条改名,不同的卷逐条复制再删),清单外的东西不动,`R` 不能在清单里的条目里面。++- 设置 → 通用 → 位置(桌面应用):「位置」一行显示数据文件夹和总工作区,各有〔打开〕,一个〔移到…〕把两个一起搬到新的根 `R` 下面的 `data` 和 `workspace`(定根和首次启动同一条规则)。搬是搬,旧位置不留副本。确认写明会搬什么、删什么:「会把数据和工作文件搬到 `D:\DS Bot`。搬完后 `C:\Users\<用户名>\.ds-bot` 和 `C:\Users\<用户名>\DS Bot` 会删除。」〔搬过去〕〔取消〕。搬之前先查目标卷的剩余空间(不同的卷要「数据 + 要搬的工作文件 + 1 GB」),不够就在确认里说清差多少,不动手。++ - 只搬应用自己建的文件夹。数据文件夹看 `.deepseek-bot` 标记;总工作区没有标记,应用建它时(默认的 `~\DS Bot`、`R\workspace`)在 `locations.json` 里记一笔 `workspaceCreated`。用户自己挑的现成文件夹(老版本允许过的 `D:\`、`D:\Projects`,「高级」里设的)不搬也不删:团队改用 `R\workspace`,旧文件夹原样留下,设置里写「旧的工作文件夹 `D:\Projects` 原样保留」。没有标记的数据文件夹按卸载的清单逐条搬(同一个卷逐条改名,不同的卷逐条复制再删),清单外的东西不动,`R` 不能在清单里的条目里面。+ - 先在 `%APPDATA%` 写一份「搬到一半」的记录(从哪、到哪、改名还是复制、到了哪一步),再停引擎。同一个卷上,数据文件夹和总工作区各自改名过去,不复制、不多占、立刻完成;改名失败(文件夹被资源管理器或编辑器开着)就退回到复制那一支。不同的卷上,数据经暂存复制到 `R\data`。两种情况都在副本的 `bot/state.json` 里删掉 `workspaceId`(和导入一样)。重开的进程按这份记录在新位置启动,`DS_BOT_WORKSPACE` 指向 `R\workspace`,插件在下一个回合登记它,用总工作区的 Bot 和群照常换段;新引擎 `ready` 之后才写 `locations.json`,然后删掉旧的数据文件夹(复制那一支;有标记整个删,没标记只删清单里的条目),记录转成「总工作区还在搬」。没到 `ready`、或者中途被杀掉:下次启动按记录退回,改名的改回去,复制的删掉应用自己建的 `R\data`,再在原来的位置启动,记录删掉。恢复页的〔换个位置…〕走同一套。+ - 总工作区里的文件在重开后由应用后台搬到 `R\workspace`(和导入的第二段同一套,记录在 `bot/work-files.json`):每个文件先进同卷暂存、硬链接落位,落位成功、原件的大小和修改时间没变就删掉原件(链接只删链接本身,不跟进去);新位置已经有同名文件的跳过,留在原处;Bot 或群自己设的文件夹在旧总工作区里面时,那棵子树不搬,照旧归它们;扫描之后才写进旧文件夹的文件不在清单里,留着。最后删掉空的文件夹。设置里写「旧文件夹里只剩 3 个没搬过来的文件(新位置已经有同名文件)」〔打开旧文件夹〕。「高级」里才能单独换其中一个,换总工作区照旧不用重启。+ - `~/.dsh` 有团队时有「从 DeepSeek Harness 复制团队…」:复制到一个新的数据文件夹(现在的旁边,名字加序号,先过第 4 节第一段的空间检查),现在的团队不删:只有一个没说过话的空白 Main Bot 时,`ready` 之后删掉它;有用户的对话就留着,「位置」里多一行「以前的团队还在 `C:\Users\<用户名>\.ds-bot`(0.8 GB)」〔切回〕〔打开文件夹〕〔删除…〕,也记进 `locations.ini`,卸载时选「是」能按同一张清单清掉它。导入过的另显示 DeepSeek Harness 原团队的位置和大小(第 4 节);工作文件还在后台复制时显示进度和〔停止〕,停过或没复制完的显示「工作文件还有 384 个没复制」〔继续复制〕;还有标红、要点两次的「用新的空白团队开始…」(在新文件夹新建,现在的数据同样留着,列在「以前的团队」里)。只有〔移到…〕和恢复页的〔换个位置…〕删旧的;复制团队和空白团队都在新文件夹里完成,新引擎 `ready` 之后才切换 `locations.json`,失败就继续用原来的,不需要恢复。- - 设置 → 关于:下载更新时显示百分比和大小(「正在下载 0.2.4(37%,78/212 MB)」),「下载失败」和「没能检查更新」分开,各带〔重试〕〔手动下载〕;「保存诊断信息…」把诊断表和日志最后 200 行存成一个 .txt(默认放桌面),报问题不需要能上 GitHub。反馈页里形态显示为「DeepSeek Bot 应用」(今天会误报成 DSH Web)。++- 设置 → 关于:下载更新时显示百分比和大小(「正在下载 0.2.4(37%,78/212 MB)」),「下载失败」和「没能检查更新」分开,各带〔重试〕〔手动下载〕;「保存诊断信息…」把诊断表和日志最后 200 行存成一个 .txt(默认放桌面),报问题不需要能上 GitHub。反馈页里形态显示为「DS Bot 应用」(今天会误报成 DSH Web)。+- **更新**:更新器随应用启动(不再等导入结束),首次启动和导入期间不弹重启提示。中文界面或中国时区先试镜像、再试 GitHub,其他情况反过来,记住上次能用的源。60 秒没有收到数据的下载会取消并换源;两个都失败时显示「没能检查更新:连不上更新服务器。」〔重试〕〔手动下载〕,不阻塞任何东西。++### 9. 卸载和重置+- - 卸载时先是 NSIS 的「确定要卸载吗」,然后只多问一个问题,默认「否」:「要同时删除 DeepSeek Bot 的数据吗?会删掉对话、Bot、记忆、API Key 和登录信息:{数据位置},以及 {壳数据}。数据文件夹是 DeepSeek Bot 新建的,会整个删除;否则只删除 DeepSeek Bot 自己的文件。不会删除 Bot 的工作文件夹 {总工作区}(里面是你的文件)。选「否」会全部保留,重新安装后接着用。」- - 选「是」:数据文件夹有 `.deepseek-bot` 标记就整个删掉;没有标记(老版本装的,或者老版首次启动允许过的 `D:\`、非空文件夹)就只删应用和 DSH 自己的条目(`bot`、`profiles`、`sessions`、`attachments`、`storages`、`.anonymous-user-id`、`.credentials.yaml`、`.env`、`.import-*`、`.import-check-*`),删完是空文件夹才删文件夹本身。换数据位置的暂存在数据文件夹旁边(`.<文件夹名>.moving-*`),不在里面。磁盘根目录、家目录和总工作区永远不删。再删 `%APPDATA%\DeepSeek Bot` 和 `%LOCALAPPDATA%\deepseek-bot-updater`。++- 卸载时先是 NSIS 的「确定要卸载吗」,然后只多问一个问题,默认「否」:「要同时删除 DS Bot 的数据吗?会删掉对话、Bot、记忆、API Key 和登录信息:{数据位置},以及 {壳数据}。数据文件夹是 DS Bot 新建的,会整个删除;否则只删除 DS Bot 自己的文件。不会删除 Bot 的工作文件夹 {总工作区}(里面是你的文件)。选「否」会全部保留,重新安装后接着用。」++- 选「是」:数据文件夹有 `.deepseek-bot` 标记就整个删掉;没有标记(老版本装的,或者老版首次启动允许过的 `D:\`、非空文件夹)就只删应用和 DSH 自己的条目(`bot`、`profiles`、`sessions`、`attachments`、`storages`、`.anonymous-user-id`、`.credentials.yaml`、`.env`、`.import-*`、`.import-check-*`),删完是空文件夹才删文件夹本身。换数据位置的暂存在数据文件夹旁边(`.<文件夹名>.moving-*`),不在里面。磁盘根目录、家目录和总工作区永远不删。再删 `%APPDATA%\DS Bot` 和 `%LOCALAPPDATA%\deepseek-bot-updater`。+- 静默卸载(`/S`,包括 winget)和更新时的卸载(旧卸载程序带 `/S --updated` 运行)不问、不删(CI 现有的「卸载后数据还在」检查照旧通过)。+- 一键安装模式下,卸载程序在 `customUnInit` 之前已经被设成静默,`${Silent}` 分不出用户的 `/S` 和正常卸载,所以真正起作用的是重新解析命令行里的 `/S` 和 `--updated`,有任一个就不问。提问用不带 `/SD` 的 MessageBox(带了在一键模式下就永远不显示),加 `MB_SETFOREGROUND`,因为这时没有卸载窗口可依附。提示文字用 LCID 1033 和 2052 定义自己的 LangString(`installer.nsh` 被包含时 `${LANG_ENGLISH}` 等常量还没定义)。模板顺序是 electron-builder 的内部细节,升级它时由 CI 的交互式卸载测试把关。+- README.md 和 README.zh.md 都增加「卸载和重置」一节,用 `%APPDATA%`、`%LOCALAPPDATA%`、`%USERPROFILE%` 写出 Windows 上的实际位置。++### 用词+- - 一个东西一个名字:DeepSeek Bot(应用)、DS Bot(项目和插件)、DeepSeek Harness(底层;界面里只在讲它本身时出现:导入和复制团队、设置卡里的现成 Key(那一行和「不能用」的提示)、它的沙盒问题、「高级设置(DeepSeek Harness)」)、本机引擎(启动页上对应用启动的 DSH 的叫法)、鲸鱼的话(启动页上鲸鱼下面那一行字,一次一句)、圈(鲸鱼离开一站后留在水线上的细线椭圆)、登录窗口(桌面应用里登录 DeepSeek 账号的子窗口)、目标卡、建议卡、第一件事卡(第 6 节上手的三张卡)、主 Bot(Main Bot)、群聊、总管(中文界面里第一个 Main Bot 的默认名字,待定)、模型、API Key、DeepSeek 账号、提供商、位置(设置项的名字,里面是数据文件夹和总工作区)、数据文件夹、总工作区。++- 一个东西一个名字:DS Bot(应用)、DS Bot(项目和插件)、DeepSeek Harness(底层;界面里只在讲它本身时出现:导入和复制团队、设置卡里的现成 Key(那一行和「不能用」的提示)、它的沙盒问题、「高级设置(DeepSeek Harness)」)、本机引擎(启动页上对应用启动的 DSH 的叫法)、鲸鱼的话(启动页上鲸鱼下面那一行字,一次一句)、圈(鲸鱼离开一站后留在水线上的细线椭圆)、登录窗口(桌面应用里登录 DeepSeek 账号的子窗口)、目标卡、建议卡、第一件事卡(第 6 节上手的三张卡)、主 Bot(Main Bot)、群聊、总管(中文界面里第一个 Main Bot 的默认名字,待定)、模型、API Key、DeepSeek 账号、提供商、位置(设置项的名字,里面是数据文件夹和总工作区)、数据文件夹、总工作区。+- 「输入稿」是输入框里还没发出的文字(DSH 叫 draft,`setDraft`)。+- 本文里「引擎」指桌面应用启动的 DSH 子进程,「引擎的页面」是它提供的网页前端;「Host」只指插件的 `ds-bot/src/host`。+- 第一次介绍产品的地方都写「不是 DeepSeek 官方产品」。- - README.md 和 README.zh.md 各加一行名词解释:DeepSeek Bot / DS Bot / DeepSeek Harness。++- README.md 和 README.zh.md 各加一行名词解释:DS Bot / DS Bot / DeepSeek Harness。+- 启动页和壳里系统对话框的字分哪几层、键怎么起、每层怎么写(标点、字数、… 的用法、英文对照),在 [启动页文案](2026-10-29-start-copy.md) 里定。+- 中文界面里用户能看到的英文,只允许专有名词(DeepSeek、DS Bot、Bot、API、Key、Harness、DSH、DSH Desktop、DSH Web、Agent、MCP、Windows、PowerShell、GitHub、SmartScreen、OneDrive、HTTP、SOCKS)、模型名、提供商名(如 OpenRouter)、用户自己起的名字(Bot、群聊)、文件名、路径、网址、环境变量名、Key 的格式和前八位(占位的「sk-…」、卡上的「sk-1a2b3…」)和单位(KB、MB、GB);「技术详情」和「详细信息」里的原文不算。测试会扫描。++## 改动的已定设计++| 原来的设计 | 现在 |+|---|---|+| [桌面应用](2026-10-16-desktop-app.md)「首次启动分别选数据位置和总工作区……用的是系统对话框」 | 窗口先出来,显示应用自己的启动页;默认位置直接用,只在需要时出卡片;换位置只选一个文件夹,按第 3 节定根 `R`,数据和总工作区一起放在 `R\data` 和 `R\workspace`;盘不够或默认位置不能用时先推荐一个固定盘,系统选择框只在「其他位置…」之后,只在应用改了所选路径时才确认 |+| 同上「两个位置不能一个在另一个里面」 | 保留;一个位置的两个子文件夹是兄弟,不互相包含 |+| 本文首稿 §3「找到以前的 DS Bot 数据……〔接着用(推荐)〕〔用新的空白团队开始…〕」 | 不问,直接接着用;空白团队在设置里 |+| 本文 2026-10-28 首稿 §3:首次启动不写路径,自己选位置只在推荐盘的卡上有「其他位置…」 | 启动页底注右边写「数据放在 C 盘(剩 412 GB)· 换个位置…」,随时能换;维护者 2026-10-28:「给出建议,同时提供自行选择的接口,避免小弹窗」 |+| 本文首稿「不做什么」:不扫描 D: 到 Z: 去推荐数据位置 | 只在盘不够或默认位置不能用时枚举一次固定盘,可移动盘、网络盘和光驱仍然一概不碰 |+| 本文首稿 §3「OneDrive 里的总工作区只提醒,不拒绝」 | 一个位置之下总工作区和数据是兄弟,位置在 OneDrive 里就整个不能用,首次启动不再有这张提醒卡 |- | 同上 换数据位置「选一个空文件夹或新文件夹……也不能选整个磁盘」 | 选磁盘根目录或别人的非空文件夹时,应用在里面加一层 `DeepSeek Bot`(第 3 节定根的规则),只在加了这一层时确认 |++| 同上 换数据位置「选一个空文件夹或新文件夹……也不能选整个磁盘」 | 选磁盘根目录或别人的非空文件夹时,应用在里面加一层 `DS Bot`(第 3 节定根的规则),只在加了这一层时确认 |+| 同上「结构」「窗口」:窗口加载引擎自己的本机地址 | 窗口先加载应用自己的启动页,引擎起来后再加载引擎的本机地址(同一个地址和端口) |+| 同上「首次启动没走完就退出时什么都不记」 | 保留;`locations.json` 和 `locations.ini` 改在引擎第一次 `ready` 之后才写;`.deepseek-bot` 标记在新建数据文件夹时就写,没走完留下的文件夹下次认得出 |+| 同上「问要不要导入,只在首次启动问一次」 | 首次启动仍然问,但只有一句话和两个按钮(预览、模型设置和勾选项折叠在「详细」里),卡片一出现就开始检查对话和预热引擎;之后在 设置 → 通用 → 位置 里随时可以复制到一个新的数据文件夹 |+| 同上「DSH 正在用这个团队时,请用户先关掉」 | 判断加上锁的刷新时间;自动重查,不用反复点重试 |+| 同上「旧团队工作文件夹里的文件复制到新的总工作区,不覆盖已有的文件」 | 仍然不覆盖;默认跳过可重新生成的文件夹;团队在对话复制完就打开,工作文件在团队打开后由应用后台复制,退出后下次接着,设置里能停和续 |+| 同上「几个 profile 都有时让用户选一份」 | 自动选,按提供商和默认模型显示,可以更换 |+| 同上 有新版本对话时按钮是「退出 / 不带团队开始」 | 能更新就「更新后再复制」;不能就以「先不带团队开始」为主 |+| 同上「模型服务商和 key 在 DSH 自己的设置里配」 | 在 Main Bot 的设置卡和 DS Bot 设置 → 模型里配(仍写进 DSH 的凭据和设置);应用关掉 DSH 的自动凭据引导;DSH 的模型页放在「高级设置(DeepSeek Harness)」 |+| 同上 变更 2026-10-20「DSH 打开的登录窗口交给系统浏览器」 | 桌面应用里登录页在应用自己建的登录窗口里打开(主窗口的子窗口,独立的不持久 partition,关窗就清掉,只允许 DeepSeek 的页面和引擎的回调);DSH 开的空白弹窗照旧允许、一直隐藏,只当它手里的句柄,两个窗口同生同灭;回调一回应就关掉;打不开或主框架要离开 DeepSeek 时才退回系统浏览器。DSH Desktop 和 DSH Web 不变 |+| 本文首稿 §5「点按钮就在系统浏览器打开 DeepSeek 登录页……登录完成后窗口自动回到前台」 | 同上;`dsBotApp.focus()` 只在退回系统浏览器时用 |+| 本文首稿 §3「`dsBotApp` 只新增 `ready()`……和 `focus()`……」 | 再加 `signIn`(`onClosed(原因, 代理)`、`close()`、`openOutside`)和 `foundKeys()` / `takeKey()`,以及主窗口露面的事件(待定),都只在引擎的页面上、只对主窗口的主框架暴露 |+| 同上「暂时不做」:DS Bot 自己的界面先停下 | `app/ui` 仍然停着;应用只画启动、导入、失败这几页,不画 Bot 界面 |+| 同上「改位置」:总工作区和数据位置各自更换,换总工作区时旧文件夹里的文件不动 | 「位置」一处〔移到…〕:停引擎,同一个卷上改名,不同的卷上数据经暂存复制到新位置、重启后总工作区的文件也后台复制过去(原来不复制),用总工作区的 Bot 和群在下一个回合换段;单独换其中一个在「高级」里;加「从 DeepSeek Harness 复制团队…」、后台复制工作文件的进度、〔停止〕和〔继续复制〕、「用新的空白团队开始…」 |+| 同上「换数据位置」:「旧数据文件夹原样保留,用户确认没问题后自己删」;「换总工作区」:旧文件夹和里面的文件不动 | 搬是搬,只搬应用自己建的文件夹:新引擎 `ready` 之后删掉旧的数据文件夹(和卸载同一张清单),工作文件逐个落位后删原件,只留跳过的;用户自己挑的现成文件夹原样保留,只是团队改用新的;「搬到一半」的记录让没搬完的退回;确认里写明会删什么。空间不再占两份 |+| 同上「换数据位置」里的「从 DeepSeek Harness 复制团队」和「用新的空白团队开始」 | 不删现在的团队(只有没说过话的空白 Main Bot 时除外),「位置」里列出「以前的团队」的路径和大小,能切回、打开、删除;记进 `locations.ini` |+| 同上「首次启动……先在新数据位置启动一次再复制」里的检查副本 `.import-check-<时间>` | 对话只复制一次:卡片一出现就复制进 `.import-<时间>` 暂存并在那里检查,答〔复制过来〕时接着用这份;附件从暂存改名进位 |+| 同上 Windows 安装向导,可以改程序位置 | 一键安装、装完自动打开(待定) |+| 同上「卸载不删数据位置」 | 卸载时问一次,默认不删 |+| 同上 更新检查在首次启动的导入之后开始;启动失败时错误框里提新版本 | 随应用启动;首次启动和导入时不弹重启;镜像优先;失败页里直接给更新 |+| 同上 不签名,SmartScreen 是已知限制 | 走签名(路线待定);签名前在下载页说明 |+| [Bot 运行配置](2026-10-10-bot-runtime.md)「团队的第一个 Main Bot 没有模型,等用户在它的聊天里选好再打招呼」 | 只有一个提供商能用时自动选,并在确认能用后再打招呼(招呼现在是固定文字,见下面开场白那一行);两个以上仍然让用户选 |+| 同上 已知限制「新 Bot 可能落到没配好密钥的模型上」(「怎么根治待维护者定」) | 按那里写的方向解决:默认只从能用的模型里选(`needsKey` 先过滤,再用检查确认),凭据失败回到设置卡或修复卡。那条限制里「DSH 不告诉插件哪个提供方已经配好了凭据」已经部分过时:DS Bot 现在能标出 `needsKey`,但「有 key」仍不等于「key 能用」 |+| `ds-bot/index.js` 默认 Main Bot「Chief / Chief of Staff」 | 中文界面下建团队时用「总管 / 团队负责人」(待定):看配置里有没有指定名字(`rt.config`,不看已经合并了英文默认值的 `rt.defaults`),没有时按第一次 `state` 请求带来的界面语言的主标签是不是 `zh` 决定;英文不变,已有团队不改 |+| 本文首稿 §3「标题「正在准备你的 Bot 团队…」,下面三个真实阶段,各带进度勾」 | 没有标题和三站的标记:鲸鱼停在哪一站就是到了哪一步,离开的站留一个圈;阶段名只给读屏(看不见的「启动进度」列表和朗读区);「已用 N 秒」5 秒起在右上方,一直留到「进去吧」 |+| 同上「只在第一次启动时,等待期间显示一段说明」(五段:产品是什么、下一步接模型、聊天和设置保存在这台电脑上、数据位置的小字、预览版说明的提醒),以及 10 秒「第一次启动会慢一些……」、45 秒「比平时慢……」两句 | 一次一句鲸鱼的话,提示行只说接下来要准备什么:接模型缩成「待会儿要接一个模型:DeepSeek 账号或 API Key」,预览版说明缩成「里面先有一页说明,点「继续」就行」;产品介绍、「聊天和设置保存在这台电脑上」和数据位置的小字去掉(位置在 设置 → 通用 → 位置 里看和改,「社区开源项目,不是 DeepSeek 官方产品」仍是每一屏的底注);10 秒「第一次会慢一点」,45 秒「有点久,可能是杀毒软件在查新文件」加〔打开日志文件夹〕 |+| 同上 重装时说明的小字「接着用上次的数据:6 个 Bot、2 个群聊(`C:\Users\<用户名>\.ds-bot`)。可以在 设置 → 通用 → 位置 里改。」 | 第 2 站的提示「上次的 6 个 Bot 和 2 个群聊都在」,不写路径 |+| 同上 180 秒「启动比平常慢很多。可以再等一会儿,或者重试。」 | 鲸鱼问「等太久了,要不要重试?」,卡片上只有〔继续等待〕〔重试〕〔打开日志文件夹〕,不再重复这句话 |+| 同上「窗口先出来……启动页和引擎的页面共用这个窗口」 | 启动页在单独的启动窗口里([启动窗口](2026-10-26-start-window.md) 第 1 节,待定,那里记过这一行);启动窗口整个启动期间都是 720 × 540,只在交接时改一次大小,长成主窗口的矩形,主窗口在同一个矩形上露面(同上第 8 节):首次启动在就绪后约 1.6 秒可见(原来约 620 ms),以后的启动约 0.6 秒(原来 120 ms) |+| 本文首稿 §8「以后每次启动也显示启动页,只写「正在打开你的团队…」」 | 另外 10 秒起显示已用秒数,45 秒「比平时慢,请再等一会儿」〔打开日志文件夹〕,180 秒和首次启动一样([启动窗口](2026-10-26-start-window.md) 第 5 节,那里记过这一行);没有水线、圈和第 3 节鲸鱼的话 |- | 本文 第 3 节「团队界面没有加载出来。」、「会放在 `D:DeepSeek Bot`」〔继续〕〔重新选〕;第 4 节 更新版本那张卡的脚注「可以在 设置 → 通用 → 位置 里再复制。」;第 8 节「比平时慢,请再等一会儿。」 | 「团队界面没有加载出来」(鲸鱼那一行不加句号);「会放在 `D:DeepSeek Bot`。」〔继续〕〔重新选…〕(正文带句号,打开选择框的按钮带 …);「以后可以在 设置 → 通用 → 位置 里复制。」;「比平时慢,请再等一会儿」(提示行不加句号)。按 [启动页文案](2026-10-29-start-copy.md) 的层规则 |++| 本文 第 3 节「团队界面没有加载出来。」、「会放在 `D:DS Bot`」〔继续〕〔重新选〕;第 4 节 更新版本那张卡的脚注「可以在 设置 → 通用 → 位置 里再复制。」;第 8 节「比平时慢,请再等一会儿。」 | 「团队界面没有加载出来」(鲸鱼那一行不加句号);「会放在 `D:DS Bot`。」〔继续〕〔重新选…〕(正文带句号,打开选择框的按钮带 …);「以后可以在 设置 → 通用 → 位置 里复制。」;「比平时慢,请再等一会儿」(提示行不加句号)。按 [启动页文案](2026-10-29-start-copy.md) 的层规则 |+| 本文首稿 §5「通过后卡片收成一行……Main Bot 的开场白随即开始」;§6「开场白用界面语言(沿用现有的 kickoff),两句,以一个问题结尾」;[Bot 运行配置](2026-10-10-bot-runtime.md)「等用户在它的聊天里选好再打招呼」,招呼是一次模型调用 | 新团队第一个 Main Bot 的开场白是固定文字,不调用模型(插件在 `llm/stream` 监听里直接回,和 `HANDOFF_ACK` 一样),设置卡收成一行后约 900 ms 是目标卡;之前的余额检查或 8 token 试连照旧,它也挡着第一个正常回合;上手里从建议卡建的 Bot 的招呼也是固定文字,别的 Bot 的招呼照旧由模型写,修复卡里「开场白失败时重新留着」只管这些模型写的招呼 |+| 本文首稿 §6「试试:」三个固定按钮 | 新团队先是目标卡(四个可以多选的选项、自由输入、〔确定〕)和建议卡,再是第一件事卡;三个固定任务留作〔跳过〕之后的第一件事卡,以及勾掉 Bot 后补满第一件事卡。只选选项不调用模型,写了字才调用一次,整个上手最多 3 次请求;第一件事发出之前 Main Bot 的工具受限,步骤由卡片的回答推进 |++实现各批时,同步改写上面几份文档里对应的规则本身(「已定的行为」写现在的行为,不只是在末尾追加),并在它们的「变更」里写一条;新的 DSH 让步记进 [DSH 让步总账](2026-10-13-dsh-concessions.md),「提供商」记进 [UI 标准](../design/ui-standard.md) 第 11 节的术语表。++## 需要 DSH 提供的++不打补丁,以下向 DSH 提需求:++1. 给网页版的「预览版说明」一个有文档的关闭开关(和 `credentialOnboarding` 放在一起),供嵌入它的应用使用。+2. 修 Windows 沙盒在 Electron(`ELECTRON_RUN_AS_NODE`)里启动 pwsh 时的 `0xC0000142`(#523 有复现),并报一个有结构的错误码,不要只给退出码。+3. `MISSING_CREDENTIAL` 在聊天里显示本地化的一句话,不显示提供商路由和环境变量的原文;AUTH、QUOTA 的失败节点带上 HTTP 状态码(不带 key)。+4. 把 `settings.models.sign-in` 条目注入的操作(`start`、`cancel`、`showLogin`、`setOnboarding`、`refreshAccount`、`hooks.account` 等)和 `credentialOnboarding` 声明为跨版本稳定的插件接口,或者提供一个有文档的「开始 DeepSeek 登录、读余额」的客户端 API。+5. 一个不扣费、也不需要插件读回 key 的凭据检查(`ok / invalid / no-balance / unreachable`),并给模型页的 key 编辑框加上实时检查。+6. `listModels` 标出哪些模型的提供商还没有凭据(PR #316 的后续)。+7. 网页版余额不足的提示加一个充值按钮(今天在没有 `nativePlatform` 时只是一个 Toast);这条提示能按 Session 区分,或者让插件接管自己的 Session。+8. 登录完成页提示用户回到原来的应用;应用已经关掉、回调地址失效时给出清楚的提示。+9. 让 DSH 的代理跟随 Windows 系统代理(含 PAC),并考虑信任系统证书库。+10. `settings.launcher` 插槽能直接打开设置的某一节(比如「模型」)。今天可以借一个自己的 `settings.onboarding` 步骤绕一步做到(见第 8 节),有了这个接口就更简单。+11. `runProfile` 报告命名的启动阶段,供壳显示真实进度。+12. pwsh 工具的说明里写明实际是 Windows PowerShell 5.1 还是 PowerShell 7。+13. 发送前的一个有文档的钩子(或者让 `ComposerBlocks` 能带一张卡片),让插件能在一段只有 Key 的消息进对话记录之前拦下它;今天只能靠观察输入稿再挂 block,粘贴和 Enter 同一瞬间时拦不住。+14. 网页前端(或 Desktop 桥)提供「把授权页交给宿主自己的窗口打开」的方式;今天桌面应用只能接住网页前端 `window.open` 的 `about:blank`,再看它导去哪里。++## 分批上线++每批一个或几个小 PR,按「对用户的影响 ÷ 工作量」排序。签名申请和镜像试测最先开始,因为它们要等外部审批。++| 批次 | 内容 | 估计 |+|---|---|---|+| M1 去掉死路 | 应用:「下载」文件夹兜底;`credentialOnboarding: false`;`focusWindow` 在失败时也能聚焦;导入的锁判断、失败清理暂存、`room.id`(合 #567)、不覆盖已有 key。插件:在所有形态接上提供商接口(模型页和 key 卡片活过来);key 卡片加「去创建 Key」链接和余额说明;默认模型只从能用的里选;先打字不再删开场白;`bot.blocked` 和 Bot 聊天的修复卡,「重试」不重发;鲸鱼菜单加「模型和 API Key」「登录」;「高级设置」改名,DSH 设置直接落在「模型」页。文档和发版:README 双语下载区和信任说明、安装问题表单、Release 下载表、`SHA256SUMS` 和固定文件名(README 先链到 `releases/latest` 页面)、最后才标为 Latest | 约 4 人日 |+| M2 Main Bot 聊天里的第一条回复 | 设置卡:登录窗口(应用:接住 `about:blank` 并一直隐藏、拦下它的第一次导航、自己建的子窗口和不持久的 partition、关窗清掉 partition、只管主框架的允许名单、权限和下载一律拒绝、回调关窗(不看状态码)、两个窗口同生同灭、`onClosed` 带原因和代理(加载失败时由主进程 `resolveProxy` 取)、主框架加载失败时关窗并报 `failed`、窗口里的 `window.open` 分流、固定的标题和尺寸、交给浏览器时关窗、`openOutside`、日志不记地址;插件:按形态的按钮和文案、打不开时的卡(〔重试〕〔在浏览器里打开〕〔取消〕和系统代理的提示)、交给浏览器之后的卡、`onClosed('user')` 且还在等浏览器时 `cancel`、登录结束时 `close()`、修复卡和鲸鱼菜单那条路也一样)、退回时的回到前台(`dsBotApp.focus()`)、余额和赠送额度、充值后自动重查;现成的 Key 一键用(应用:`foundKeys()` / `takeKey()`,读 DeepSeek Harness 的家(`DSH_HOME` 或 `~\.dsh`)里的 `.credentials.yaml` 和 `.env`,那里设了别的 DeepSeek 地址时不出、设置卡期间读剪贴板(如果定下来)、主进程里比对两处的值;插件:一行一个主按钮、A 改次按钮、来源提示);粘贴 key 时的余额检查(mock 模型提供 `sk-test-ok` / `sk-test-bad` / `sk-test-empty`,另认三把 DeepSeek 格式的 Key:`sk-` 加 32 位十六进制,末四位 `0001` 的能用、`0401` 的报 401、`0000` 的余额为零;`sk-test-*` 不合掩码认 Key 的规则,剪贴板和聊天里粘贴的用例用这三把);聊天里粘贴的 Key(观察输入稿、和模型锁合算的一个 block、按状态选文案的卡、〔保存到提供商…〕打开填好 Key 的添加表单、〔填进那张卡〕、〔清掉〕和「改一下」、走输入框自己的 `submit()`);插件 Host 侧的「能用」检查和自动选模型;「已接上 · 更换」;输入框锁定;工作文件夹行;中文默认名字(如果定下来)。上手的后半段:固定的开场白(`llm/stream` 监听里直接回);目标卡(多选、〔确定〕、自由输入、〔跳过〕给三个固定任务)和合并;一次不带工具的 JSON 调用(固定提示词、带 `goal` 的闭合 schema、`maxTokens` 700、12 秒超时);目标卡输入框里的 Key;建议卡(勾选、改名、〔只要…〕、〔换一组建议〕和 3 次的上限、「模型请求 n/3」)、建 Bot(固定的招呼)、第一件事卡和上手结束的灰字;深度限制(Host 里的步骤表、`tools.restrict({ allow })` 只留 `ask_user` 和输入稿模式的 `create_bot`、第一件事发出时解除、`tools.guard` 限次数、每一步的 token 和时限、兜底卡);上手结束从会话里读、中途重开从目标卡重新开始。CI:loopback 上的假 DeepSeek 平台(DSH 的 `platformOrigin` 和 `allowLoopbackHttp`)驱动登录窗口,一次性用户的假 DSH 家和剪贴板替身;mock 模型跑上手的八种情况(正常、断网、来回循环、答非所问、编造模型名、401、余额为零、把 Key 粘进目标卡的输入框) | 约 13 人日(原来 8:目标卡、合并和 JSON 调用约 2,建议卡、建 Bot 和第一件事卡约 1.5,深度限制和兜底卡约 1,mock 模型的八种情况约 0.5) |+| M3 国内能下、一键安装、卸载说清楚 | 镜像发布和镜像优先的更新(随应用启动、首次启动和导入时不弹重启、可取消的下载、60 秒无数据换源、百分比);一键安装;卸载时的问题、`locations.ini`、标记文件;CI:一键升级覆盖旧的自定义目录、交互式卸载(UI Automation 答「否」和「是」)、固定链接检查;README 换成固定下载链接,加「卸载和重置」 | 约 5 人日 |+| M4 窗口先出来:启动页、卡片和恢复页 | 启动页(鲸鱼即进度:三站的位置和圈、一次一句鲸鱼的话和它的节奏、提示行、5 秒起的已用秒数、读屏的「启动进度」列表、卡片的第一句)、鲸鱼更有反应的八种动作(探身、呼吸、眨眼、回到窗口时看你、眼睛跟着键盘焦点、按下预备、活泼档越跳越稀、潜得更深)、它的 IPC 和来源检查、中英文案;`main.mjs` 重排;交接时启动窗口长成主窗口(主窗口先隐藏着建在最终的矩形上,主进程约 300 ms 里逐步 `setBounds`,主窗口在同一个矩形上露面,首次启动 2.5 秒的兜底)和侧栏磁贴上的鲸鱼(浮上来一次,设置卡驱动它的状态动作,第 5 节);位置检查、推荐盘、一个位置的布局和确认、重装不问;失败页和 180 秒的问题;日志;`dsBotApp.ready()` 和 20 秒界面检查;#559。CI:打包后的首次启动,用名为「测试 用户」、没有「下载」文件夹、没有 `~/.dsh` 的一次性用户,经 CDP 驱动启动页,逐个状态检查中英文在 720 × 540 和 720 × 500 下没有折行和截断,量交接的时间和中间尺寸,并检查日志里没有 key、token 和用户名 | 约 10 人日(原来 7:鲸鱼即进度的布局、话的节奏和读屏约 1,交接时窗口长大和兜底计时约 1,八种动作和磁贴上的鲸鱼约 1) |+| M5 启动页上的导入 | 一句话的导入卡和折叠的详情(预览、大小、可跳过的文件夹);卡片一出现就检查对话和预热引擎,「先不复制」不重启引擎;自动重查占用;新版本对话走「更新后再复制」;第一段的空间检查、进度和停止;工作文件在团队打开后后台复制,设置里的进度、停止、续复制;设置里的再次导入;导入后的检查卡和 Main Bot 提前换段(#384)。CI 用假的 `~/.dsh`(含 junction、新版本对话、PID 被重用的旧锁、群聊、大 `node_modules`) | 约 5 人日 |- | M6 第一个小时和回头入口 | 系统代理和网络设置;沙盒失败提示(#523);PowerShell 5.1 说明;GitHub 代理提示;关窗提醒(#500);保存诊断信息;「DeepSeek Bot 应用」形态;设置里「位置」一处〔移到…〕一起搬、「高级」里分开换;「用新的空白团队开始」 | 约 4 人日 |++| M6 第一个小时和回头入口 | 系统代理和网络设置;沙盒失败提示(#523);PowerShell 5.1 说明;GitHub 代理提示;关窗提醒(#500);保存诊断信息;「DS Bot 应用」形态;设置里「位置」一处〔移到…〕一起搬、「高级」里分开换;「用新的空白团队开始」 | 约 4 人日 |+| M7 签名 | 签名钩子、`publisherName`;README 的信任说明缩成杀毒软件一条;winget 清单 | 约 2–3 人日,加外部审批 |++## 验收++- 打包后的 Windows CI,用名为「测试 用户」、没有「下载」文件夹、没有 `~/.dsh` 的一次性用户:进程启动后 2 秒内窗口可见(目标 1 秒,CI 留余量);引擎的页面之前不出现任何卡片;能进到引擎的页面。+- 启动页(同一个 CI,中英文各一遍):首次启动没有标题、三站的标记和说明段落;鲸鱼的话按第 3 节的顺序出现,每句至少能读 300 ms 才被换掉,跳过的不补;提示行只在第 2、3 站有字(例外是盘不够时前 10 秒的「C 盘只剩 1.2 GB」和 45 秒的〔打开日志文件夹〕);「已用 N 秒」5 秒起出现;在 720 × 540 和 720 × 500 下没有一行字折行或被省略号截断,页面不能滚动;读屏的「启动进度」列表和朗读区照旧报阶段。+- 交接:首次启动 `handoffShow` 在鲸鱼停到第 3 站后 1.3 秒内(原型实测 1.09 到 1.17 秒);启动窗口在约 300 ms 里至少经过一个中间尺寸,长到主窗口的矩形;主窗口在鲸鱼停到第 3 站后 2 秒内可见,矩形和启动窗口长成的一样(`ready()` 到达时鲸鱼还在游的,这两个时间最多各晚 600 ms);页面不发 `handoffShow` 时,主进程在 `ready()` 后 2.5 秒自己显示主窗口(以后的启动 0.8 秒,重试或重新开始后庆祝的那次也是 2.5 秒);减少动态效果时窗口不长大,`handoffShow` 时主窗口直接出现。+- 首次启动期间没有一个 `dialog.show*` 不挂在主窗口上(单元测试扫描调用处),窗口出来之前没有系统对话框;位置和总工作区不问(没有「欢迎」对话框),系统选择框只在点了位置行的「换个位置…」以后出现,取消它什么都不变。- - 数据所在的盘不够 5 GB(CI 用替身的空间查询):只有一张卡片、一个主按钮,按 Enter 就过,不出现系统选择框。枚举盘的 PowerShell 只在盘不够或默认位置不能用时运行一次,正常启动和重装的日志里没有它;没有剩余 20 GB 以上的其他固定盘时不出卡片,提示行写剩余空间。〔放到 D 盘〕之后 `D:\DeepSeek Bot\data` 和 `D:\DeepSeek Bot\workspace` 都存在,`locations.json` 指向它们;〔仍然放在 C 盘〕之后 D 盘上没有留下试写建的文件夹。++- 数据所在的盘不够 5 GB(CI 用替身的空间查询):只有一张卡片、一个主按钮,按 Enter 就过,不出现系统选择框。枚举盘的 PowerShell 只在盘不够或默认位置不能用时运行一次,正常启动和重装的日志里没有它;没有剩余 20 GB 以上的其他固定盘时不出卡片,提示行写剩余空间。〔放到 D 盘〕之后 `D:\DS Bot\data` 和 `D:\DS Bot\workspace` 都存在,`locations.json` 指向它们;〔仍然放在 C 盘〕之后 D 盘上没有留下试写建的文件夹。+- 有 `~/.ds-bot` 团队、没有 `locations.json` 的一次性用户:没有卡片,C 盘不到 5 GB 时也没有,第 2 站的提示行写「上次的 N 个 Bot 和 N 个群聊都在」(数字是那个团队的),进去就是原来的团队。+- 导入:点〔复制过来〕后,对话复制完团队就打开,`bot/work-files.json` 记着工作文件没复制完;工作文件在后台到齐后记成已完成;复制一半退出再启动会接着复制,已有的文件一个不覆盖;〔先不复制〕不重启引擎,暂存已删。+- 空间只占一份(CI 用替身的空间查询和一个 2 GB 的假团队):整个导入过程中数据所在的盘最多少掉「第一段 + 500 MB」,没有 `.import-check-*` 文件夹,`~/.dsh` 的内容和修改时间一个都没变;工作文件复制完后新旧两处各一份,设置里显示原团队的位置和大小;剩余空间降到 500 MB 以下时后台复制停下,设置里有〔继续复制〕。导入卡开着、DSH 还占着团队时数据文件夹里没有 `.import-*`,锁放开后才出现;暂存期间锁刷新过,暂存会重做;导入卡开着时关窗、更新重开,下次启动前暂存已删。+- 〔移到…〕同一个卷:完成不超过 2 秒,旧路径不存在,数据没有被复制(inode 不变);改名失败时退回到复制;不同的卷:新引擎 `ready` 后旧数据文件夹被删,工作文件逐个落位后原件被删,复制完旧总工作区里只剩跳过的文件,数量和设置里写的一致;用户自己挑的总工作区一个文件都不动;新引擎没 `ready` 或中途被杀掉时,下次启动退回原位置,`R` 下面没有留下应用建的东西,`locations.json` 不变。+- mock 模型粘贴 `sk-test-ok`:第一个 Main Bot 的 Session 里没有失败节点,引擎的页面出来后 30 秒内收到开场白,mock 模型没有收到开场白的请求(只有余额检查),随后出现目标卡;CI 上从双击安装包到目标卡不超过 90 秒。+- 上手(mock 模型):只选选项按〔确定〕时 mock 没有收到请求,卡上是「模型请求 0/3」;输入框里有字时正好一次;合并后的建议按第 6 节的规则排(卡上的顺序、轮流取、同名只留一个、最多 5 个 Bot、最多 3 个第一件事),和点选项的先后无关;〔换一组建议〕到 3/3 后变灰,写「已到上限」;〔跳过〕给出三个固定任务;〔建…〕后侧栏里正好多出勾选的那几个 Bot,用的是改过的名字,每个的聊天里是固定的招呼,mock 收到的请求数不变;第一件事发出之前,Main Bot 会话的工具只有 `ask_user` 和输入稿模式的 `create_bot`,第一件事那一回合已经是原来的工具;目标卡输入框里整段是末四位 `0001` 的那把 DeepSeek 格式 Key 时按〔确定〕,mock 没有收到请求,卡下面是 Key 的卡;Main Bot 的会话里有那行灰字或用户的消息时重开应用,不再出目标卡,都没有时从目标卡重新开始;第 6 节列的八种情况都走到一张能用的卡,每张卡都有「跳过设置,直接开始」。+- `sk-test-bad` 不会被保存(`credentials.describe` 仍是未配置),卡片显示 401 的文字,Session 里没有回合。`sk-test-empty` 会保存,但 `/user/balance` 报出余额之前不跑开场白,卡片显示「去充值」。+- 登录窗口(CI 用 loopback 上的假 DeepSeek 平台:DSH 的 `platformOrigin` 指向它,`allowLoopbackHttp`):点〔登录 DeepSeek 账号〕后 1 秒内出现主窗口的子窗口,地址是假平台的授权页,标题是「登录 DeepSeek 账号」;它的 partition 不是主窗口的、不持久,关窗后 `deepseek-login` 里没有 Cookie,主窗口的 session 里也没有假平台的 Cookie;假平台跳回 `/oauth/callback` 后窗口 1 秒内关掉、主窗口有焦点、卡片收成「已接上」;回调请求发出、回应还没回来时用 × 关掉窗口,引擎里这次登录仍是 succeeded,卡片收成「已接上」;回调之前用 × 关掉窗口,卡片回到两种方式、引擎里这次登录是 cancelled;授权过期或在卡片上点〔取消〕时,窗口 1 秒内跟着关掉;窗口开着时点鲸鱼菜单的「登录 DeepSeek 账号」,出现 DSH 的登录框(等待中),登录窗口还是原来那个,这次登录仍在等待;在那个登录框里点〔取消〕,窗口 1 秒内关掉,这次登录是 cancelled,卡片回到两种方式;在窗口里点一个别的域名的新窗口链接,链接交给系统浏览器(替身记录)、窗口还在;主框架被导到别的域名时,窗口关掉、授权链接交给系统浏览器、这次登录仍在等待,设置卡写「已在浏览器打开 DeepSeek 登录页。…」,在替身浏览器里走完回调后卡片收成「已接上」、主窗口回到前台;点「在浏览器里打开」后登录窗口关掉、这次登录不是 cancelled;授权页加载失败时窗口关掉、这次登录没有被取消、卡片有〔在浏览器里打开〕和〔取消〕,点〔取消〕后引擎里这次登录是 cancelled、卡片回到两种方式;授权页里的一个 iframe 打不开时窗口还在;假平台让换取失败时窗口关掉,卡片显示登录没有完成,不回到两种方式;登录窗口里的页面请求麦克风、通知或下载文件时,都被拒绝或取消,系统不弹任何框;从修复卡的〔重新登录〕或鲸鱼菜单的「登录 DeepSeek 账号」开始、回调之前用 × 关掉窗口,引擎里这次登录是 cancelled,不等它过期;替身让 `resolveProxy` 对授权链接给出 `PROXY 127.0.0.1:7890`、授权页又打不开时,卡上多一句「登录页走的是系统代理 127.0.0.1:7890:如果代理软件没开,打开它。」,不提「跟随系统代理」;`main.log` 里没有授权链接,也没有回调地址里 `code` 和 `state` 的值。+- 现成的 Key:一次性用户的 DSH 家(`~\.dsh`)的 `.credentials.yaml` 里放 `sk-test-ok`、没有团队:设置卡最上面是「DeepSeek Harness 里有一个 Key:sk-test-…」〔用这个 Key〕,〔登录 DeepSeek 账号〕是次按钮;点了之后 `credentials.describe` 是已配置、`~\.dsh` 里的文件没变、日志和页面的 DOM 里没有整段 Key;放 `sk-test-bad` 时这一行在,点了显示 401、不保存,这一行消失,切到别的 Bot 再回来也不再出现;那个家的 `.env` 里有 `DEEPSEEK_BASE_URL` 时没有这一行。剪贴板替身放末四位 `0001` 的那把 DeepSeek 格式 Key 再把窗口切回前台:出现「剪贴板里有一个 Key:sk-…」,后面是它的前八位;放 `sk-test-ok`(不合格式)或别家格式的 `sk-` Key 时不出现;清掉再切回:这一行消失;两处放不同的 Key 时只有一行,是剪贴板的,小字里是 DeepSeek Harness 的;放相同的 Key 时只有一行,是 DeepSeek Harness 的;点〔用这个 Key〕之前把替身换成别的内容,不检查、不保存;设置卡不在时(已接上)替身的读取计数是 0。+- 聊天里粘贴的 Key(mock 模型):接上模型、上手结束后(或点了「跳过设置,直接开始」),在 Main Bot 的聊天框粘贴末四位 `0001` 的那把 DeepSeek 格式 Key:没有新的回合,输入框是 block 状态、不能编辑,卡片出现,主按钮是〔检查并换上〕(已经有 Key);点了之后输入稿为空、Key 已配置、Session 记录里没有这段文字;换成〔当普通消息发送〕后 Session 里正好一条用户消息,带着的附件一起发出;换成〔清掉〕后输入稿为空、Key 没变、Session 里没有新消息;点「改一下」后输入框可以编辑、输入稿还在、不再出现卡片,改过输入稿再粘回同一把 Key,卡片重新出现;粘贴末四位 `0401` 的那把,点主按钮后卡上是 401、主按钮是〔清掉〕;粘贴 `sk-` 加 30 个字母数字(含数字、不是十六进制)时主按钮是〔保存到提供商…〕;「我的 key 是」后面跟同一把 Key 这样夹在句子里的不拦,单独粘贴 `sk-test-ok`(不合格式)也不拦;撤掉 Key 的 block 时还没有能用的模型,输入框回到「先在上面接上模型,我就能回复你」的锁,不是可用。粘贴末四位 `0000` 的那把,点〔检查并换上〕后 Key 换成了这一把、输入稿为空、Key 的 block 撤掉,卡片留着,写「Key 已保存,但账户余额是 ¥0.00,充值后才能用。」〔去充值 ↗〕〔知道了〕,没有〔再查一次余额〕〔换一种方式〕;先发「要密钥」让 Bot 出一张 `request_secret` 卡,再粘贴末四位 `0001` 的那把,主按钮是〔填进那张卡〕,点了之后输入稿为空、Key 在那张卡的输入框里,`credentials.describe` 没变。+- 插件 Host 的单元测试(替身 `deepseekAccount`):未登录和零余额的账号不会产生开场白回合;有余额的会在自动选模型后产生;`getBalance` 失败时照常往下走。+- 中文界面下,把启动页、设置卡、目标卡、建议卡、第一件事卡、聊天里粘贴 Key 的卡、修复卡的每种状态和卸载提示都渲染一遍,除允许名单外找不到英文单词。+- 没有能用的模型且模型列表已知时,Bot 聊天的输入框不可用;绕过输入框发出的消息在接上模型后会得到回答,开场白不丢,之后不出目标卡。+- 「重试」不会在 Session 记录里多出一份用户的话。+- Bot 聊天里每种失败代码都显示插件的修复卡,至少一个按钮;原文只在「技术详情」里,AUTH 的原文从不显示。+- 从卡片发起登录后,无论成功、取消、过期还是失败,切到经典 Agent 模式都不会冒出 DSH 的登录框。+- 全新的应用 profile 上,DSH 的「开始使用」凭据框不会自动出现,页面里 `__DSH_MODELS_ONBOARDING__.credentialOnboarding` 是 `false`。+- 「高级设置」里的模型入口打开的是 DSH 设置的「模型」页;DS Bot 自己注册的那个 `settings.onboarding` 步骤在自动检查时立刻完成,不挡住 DSH 自己的步骤。+- 引擎失败后 1 秒内出现失败页,每种都有五个按钮,窗口不隐藏。禁用 ds-bot 的测试 profile 在 25 秒内显示「团队界面没有加载出来」。+- `main.log` 和复制出来的详细信息里没有 `sk-test-*`、mock 的三把 DeepSeek 格式 Key、`token=` 的值和用户文件夹的路径。+- 导入:PID 活着但锁超过 60 秒没刷新,不算占用;失败或停止后没有 `.import-*` 文件夹;`room.id` 的 Session 被复制;存着用户 key 的 `.credentials.yaml` 不被覆盖,只有引擎写的 `client-connection/` 记录的会换成旧的;导入写模型设置时,数据位置里 `profiles/ds-bot/cordis.patch.yml` 的其他行(如 `ui-settings-general`)保留,应用自己的补丁里没有这一行。- - 卸载:`/S` 和更新时什么都不删;交互卸载显示问题,「否」全部保留,「是」删掉带标记的文件夹和 `%APPDATA%\DeepSeek Bot`,没标记的只删自己的条目,从不删磁盘根目录,总工作区永远保留。++- 卸载:`/S` 和更新时什么都不删;交互卸载显示问题,「否」全部保留,「是」删掉带标记的文件夹和 `%APPDATA%\DS Bot`,没标记的只删自己的条目,从不删磁盘根目录,总工作区永远保留。+- 更新:镜像挂了一次检查内就换到 GitHub;60 秒没有收到数据的下载会取消并换源;关于页显示百分比。+- 发版:「标为 Latest」是最后一步,依赖 GitHub 上传、镜像和下载表;链接检查访问两个固定地址(200 或 302)。+- README.md 和 README.zh.md 前 10 行有 Windows 下载链接(有镜像后镜像在前)和「不是官方产品」,两份同步。+- README 和卡片里「一轮多少钱」来自 PR 里记录的实测(默认模型上三次第一件事的回合)。+- `npm test`、`node scripts/build-client.mjs --check`、`npm run lint` 和冒烟测试通过;`dev/smoke.mjs`、`app/scripts/check-packed.mjs` 和它们覆盖的行为在同一个 PR 里改。++## 待定++| 问题 | 选项 | 建议 |+|---|---|---|+| Windows 用哪种代码签名? | SignPath Foundation(开源项目免费;发布者显示「SignPath Foundation」;要审批,每次发版要人工批准);云 HSM 上的 OV 证书(每年约 200–400 美元;发布者是维护者);Azure Artifact Signing(约 9.99 美元/月,但个人只能在美国和加拿大申请);Microsoft Store MSIX(微软免费重新签名,没有 SmartScreen 和智能应用控制的拦截;要审核,名字里带「DeepSeek」有风险,多一条更新渠道) | 先申请 SignPath Foundation,问清它是否接受 electron-builder 的签名钩子、能否签 Electron 自带的 exe 和第三方 `.node` / `.dll`。被拒再考虑 OV 证书。MSIX 等改名的决定之后再说 |+| 国内镜像放在哪里? | CNB(cnb.cool)镜像仓库的 Release(免费,腾讯运营;限制未验证);腾讯云 COS 默认域名(下载不需要备案;约 ¥0.5/GB,按现在的量每月约 ¥100–450;要实名账号);npmmirror 的 binary-mirror-config(免费,晚几小时同步,要对方维护者同意);Gitee Release(附件大小限制,约 212 MB 的安装包很可能放不下) | 先从大陆网络试测 CNB(固定的 latest 地址、300 MB 以上文件、不用登录、支持断点续传)。通过就用 CNB,否则用 COS。GitHub 永远是第二个链接和第二个更新源 |+| 中文界面里第一个 Main Bot 叫什么? | 「总管」,角色「团队负责人」;保留「Chief」,角色「团队总管」;「总管家」,角色「团队负责人」 | 「总管」,角色「团队负责人」,按建团队时的界面语言决定;英文不变,配置优先,已有团队不改,测试和 README 同一个 PR 里改 |+| 安装包要不要改成一键安装? | 一键、只装给当前用户、装完打开、没有目录页(`/D=` 自定义);保留向导,但去掉目录页、默认勾选「运行」 | 一键安装。少两次点击(「安装」「完成」),也去掉了最技术化的一页 |+| 插件形态(DSH Desktop、DSH Web)里,第一个 Main Bot 也自动选模型并打招呼吗? | 所有形态都这样(只有一个提供商能用且检查通过时);只在桌面应用这样,插件形态仍然「先选再打招呼」 | 所有形态。开场白现在是固定文字,不调用模型;检查优先用不调用模型的余额查询;「已接上 · 更换」让选择看得见、改得了 |+| 换位置时两个子文件夹叫什么? | `data` 和 `workspace`;`数据` 和 `工作区`;按界面语言取名 | `data` 和 `workspace`:路径里允许英文,和插件、文档里的词一致,换语言、换机器都一样 |- | 默认安装也改成一个根文件夹吗? | 不改,仍是 `~\.ds-bot` 加 `~\DeepSeek Bot`;改成 `~\DeepSeek Bot\data` 加 `~\DeepSeek Bot\workspace` | 不改:老用户、插件版和 README 都认今天的默认,隐藏的 `.ds-bot` 也不容易被误删。「一个位置」是一个动作,不要求一个路径 |++| 默认安装也改成一个根文件夹吗? | 不改,仍是 `~\.ds-bot` 加 `~\DS Bot`;改成 `~\DS Bot\data` 加 `~\DS Bot\workspace` | 不改:老用户、插件版和 README 都认今天的默认,隐藏的 `.ds-bot` 也不容易被误删。「一个位置」是一个动作,不要求一个路径 |+| 导入后哪些 Bot 提前换到新文件夹?(每次换段都要写交接说明,花 token) | 只有 Main Bot;Main Bot 加最近 30 天用过的 Bot,一个一个来;都不提前,只在第一条消息时显示换段状态 | 只有 Main Bot:它是用户落地的聊天,成本最低就能去掉看得见的等待 |+| 引擎默认跟随 Windows 系统代理吗? | 默认开,设置里能关,用户自己的环境变量或 `.env` 优先;默认关,能打开 | 默认开。大陆用户开着 Clash、v2rayN 的系统代理,会期待 GitHub 和国外提供商像浏览器里一样能用;代理不对时修复卡会点名代理和开关 |+| Bot 聊天里余额不足时,DSH 的余额提示(Toast,不分 Session)还会和修复卡同时出现,怎么办? | 接受两处同时出现;接管这条提示(会影响所有 Session) | 先接受,记进「已知限制」,并向 DSH 提需求(「需要 DSH 提供的」第 7 条) |+| 设置卡要不要看剪贴板? | 看,只在设置卡显示期间、只比对格式;不看,只认 DeepSeek Harness 里的 Key | 看:从开放平台复制了 Key 回来的人少一次粘贴。读的时机和范围写死,值不记录,用户点〔用这个 Key〕之前不交给页面,卡上只有前八位 |+| 桌面应用里〔去充值 ↗〕在哪里打开? | 系统浏览器,没在浏览器里登录过开放平台的要再登录一次;应用的子窗口,和登录窗口共用 `deepseek-login` partition,到设置卡收起或应用退出才清掉(`dsBotApp.signIn` 要多一个方法;付款页走出 DeepSeek 域名时仍会被送去系统浏览器) | 先用系统浏览器:付款页不放进应用的窗口,平台的登录状态也不多留;多出的一次登录记进「已知限制」 |+| 目标卡合并后最多 5 个 Bot(第 6 节),要不要改成每组最多 2 个、最多 4 个? | 不改:每组轮流取,最多 5 个(有一组是 3 个时,两个目标就占满 5 个);改成每组最多 2 个、最多 4 个 | 改成每组最多 2 个、最多 4 个:两个目标不会一下占满,四个目标也是每个先有一个 Bot |+| 合并后的第一件事(第 6 节:按 Bot 的顺序取每个 Bot 自己的任务,最多 3 个),要不要改成轮流取? | 不改(每组第一个 Bot 都有两个任务,三个总是来自前两个目标,两个来自第一个,三个以上目标时后面的没有);三个以上目标时任务也轮流取 | 改成三个以上目标时轮流取,每个目标先取一件,前三个目标各有一件 |+| 只有一个目标时摘要怎么写? | 每个目标一个词:「想先写代码:…」「想先查资料:…」(第 6 节现在的写法);用选项的原文:「想先写代码、改程序:…」 | 一个词:几个目标要用「、」连起来,选项原文里的「、」会让两个目标读起来像三个;单个和几个目标写法一样 |+| 首次启动还要那条 1 px 的水线吗? | 保留;去掉,只留鲸鱼和圈 | 保留:圈和三站的位置要有一个水面才站得住 |+| 启动页超出原型规格里 45 KB 的预算怎么办?(原型实测:五个文件的源码 113 KB,压缩后 79 KB,gzip 约 35 KB;`text.mjs` 带中英两种语言) | 放宽预算;`text.mjs` 按语言拆开,只加载界面语言的那一份;打包时压缩 | 先按语言拆 `text.mjs`、打包时压缩,在 M4 实测启动页的第一帧;第一帧不晚就放宽预算:页面是本地文件,不走网络(同 [启动窗口](2026-10-26-start-window.md) 的「待定」) |++## 不做什么++- 不在应用里另做一套配置模型的欢迎向导:模型只在 Main Bot 的设置卡和 DS Bot 设置 → 模型里配。目标卡、建议卡和第一件事卡也是插件在 Main Bot 聊天里画的卡,不是应用的向导。+- 上手期间不让模型选下一步,也不让它自己一轮轮地调用工具:步骤表在代码里,由卡片的回答推进,Main Bot 的工具受限到第一件事发出(第 6 节)。只选了目标卡的选项时不调用模型。+- 鲸鱼的话从不是一段话:一次一句,一行放得下;启动页上不放说明段落,也不轮播提示。+- 不在设置卡显示期间之外读剪贴板;剪贴板和 DeepSeek Harness 里的 Key 都不自动保存:一定是用户点了按钮,再按「粘贴 key」的规则检查和保存。+- 设置卡的现成 Key 只认 Key,不单独搬 DeepSeek Harness 里的账号登录(grant 记录归 DSH 的账号模块,应用不去写):没导入团队、或者答了〔先不复制〕、在 DeepSeek Harness 里用账号登录过的人,在登录窗口里再登录一次。导入团队时 `.credentials.yaml` 整个复制(目标里已有用户自己的 key 或登录时除外),账号登录跟着过来,不用再登录。+- 不伪装 `dshDesktop`,不用 CSS 或 DOM 去藏、改 DSH 的界面;DSH 的「预览版说明」等它的开关。也不预先写入它的「已读」版本号(`ui-settings-general` 的 `welcomeNoticeVersion`):那等于替用户点了「继续」,版本号也没有公开导出,写在补丁层里还会让用户以后点「继续」时保存失败。+- 不改 DSH,不依赖 DSH 安装里的文件。DSH 的内部接口只用已经在用的 `@deepseek-ai/dsh-app-boot`、`@deepseek-ai/dsh-session-format`、`@deepseek-ai/dsh-session-format-catalog` 和 `settings.models.sign-in` 条目注入的操作(设置卡会多调 `setOnboarding`、`showLogin`、`cancel`、`refreshAccount`,见「已知限制」),不再新增。+- 不在每次启动时扫盘:固定盘只在盘不够或默认位置不能用时枚举一次;读卡器、U 盘、移动硬盘、网络盘和光驱一概不碰,也从不推荐它们。+- 卸载从不删除总工作区、磁盘根目录和家目录。+- 日志、复制出来的详细信息、诊断文件和文档里不出现 key、token 和真实的用户路径;界面上的位置只给用户本人看。截图只用一次性目录。+- 不用其他产品的文字、图标和插图(包括 DSH Desktop 的欢迎页插图和字体);信任说明用自己画的示意图。++## 已知限制++- DSH 加开关之前,「预览版说明」仍然是引擎页面的第一屏,用户要多点一次「继续」;每个新的数据文件夹(以后的导入、重新开始)都会再出现一次。启动页只能提前提醒。+- 设置卡调用的是 `settings.models.sign-in` 条目注入的操作。它们有类型声明,但 DSH 没有写成给插件用的接口,rc 版本之间可能变化。缺了哪个就退回到今天的 `DeepSeekSignIn`;每次升级锁定的 DSH 都要重测(另见「需要 DSH 提供的」第 4 条)。+- `credentialOnboarding` 那一行的 id 如果在 DSH 里改了名,补丁只会留下一条警告、悄悄失效;靠验收里对 `__DSH_MODELS_ONBOARDING__` 的检查发现。+- `GET /user/balance` 不在聊天 API 里,是否计费没有文档;它证明的是 key 和余额,不是模型能不能用。除了 401 以外的失败都不拦人,第一轮的修复卡兜底。+- 自动选模型时,没有不调用模型的检查的提供商要多一次 8 token 的试连。+- 开场白是固定文字,不再花钱,但也说不出任何只有模型才知道的东西。+- 上手里模型的那一步比卡片慢:真实的网络往返,最坏 12 秒才出兜底卡(8 秒内来了第一个字、之后停住的);它先花钱(只在用户写了字或要换一组时),才见效果;措辞每次不一样,CI 只能测结构。+- 合并后的第一件事偏向前两个目标:三个以上目标时,后面的目标没有第一件事;勾掉前面的 Bot 时,用三个固定任务补满,不用后面 Bot 的任务(怎么分见「待定」)。+- 首次启动主窗口在就绪后约 1.6 秒才露面(原来约 620 ms),以后的启动约 0.6 秒(原来 120 ms):多出来的主要是等纸面空下来再长大的约 460 ms,首次启动还有「进去吧」先停的 300 ms。+- Bot 聊天里余额不足时,DSH 自己的余额提示(不分 Session)会和修复卡同时出现。+- 中文默认名字看的是第一次请求时的界面语言;DSH 存的语言偏好还没加载完时,它可能还是浏览器的语言,所以浏览器是英文、DSH 设成中文时,新团队仍可能叫 Chief。桌面应用里全新的数据位置以系统界面语言为准。+- 退回系统浏览器登录时,Windows 的前台规则可能不让窗口在登录后回到前台,这时只能靠任务栏闪烁和卡片自己的「已登录」状态。+- 登录窗口靠的是 DSH 网页前端「先开 `about:blank` 再导到授权页」的做法,不是接口;DSH 改了做法就退回系统浏览器(另见「需要 DSH 提供的」第 14 条)。登录页里主框架走出 DeepSeek 域名的流程(比如第三方登录)会换到系统浏览器从授权页重新开始,登录窗口里填到一半的东西不带过去。+- 登录窗口不留 DeepSeek 平台的登录状态,〔去充值 ↗〕(余额为零的卡、ACCOUNT_QUOTA 的修复卡)仍在系统浏览器里打开开放平台:没在浏览器里登录过开放平台的人(比如刚在登录窗口里用手机号注册的新账号)要在那里再登录一次。以前在浏览器里登录时没有这一步(要不要改见「待定」)。+- 修复卡和鲸鱼菜单走 DSH 自己的登录框,登录窗口开着时它仍写着在浏览器里继续:这是 DSH 的文案,不改它的界面。在那个登录框里点〔取消〕或 ×,会取消这次登录,登录窗口也跟着关掉。+- 剪贴板只在设置卡显示期间读,但读的时候没有提示;卡上那一行的前八位就是读过的证据。+- 聊天里只有 Key 的输入稿靠观察输入稿再挂 block,粘贴和 Enter 同一瞬间(脚本、自动化)可能抢在 block 之前发出去;句子里夹着的 Key 不拦,DSH 的掩码只改显示。+- 聊天里只有 Key 的输入稿在清掉之前一直存在浏览器的 localStorage 里,这是 DSH 存输入稿的做法;401 或用户不理卡片时,Key 会跟着输入稿留到下次启动。插件只在保存、〔填进那张卡〕或〔清掉〕时用 `setDraft('')` 清掉它;〔当普通消息发送〕时由 DSH 发出后清掉;插件不替用户删输入稿。+- 签名之前,开着智能应用控制的 Windows 11 装不了未签名的安装包,只能先走 DSH Desktop 插件这条路。签名主体如果是 SignPath Foundation,发布者会显示它的名字。+- 一键安装去掉了选程序目录(估计约 600–700 MB 在 C 盘,实测后写进 README),只剩 `/D=`。+- electron-builder 自带的几条 NSIS 报错(卸载旧版失败、解压失败)只有英文。+- 卸载时删除数据是不可撤销的;没有标记的文件夹只删已知条目,列表不全时只会留下文件,不会多删。+- 跟随系统代理可能让 DeepSeek 的流量走一个用户忘了的、或者已经退出的代理;诊断和修复卡会点名代理,可以关掉。+- `NODE_USE_SYSTEM_CA` 在 `ELECTRON_RUN_AS_NODE` 下是否有效未验证;验证不了就不设,使用 TLS 检查的公司网络仍然连不上,只是提示更明确。+- 导入后 Main Bot 提前换段要读一遍最近的对话写交接说明,冷缓存时会花不少 token(#384 实测 17 万 token)。+- 推荐的盘按总线类型排除了 USB、SD 和虚拟盘,但报告成固定盘的移动硬盘仍可能被推荐;PowerShell 被策略禁掉的机器上没有推荐盘,只有「其他位置…」。+- 〔移到…〕之后应用自己建的旧总工作区不在了(改名或逐个搬走),DSH Agent 的 Session 要重新选文件夹;Bot 和群的 Session 换段,不受影响。用户自己挑的总工作区不搬,搬完后它和 `R\workspace` 都在:团队换了文件夹,不是占两份。+- 从 DeepSeek Harness 复制过来的团队在两边各占一份:应用从不写 `~/.dsh`,所以不能替用户删原件,只能把多占的空间写在卡片和设置里。+- 后台复制工作文件在不支持硬链接的文件系统(FAT、exFAT)上退回到「查一次再改名」,查和改名之间 Bot 新建的同名文件会被盖掉。++## 变更++- 2026-10-26:定下 Windows 上手流程。依据:`dev` 上的实测(全新用户,中文界面)、代码和 DSH 0.2.1-rc.2 的包、GitHub 上的 Issue 和 Discussions、同类应用的上手做法(只取原则)。+- 2026-10-26:实现 M1 时补正:Edge 的「保留」后还要点「显示更多」;README 先链到 `releases/latest` 页面,固定下载链接随 M3 的检查上;安装问题表单问系统的显示语言,不只是 Windows 的;导入时只有引擎写的 `client-connection/` 记录的 `.credentials.yaml` 不算用户的,照常换成旧的。+- 2026-10-26:维护者反馈位置选择生硬,简化 §3 和 §4:换位置只选一个文件夹,数据和总工作区一起放进去;盘不够或位置不能用时推荐一个固定盘,系统选择框退到「其他位置…」之后,只在应用改了路径时确认;重装不问;导入卡缩成一句话两个按钮,卡片一出现就检查和预热;复制分两段,团队在对话复制完就打开,工作文件后台复制。卡片的样子在 [启动窗口](2026-10-26-start-window.md) 里。评审后补正:定根的规则写成一条;重装接着用时不出位置卡;后台复制不用 `fs.cp`,经暂存和硬链接落位;导入卡开着时主窗口不加载引擎的页面;〔移到…〕靠删掉 `workspaceId` 和 `DS_BOT_WORKSPACE` 换总工作区,文件在重启后后台复制。+- 2026-10-27:维护者要求空间不能占两份:§4 加「空间只占一份」(对话只复制一次、附件改名进位、第一段和第二段各有空间下限、卡片写明多占多少、设置里显示原团队的位置和大小);§8 的〔移到…〕改成真正的搬(同一个卷改名,不同的卷复制完删旧的),恢复页的〔换个位置…〕同样。评审后补正:暂存前先查锁,占用卡和「正在下载」卡有〔先不复制〕;标记在建文件夹时就写,每次启动先删上次的暂存;〔移到…〕只搬应用自己建的文件夹、按「搬到一半」记录退回、逐个搬工作文件、搬前查空间;复制团队和空白团队不删现在的团队,设置里列出「以前的团队」;〔重新找到它…〕的规则;被拒绝的位置卡留着来时的按钮;Bot 知道工作文件还没到齐,`workDir` 在 `~/.dsh` 里的改到新总工作区;空间例子改成 1.7 / 1.5 / 0.2 GB;推荐盘的门槛加上导入要多占的数;Key 余额为零的卡加〔换一种方式〕;允许名单补 DSH Desktop、DSH Web、提供商名和用户起的名字。+- 2026-10-27:接模型的三条改进写进 §5 和 M2:桌面应用里登录页在应用自己的登录窗口里打开,不离开应用,打不开时才退回系统浏览器;现成的 Key(DeepSeek Harness 的凭据、设置卡期间的剪贴板)一键用,照样先检查再保存;聊天里整段是 Key 的输入稿拦下来,问保存还是发送。`dsBotApp` 加 `signIn` 和 `foundKeys()` / `takeKey()`;「需要 DSH 提供的」加第 13、14 条;剪贴板是否保留、〔去充值 ↗〕在哪里打开列入待定。评审后补正:DSH 开的空白弹窗改不了 partition,登录窗口由应用另建、两者同生同灭;允许名单只管主框架,授权页来源从第一次导航取;回调不看状态码,`onClosed` 带原因,回调发出后关窗不算取消;代理提示不提引擎的开关;环境变量的 Key 是「来源 env」不是「不可写」;mock 加三把 DeepSeek 格式的 Key;现成 Key 一行一个主按钮、两处合并、`takeKey` 核对前八位;聊天卡按状态选文案,加〔清掉〕和「改一下」,和模型锁合算一个 block,发送走输入框自己的 `submit()`;输入稿存在 localStorage、充值页要再登录记进已知限制。第二轮补正:登录窗口的 session 只放行主框架的回调,不照抄 Bot 浏览器拦引擎的规则;新窗口等旧 partition 清完再开;`onClosed` 带代理,打不开的卡有〔取消〕;登录中点鲸鱼菜单或修复卡只打开 DSH 的登录框;窗口里新开的链接一律去系统浏览器;被拒的现成 Key 不再推荐;聊天卡写明检查没通过时的按钮、余额为零的〔知道了〕和 `request_secret` 卡的按钮;「放过」在 DSH 清空输入稿时仍在。+- 2026-10-28:维护者 2026-10-27 的反馈写进 §3 到 §6、§8 和 M2、M4,分三部分。一是「鲸鱼即进度」的启动页:小窗口显示的是实现的结构(一条带三个点的线和几段说明),不是用户感受到的东西;现在鲸鱼停在哪一站就是到了哪一步,一次一句鲸鱼的话,提示行只说接下来要准备什么,5 秒起显示已用秒数,卡片的第一句也由鲸鱼说,重装的小字改成提示,180 秒改成鲸鱼的问题,交接时启动窗口长成主窗口。二是目标卡可以多选,按〔确定〕提交,几个目标按卡上的顺序合并成一份建议。三是上手后半段的 AI-native 方案:开场白改成固定文字、不调用模型,然后是目标卡、建议卡和第一件事卡,只在用户写了字或要换一组时调用模型,整个上手最多 3 次请求,深度限制写成机制(步骤表在代码里、工具受限、每一步一次请求和时限、模型关着也能走通的卡、mock 模型的 CI);「试试:」的三个固定任务留作〔跳过〕的路和补位。依据:启动窗口和团队窗口的原型及其检查(`handoffShow` 在就绪后 1.09 到 1.17 秒,窗口 300 ms 长大,目标卡和合并的用例)和 2026-10-27 给维护者的 AI-native 评估。合并的上限、第一件事的分法、单个目标的摘要、水线和启动页的大小列入「待定」。评审后补正:第一件事一发出就解除工具限制,它是不受上手限制的正常回合,灰字仍在它回复以后;建议卡建的 Bot 的招呼也是固定文字,整个上手确实最多 3 次请求;JSON 调用只有一组时限(8 秒第一个字、12 秒回完),整轮 20 秒只管上手期间 Main Bot 会话里的回合,兜底最坏 12 秒;schema 带 `goal` 和任务的草案序号,合并按 `goal` 走,模型的摘要只在用户的话太长时用;〔换一组建议〕由模型换一组不重复的;目标卡输入框里整段是 Key 时不发给模型;上手结束从会话里读(灰字或用户自己的消息),中途重开从目标卡重新开始,「取舍」写明这一点;一个会话的 block 按模型锁、上手锁、Key 排,上手锁有自己的占位,开场白不再说「直接说就行」;接上模型前发出的消息算 Main Bot 的第一个正常回合,不再出目标卡;修复卡的「重新留着」只管模型写的招呼;合并的上限和分法按已定的写,「待定」改成要不要改;「一轮多少钱」改用第一件事的回合实测;第 5 节写明侧栏磁贴上的鲸鱼,开场白和目标卡的时间从设置卡收起时算;以后的启动照 [启动窗口](2026-10-26-start-window.md) 第 5 节写,记进「改动的已定设计」;交接的验收从鲸鱼停到第 3 站算;`askSteward` 只是形态相同,上限是这次调用自己的;「水圈」统一叫「圈」,「三站」改成「三站的标记」;导入的检查行去掉破折号;45 KB 那条待定照启动窗口稿写;M4 加八种动作和磁贴上的鲸鱼,估计改成 10 人日。复核后补正:问候里的名字、`dsBotApp` 的露面事件(待定)和以后的启动庆祝那次的 2.5 秒兜底与启动窗口稿对齐;交接验收的 1.2 秒放宽到 1.3 秒,给 CI 留余量。- - 2026-10-28(第二次):落地 M4 第一批时维护者看到首次启动仍弹「欢迎使用 DeepSeek Bot」的系统对话框(「我主要不喜欢这个」),要求「给出建议,同时提供自行选择的接口,避免小弹窗」:§3 的「什么都不问」补上启动页底注右边的位置行「数据放在 C 盘(剩 412 GB)· 换个位置…」,点了才开系统选择框,定根和「一个位置」一样,被拒绝的原因加上 DSH 的家和程序文件夹,定好后引擎在新文件夹重新起(启动窗口稿第 2、4、6、7 节);验收加一条。导入问题在 M5 的导入卡落地前仍是挂在启动窗口上的对话框。- - 2026-10-29:启动页的文案分层,写进 [启动页文案](2026-10-29-start-copy.md);按各层的写法规则改了本文引用的四处:§3「团队界面没有加载出来」、§8 45 秒的「比平时慢,请再等一会儿」去句号,§3「会放在 `D:\DeepSeek Bot`。」加句号、〔重新选…〕加 …(被拒绝的卡也一样),§4 更新版本那张卡的脚注改成「以后可以在 设置 → 通用 → 位置 里复制。」,和「以后可以在 … 里改。」同一个句式;「用词」加一条指向它。++- 2026-10-28(第二次):落地 M4 第一批时维护者看到首次启动仍弹「欢迎使用 DS Bot」的系统对话框(「我主要不喜欢这个」),要求「给出建议,同时提供自行选择的接口,避免小弹窗」:§3 的「什么都不问」补上启动页底注右边的位置行「数据放在 C 盘(剩 412 GB)· 换个位置…」,点了才开系统选择框,定根和「一个位置」一样,被拒绝的原因加上 DSH 的家和程序文件夹,定好后引擎在新文件夹重新起(启动窗口稿第 2、4、6、7 节);验收加一条。导入问题在 M5 的导入卡落地前仍是挂在启动窗口上的对话框。++- 2026-10-29:启动页的文案分层,写进 [启动页文案](2026-10-29-start-copy.md);按各层的写法规则改了本文引用的四处:§3「团队界面没有加载出来」、§8 45 秒的「比平时慢,请再等一会儿」去句号,§3「会放在 `D:\DS Bot`。」加句号、〔重新选…〕加 …(被拒绝的卡也一样),§4 更新版本那张卡的脚注改成「以后可以在 设置 → 通用 → 位置 里复制。」,和「以后可以在 … 里改。」同一个句式;「用词」加一条指向它。diff --cc docs/plans/2026-10-29-start-copy.mdindex 49babbd5,00000000..6c53f616mode 100644,000000..100644--- a/docs/plans/2026-10-29-start-copy.md+++ b/docs/plans/2026-10-29-start-copy.md@@@ -1,188 -1,0 +1,188 @@@+# 启动页文案:层、键和一张表++- 日期:2026-10-29+- 相关:[启动窗口](2026-10-26-start-window.md)(第 3、4、5、6、7、11 节)、[Windows 上手流程](2026-10-26-windows-onboarding.md)(第 3、4、8 节、用词)、[UI 标准](../design/ui-standard.md) 第 11 节+- 代码:`app/src/start/text.mjs`(唯一的表)、`app/src/start/start.html`、`app/src/start/start.js`、`app/src/first-run.mjs`、`app/src/updates.mjs`、`app/src/main.mjs`、`app/test/start-page.test.mjs`++## 为什么+- 启动页的字是在两份设计稿里一句一句定下来的,代码里却散在三张表里:页面的 `text.mjs`(118 个键),主进程的 `first-run.mjs`(30 个)和 `updates.mjs`(11 个),后两张用函数拼句子,没有测试盯着。键名按来历起,不按它在页面上是哪一行字:鲸鱼那一行既有 `voice.*` 也有 `title.*`,提示行里有一个 `slow.45.later`,按钮一半是光杆键(`retry`)一半挂在卡片下(`card.recommend.use`),卡片正文散在 `card.*`、`import.*`、`newer.*`、`update.*` 和光杆键里。于是同一句话写了两遍(「换个位置…」「DeepSeek Bot 没有权限在 … 里写文件。」),同一个意思有两三种写法(「不复制 / 先不复制」「不带团队开始 / 先不带团队开始」),标点看情况(鲸鱼的话里只有「团队界面没有加载出来。」带句号,提示行里只有「比平时慢,请再等一会儿。」带句号),用词也走了样(「聊天记录」对「对话」,「群」对「群聊」,英文里 chats 和 conversations 混用)。审一遍 2026-10-29 的表,没有一个键是死的,问题全在结构上。++启动页的字是在两份设计稿里一句一句定下来的,代码里却散在三张表里:页面的 `text.mjs`(118 个键),主进程的 `first-run.mjs`(30 个)和 `updates.mjs`(11 个),后两张用函数拼句子,没有测试盯着。键名按来历起,不按它在页面上是哪一行字:鲸鱼那一行既有 `voice.*` 也有 `title.*`,提示行里有一个 `slow.45.later`,按钮一半是光杆键(`retry`)一半挂在卡片下(`card.recommend.use`),卡片正文散在 `card.*`、`import.*`、`newer.*`、`update.*` 和光杆键里。于是同一句话写了两遍(「换个位置…」「DS Bot 没有权限在 … 里写文件。」),同一个意思有两三种写法(「不复制 / 先不复制」「不带团队开始 / 先不带团队开始」),标点看情况(鲸鱼的话里只有「团队界面没有加载出来。」带句号,提示行里只有「比平时慢,请再等一会儿。」带句号),用词也走了样(「聊天记录」对「对话」,「群」对「群聊」,英文里 chats 和 conversations 混用)。审一遍 2026-10-29 的表,没有一个键是死的,问题全在结构上。++这份稿只做一件事:**按字在页面上的位置分层,每一层一条写法规则,一个键一句话,一张表,一组测试。** 已定的句子一个字都不改,除非它违反自己那一层的规则;改了的逐条记在「改动的已定设计」里。++## 已定的行为++### 1. 一张表++- 壳里用户看得到的字都在 `app/src/start/text.mjs` 的 `TEXT` 里:启动页的,和挂在启动窗口或主窗口上的系统对话框的(选文件夹、搬数据、导入、更新)。`first-run.mjs` 和 `updates.mjs` 不再有自己的表。+- 中文是源,英文逐键对照;两边键集相同、占位符相同(已有的测试)。+- 占位符 `{name}`;路径、大小、名字、版本都从快照或参数填,表里不写。英文的单复数写在占位符里:`{bots|Bot|Bots}` 填成「1 Bot」「6 Bots」(`t()` 按值是不是 1 选)。中文不用。+- 查字只有一个函数 `t(lang, key, vars)`。语言由 `langOf(locale)` 定(`zh*` → `zh`,其余 `en`),页面从快照拿,主进程用 `app.getLocale()`。- - 产品名不是文案:对话框标题 `DeepSeek Bot`、`DSH Desktop`、`DSH Web` 是常量,不进表、不翻译。++- 产品名不是文案:对话框标题 `DS Bot`、`DSH Desktop`、`DSH Web` 是常量,不进表、不翻译。+- 表以外不再有用户看得到的中文或英文;主进程里给 Bot 或开发者看的英文错误串(浏览器、cookie 导入、IPC 拒绝)不算文案,不进表。++### 2. 层:键的第一段++键写成 `<层>.<事>[.<部分>]`。第一段只能是下面十个,说的是这行字在页面的哪里,不是它为什么存在。每层一条写法规则(中文;英文照第 4 节)。++| 层 | 在哪里 | 谁在说 | 规则 |+|---|---|---|---|+| `voice.*` | 鲸鱼下面那一行 | 鲸鱼,第一人称、口语 | 一行,不折行,最多 16 字;不加句号,可以问号;可以用口语的动词(「搬过来」) |+| `say.*` | 卡片的第一行(15/20、600) | 鲸鱼 | 最多 12 字;不加句号 |+| `hint.*` | 提示行 | 应用,中性 | 只写接下来要知道的一件事,最多 22 字;不加句号 |+| `card.*` | 卡片正文 | 应用 | 整句,以 。? 结尾;说出了什么事,怎么办交给按钮;路径放 `code`;`card.<卡>.<部分>`,几张卡共用的放 `card.update.*` |+| `reason.*` | 卡片正文里复用的原因 | 应用 | 整句的以 。 结尾(`reason.place.*` 位置不能用的七个原因、`reason.start.*` 启动失败的五个);嵌进句子的片段不带标点(`reason.copy.*` 复制失败的三个) |+| `btn.*` | 按钮 | 用户的动作 | 最多 10 字,动词或动作短语开头;打开系统选择框或离开这张卡的以 … 结尾;不加句号;链接样式的小按钮可以是名词短语(「其他位置…」「详细」) |+| `note.*` | 卡片脚注 | 应用 | 一句,以 。 结尾,说以后在哪里改 |+| `foot.*` | 底注行 | 应用 | 不加句号(「社区开源项目,不是 DeepSeek 官方产品」、位置行) |+| `status.*` | 只给读屏和计数 | 应用 | 不加句号:隐藏列表「启动进度」、三个阶段名、四个状态词、朗读句、「已用 N 秒」 |+| `dialog.*` | 系统对话框的正文和标题 | 应用 | 正文整句以 。? 结尾,可以两段(`\n\n`);选择框标题不加句号;按钮用 `btn.*` |++- 同一句话只有一个键;两层里都要的同一句,各自一键(提示行的「C 盘只剩 1.2 GB」和卡片里的「C 盘只剩 1.2 GB。」是两层两键)。+- 同一个意思只有一种写法:「先不复制」(不复制团队,继续)和「先不带团队开始」(放弃复制、带空白团队启动)是两个意思,各一种写法;对话框里原来的「不复制」「不带团队开始」改成这两句。+- 一个东西一个名字(上手流程「用词」):对话(不是聊天记录)、群聊(不是群)、API Key(不是密钥)、附件、总工作区、数据文件夹、位置(设置项,英文 Location,单数)。鲸鱼的话可以口语(「正在搬过来」),按钮和正文用正式名(「复制过来」「停止复制」)。+- 不写过程词:马上、稍后、下个版本(UI 标准第 11 节;测试扫全表)。「待会儿要接一个模型」说的是用户的下一步,不是引擎的承诺,留着。++### 3. 键的对照++旧键 → 新键,中文照旧的不写,改了的写出来。++鲸鱼的话 `voice.*`:`voice.hello / helloName / helloBack / data / found / engine / slow10 / slow45 / team / ready / watchdog` 不动;`title.later` → `voice.opening`,`title.moving` → `voice.moving`,`title.failed` → `voice.failed`,`title.viewFailed` → `voice.viewFailed`「团队界面没有加载出来」(去句号)。++卡片第一行 `say.*`:`say.space / permission / rejected / picked / missing / import / importSpace / inUse / newer` 不动;`copying.title` → `say.copying`「正在搬过来」。++提示行 `hint.*`:`hint.model / preview / reinstall / space` 不动;`slow.45.later` → `hint.slowLater`「比平时慢,请再等一会儿」(去句号)。++卡片正文 `card.*`:++| 旧 | 新 | 中文 |+|---|---|---|+| `card.recommend.ask` | `card.recommend.ask` | 放到 {rec} 盘(剩 {recFree})? |+| `card.reason.space`、`card.reason.permission` | 见 `reason.place.*` | |+| `card.rejected.*` | 见 `reason.place.*` | 卡片直接用 `reason.place.{reason}` |+| `card.missing` | `card.missing.lead` | |+| `card.missing.retryMissed` | `card.missing.retryMissed` | |+| `card.picked` | `card.picked.lead` | 会放在 {path}。(加句号) |+| `import.lead / extra / found / scope / model` | `card.import.lead / extra / found / scope / model` | |+| `import.opt.regen / skipWork` | `card.import.optRegen / optSkipWork` | 勾选框的标签 |+| `import.space` | `card.importSpace.lead` | |+| `copying.step1 / 2 / 3` | `card.copying.step1 / 2 / 3` | |+| `eta.minutes`、`eta.lt1` | `card.copying.eta`、`card.copying.etaSoon` | |+| `stop.confirm` | `card.copying.stopConfirm` | |+| `inUse` | `card.inUse.lead` | |+| `newer.updating`、`newer.unreadable` | `card.newerUpdating.lead`、`card.newer.lead` | |+| `importFailed` | `card.importFailed.lead` | |+| `failed.reason.*` | 见 `reason.start.*` | 卡片直接用 `reason.start.{reason}` |+| `update.available / downloading / installing / failed / slow` | `card.update.available / downloading / installing / failed / slow` | |++原因 `reason.*`:++| 新 | 中文 | 来自 |+|---|---|---|+| `reason.place.space` | {drive} 盘只剩 {free}。 | `card.reason.space` |- | `reason.place.permission` | DeepSeek Bot 没有权限在 {path} 里写文件。 | `card.reason.permission` 和 `card.rejected.permission` 合一 |++| `reason.place.permission` | DS Bot 没有权限在 {path} 里写文件。 | `card.reason.permission` 和 `card.rejected.permission` 合一 |+| `reason.place.onedrive` | {path} 在 OneDrive 里,同步会打断正在写入的对话。 | `card.rejected.onedrive`(聊天记录 → 对话) |+| `reason.place.foreign / dsh / program / nested` | 照旧 | `card.rejected.*` |+| `reason.start.permission / space / files / engine / other` | 照旧,带句号 | `failed.reason.*` |+| `reason.copy.inUse / permission / full` | 照旧,片段 | `importFailed.*` |++按钮 `btn.*`:++| 旧 | 新 | 中文 |+|---|---|---|+| `retry`、`wait`、`openLogs`、`freshStart` | `btn.retry`、`btn.wait`、`btn.openLogs`、`btn.freshStart` | |+| `card.recommend.use`、`card.recommend.keep` | `btn.useRec`、`btn.keepDrive` | 放到 {rec} 盘、仍然放在 {drive} 盘 |+| `card.recommend.other` | `btn.otherPlace` | 其他位置…(链接样式) |+| `pickOther` | `btn.pickPlace` | 选择其他位置… |+| `place.change`、`changePlace` | `btn.changePlace` | 换个位置…(合一;英文 Change the location…) |+| `card.missing.relocate` | `btn.relocate` | 重新找到它… |+| `card.picked.use`、`card.picked.repick` | `btn.continue`、`btn.repick` | 继续、重新选…(加 …:它打开系统选择框) |+| `import.copy`、`import.skip` | `btn.copy`、`btn.skipCopy` | 复制过来、先不复制 |+| `import.more`、`import.change` | `btn.more`、`btn.changeModel` | 详细、更换 |+| `stop`、`keepCopying` | `btn.stopCopy`、`btn.keepCopying` | 停止复制、继续复制 |+| `startWithout` | `btn.startWithout` | 先不带团队开始 |+| `copyDetails`、`copied`、`details` | `btn.copyDetails`、`btn.copied`、`btn.details` | |+| `update.install`、`manualDownload`、`reload` | `btn.install`、`btn.manualDownload`、`btn.reload` | |+| 对话框的 `move`、`cancel`、`quit`、`restart`、`download` | `btn.move`、`btn.cancel`、`btn.quit`、`btn.restart`、`btn.download` | 移动并重启、取消、退出、立即重启、下载 |+| 对话框的 `copy`、`skip`、`startEmpty` | 并入 `btn.copy`、`btn.skipCopy`、`btn.startWithout` | 复制过来、先不复制、先不带团队开始 |+| 更新框的 `later` | `btn.notNowRestart`、`btn.notNowDownload` | 先不重启、先不下载(「稍后」是过程词) |+| 写死的 `'OK'` | `btn.ok` | 确定 |++脚注 `note.*`:`card.footnote` → `note.changeLater`「以后可以在 设置 → 通用 → 位置 里改。」;`import.footnote` → `note.copyLater`「也可以在 设置 → 通用 → 位置 里复制。」;`newer.footnote` → `note.copyAgain`「以后可以在 设置 → 通用 → 位置 里复制。」(和 `note.changeLater` 同一个句式)。++底注 `foot.*`:`footer` → `foot.community`;`place.drive / driveOnly / path / pathOnly` → `foot.place.drive / driveOnly / path / pathOnly`。++状态 `status.*`:`track.label` → `status.track`;`phase.*` → `status.phase.*`;`state.*` → `status.state.*`;`sr.*` → `status.sr.*`;`elapsed` → `status.elapsed`。++对话框 `dialog.*`(原来在 `first-run.mjs` 和 `updates.mjs`):++| 新 | 中文 |+|---|---|- | `dialog.pickRoot` | 选择 DeepSeek Bot 放数据的位置 |- | `dialog.pickMove` | 选择 DeepSeek Bot 数据的新文件夹 |++| `dialog.pickRoot` | 选择 DS Bot 放数据的位置 |++| `dialog.pickMove` | 选择 DS Bot 数据的新文件夹 |+| `dialog.move.inDsh` | 请选择 DeepSeek Harness 数据({home})以外的文件夹。 |+| `dialog.move.inProgram / drive / nested / workspace / notEmpty` | 照旧 |- | `dialog.move.confirm`、`dialog.move.detail` | 把 DeepSeek Bot 的数据移到 {to} 吗? / DeepSeek Bot 会把数据复制过去,然后重新启动。{from} 会原样保留,确认一切正常后可以自己删掉。 |++| `dialog.move.confirm`、`dialog.move.detail` | 把 DS Bot 的数据移到 {to} 吗? / DS Bot 会把数据复制过去,然后重新启动。{from} 会原样保留,确认一切正常后可以自己删掉。 |+| `dialog.move.inUse`、`dialog.move.failed` | 照旧(`{message}`) |- | `dialog.import.found` | DeepSeek Harness 里有 {bots} 个 Bot 和 {groups} 个群聊。要复制到 DeepSeek Bot 吗?(原来 0 个群聊时不写群;现在和导入卡一样总写) |++| `dialog.import.found` | DeepSeek Harness 里有 {bots} 个 Bot 和 {groups} 个群聊。要复制到 DS Bot 吗?(原来 0 个群聊时不写群;现在和导入卡一样总写) |+| `dialog.import.foundDetail` | 会复制 Bot、群聊、记忆、对话、附件、模型设置和 API Key。{home} 里的内容不会改变,复制以后两边各用各的。(群 → 群聊,密钥 → API Key,文件 → 附件,和 `card.import.scope` 一致) |+| `dialog.import.inUse` | DeepSeek Harness 正在使用这个团队。请先关掉它,再重试。 |- | `dialog.import.newer` | 有 {n} 段对话是更新版本的 DeepSeek Harness 写的,这个版本的 DeepSeek Bot 读不了。请先更新 DeepSeek Bot,再打开它来复制团队。 |- | `dialog.import.whichModels` | DeepSeek Bot 用哪一份模型设置? |- | `dialog.import.failed` | 团队没有复制完:{message}\n\nDeepSeek Bot 会用一个新团队开始。DeepSeek Harness 里的团队没有变化。(没有复制成功 → 没有复制完,和 `card.importFailed.lead` 一致) |- | `dialog.update.ready`、`dialog.update.readyDetail` | DeepSeek Bot {version} 已经下载好。 / 现在重启就能更新;不重启的话,下次退出时安装。(英文改成 has finished downloading,原来说的是 ready to install) |++| `dialog.import.newer` | 有 {n} 段对话是更新版本的 DeepSeek Harness 写的,这个版本的 DS Bot 读不了。请先更新 DS Bot,再打开它来复制团队。 |++| `dialog.import.whichModels` | DS Bot 用哪一份模型设置? |++| `dialog.import.failed` | 团队没有复制完:{message}\n\nDS Bot 会用一个新团队开始。DeepSeek Harness 里的团队没有变化。(没有复制成功 → 没有复制完,和 `card.importFailed.lead` 一致) |++| `dialog.update.ready`、`dialog.update.readyDetail` | DS Bot {version} 已经下载好。 / 现在重启就能更新;不重启的话,下次退出时安装。(英文改成 has finished downloading,原来说的是 ready to install) |+| `dialog.update.available`、`dialog.update.availableDetail` | 照旧 |+| `dialog.update.onFailure`、`dialog.update.onFailurePage` | 照旧 |++### 4. 英文++- 逐键对照中文的意思,不另写一套:位置行写全「Data on drive {drive}, {free} free」(原来只有「Drive C, 412 GB free」)。+- 句首大写;`voice / say / hint / btn / foot / status` 不加句号;`card / reason(整句)/ note / dialog` 以句号或问号结尾;… 和中文同步。+- 名词:chats(不用 conversations)、group chats、attachments、API Key、Settings → General → Location(单数)、team workspace、data folder、local engine。+- 单复数用 `{n|one|many}`:`hint.reinstall`「Your {bots|Bot|Bots} and {groups|group chat|group chats} are still here」、`card.import.lead`、`card.import.found`、`dialog.import.found`、`dialog.import.newer`。+- 「先不复制」是 Don't copy yet,「先不带团队开始」是 Start without the team,「先不重启」Not now(重启框)、「先不下载」Not now(下载框)。++### 5. 测试++`app/test/start-page.test.mjs` 扫 `text.mjs` 全表、`start.html`、`start.js`、`whale.js`,以及 `main.mjs`、`first-run.mjs`、`updates.mjs`:++- 已有的:中英键集和占位符相同;中文里没有白名单外的英文;没有 马上 / 稍后 / 下个版本;页面用到的键都在表里。+- 新加的:+ - 每个键的第一段是十层之一。+ - `voice / say / hint / btn / foot / status` 的中文不以 。 结尾,英文不以 . 结尾;`card / note / dialog` 的整句以 。? 结尾(`reason.copy.*`、`card.update.slow`「下载太慢?」、选择框标题、`card.copying.step*`、`card.copying.eta*`、`card.import.model`、`card.import.opt*`、进度行 `card.update.downloading` 除外,测试里列明)。+ - 字数上限(去掉占位符后):`voice` 16、`say` 12、`hint` 22、`btn` 10。+ - `start.html` 里 `data-act="pick"` 的按钮,键的中文以 … 结尾。+ - 主进程三个文件里 `tx('…')` 用到的键都在表里;`first-run.mjs` 和 `updates.mjs` 里没有自己的字符串表。+ - `t()` 的单复数:`{bots|Bot|Bots}` 在 1 和 6 上各填对。++## 改动的已定设计++| 原来 | 现在 | 原因 |+|---|---|---|- | 启动窗口稿第 7 节、上手流程第 3 节:鲸鱼的话「团队界面没有加载出来。」 | 「团队界面没有加载出来」 | 鲸鱼那一行不加句号,和「DeepSeek Bot 没能启动」一致 |++| 启动窗口稿第 7 节、上手流程第 3 节:鲸鱼的话「团队界面没有加载出来。」 | 「团队界面没有加载出来」 | 鲸鱼那一行不加句号,和「DS Bot 没能启动」一致 |+| 启动窗口稿第 5 节、上手流程第 8 节:45 秒「比平时慢,请再等一会儿。」 | 「比平时慢,请再等一会儿」 | 提示行不加句号 |- | 启动窗口稿第 6 节、上手流程第 3 节:「会放在 `D:\DeepSeek Bot`」〔继续〕〔重新选〕 | 「会放在 `D:\DeepSeek Bot`。」〔继续〕〔重新选…〕 | 卡片正文以句号结尾;打开系统选择框的按钮以 … 结尾(被拒绝的卡上的〔重新选…〕一样) |++| 启动窗口稿第 6 节、上手流程第 3 节:「会放在 `D:\DS Bot`」〔继续〕〔重新选〕 | 「会放在 `D:\DS Bot`。」〔继续〕〔重新选…〕 | 卡片正文以句号结尾;打开系统选择框的按钮以 … 结尾(被拒绝的卡上的〔重新选…〕一样) |+| 启动窗口稿第 6 节:「…在 OneDrive 里,同步会打断正在写入的聊天记录。」 | 「…正在写入的对话。」 | 一个东西一个名字 |+| 上手流程第 4 节:更新版本那张卡的脚注「可以在 设置 → 通用 → 位置 里再复制。」 | 「以后可以在 设置 → 通用 → 位置 里复制。」 | 和「以后可以在 … 里改。」同一个句式 |+| `first-run.mjs`:导入对话框〔复制〕〔不复制〕〔不带团队开始〕 | 〔复制过来〕〔先不复制〕〔先不带团队开始〕 | 和导入卡同一种写法;对话框只到导入卡落地(M5)为止 |- | `first-run.mjs`:「DeepSeek Harness 里有一个 Bot 团队:6 个 Bot、2 个群。」「会复制 Bot、群、记忆、对话、文件、密钥和模型设置。」 | 「DeepSeek Harness 里有 6 个 Bot 和 2 个群聊。要复制到 DeepSeek Bot 吗?」「会复制 Bot、群聊、记忆、对话、附件、模型设置和 API Key。…」 | 群聊、附件、API Key 是定下的名字 |++| `first-run.mjs`:「DeepSeek Harness 里有一个 Bot 团队:6 个 Bot、2 个群。」「会复制 Bot、群、记忆、对话、文件、密钥和模型设置。」 | 「DeepSeek Harness 里有 6 个 Bot 和 2 个群聊。要复制到 DS Bot 吗?」「会复制 Bot、群聊、记忆、对话、附件、模型设置和 API Key。…」 | 群聊、附件、API Key 是定下的名字 |+| 桌面应用稿 安装和更新、`updates.mjs`:更新框的〔稍后〕 | 〔先不重启〕〔先不下载〕 | 稍后是过程词,UI 标准第 11 节 |+| `main.mjs`:搬数据被拒绝的框只有英文的〔OK〕 | 〔确定〕/〔OK〕按语言 | 表以外不再有用户看得到的字 |++## 不做什么++- 不改任何一句的意思;上面没列的句子一个字不动。+- 不把插件里(团队界面、设置、Main Bot 聊天里的卡)的文案搬进这张表:那些在 `i18n.js`,源语言是英文(UI 标准第 11 节)。上手流程第 4、8 节里属于设置和聊天的句子不在这里。- - 不给启动页加新的句子。上手流程第 3 节定了〔重新找到它…〕选到没有数据的文件夹时写「这里没有 DeepSeek Bot 的数据。」,`.deepseek-bot` 标记还没落地,这句等那一步一起加(`card.missing.noData`)。++- 不给启动页加新的句子。上手流程第 3 节定了〔重新找到它…〕选到没有数据的文件夹时写「这里没有 DS Bot 的数据。」,`.deepseek-bot` 标记还没落地,这句等那一步一起加(`card.missing.noData`)。+- 不改 `dialog.move.detail` 说的「{from} 会原样保留」:它说的是今天代码的行为;上手流程第 8 节「搬是搬,旧位置不留副本」落地时一起改。+- 不改 `dialog.update.availableDetail` 里「应用程序」文件夹的说法(macOS 的话也给了 Linux deb):属于更新流程,另记。++## 已知限制++- 字数上限按中文字符数算,去掉占位符后,一串连着的英文字母或数字(DeepSeek、GB)算一个字;英文不限长度:英文是否折行由样式决定,一行放不下时先改句子。+- 单复数只有英文 1 和多两种形,够启动页用;别的语言不在范围里。+- 测试里的「以 … 结尾」只查 `data-act="pick"` 的按钮;对话框里打开选择框的按钮(没有)不在内。++## 变更++- 2026-10-29 首稿:十层、一张表、键的对照、测试;对应 `text.mjs` 重排、`first-run.mjs` 和 `updates.mjs` 的表并入、`start.html` 和 `start.js` 改键。依据:2026-10-29 对三张表的审读(30 个对话框键和 11 个更新键都在用,没有死键;页面表和两份设计稿逐句对照只有 `failed.reason.*` 的句号一处不同;风格问题 30 条,全部复核过)。diff --cc ds-bot/client.jsindex c0009ba0,1dcae995..23fabcc4--- a/ds-bot/client.js+++ b/ds-bot/client.js@@@ -557,7 -522,7 +558,8 @@@ var ZH ="DS Bot settings": "DS Bot 设置","Settings pages": "设置页面","Models, providers, and the rest of DeepSeek Harness": "模型、服务商和 DeepSeek Harness 的其他设置",- "Advanced settings (DeepSeek Harness)": "高级设置(DeepSeek Harness)",+ "Harness settings": "Harness 设置",++ "Open Harness settings": "打开 Harness 设置","Back to Bots": "返回 Bot 列表","Close settings": "关闭设置",// Context menu@@@ -1114,8 -1115,8 +1158,7 @@@Unit: "单位","Create task": "创建任务","Turn on Automation tasks in DSH": "在 DSH 里打开「自动化任务」",- "Switch on Automation tasks on the Plugins page in Advanced settings (DeepSeek Harness).": "在「高级设置(DeepSeek Harness)」的插件页启用「自动化任务」。",- "Open Advanced settings (DeepSeek Harness)": "打开高级设置(DeepSeek Harness)",+ "Switch on Automation tasks on the Plugins page in Harness settings.": "在 Harness 设置的插件页启用「自动化任务」。",- "Open Harness settings": "打开 Harness 设置","New task": "新建任务","No scheduled tasks yet.": "还没有定时任务。","No scheduled tasks yet. Add one": "还没有定时任务,去添加",@@@ -1527,8 -1522,8 +1569,8 @@@ function bodyOf(def, paint, flat = falsreturn "";}}- var eyeMarkup = ([cx, cy, w, h50, tilt]) => `<g transform="translate(${cx} ${cy}) rotate(${tilt})"><rect class="bt-eye" x="${-w / 2}" y="${-h50 / 2}" width="${w}" height="${h50}" rx="${w / 2}"/></g>`;- var happyEyeMarkup = ([cx, cy, w, h50, tilt]) => `<g transform="translate(${cx} ${cy}) rotate(${tilt})"><path class="bt-eye-happy" opacity="0" d="M${-w * 0.62} ${h50 * 0.14}Q0 ${-h50 * 0.42} ${w * 0.62} ${h50 * 0.14}" fill="none" stroke="#000" stroke-width="${w * 0.5}" stroke-linecap="round"/></g>`;-var eyeMarkup = ([cx, cy, w, h51, tilt]) => `<g transform="translate(${cx} ${cy}) rotate(${tilt})"><rect class="bt-eye" x="${-w / 2}" y="${-h51 / 2}" width="${w}" height="${h51}" rx="${w / 2}"/></g>`;-var happyEyeMarkup = ([cx, cy, w, h51, tilt]) => `<g transform="translate(${cx} ${cy}) rotate(${tilt})"><path class="bt-eye-happy" opacity="0" d="M${-w * 0.62} ${h51 * 0.14}Q0 ${-h51 * 0.42} ${w * 0.62} ${h51 * 0.14}" fill="none" stroke="#000" stroke-width="${w * 0.5}" stroke-linecap="round"/></g>`;++var eyeMarkup = ([cx, cy, w, h52, tilt]) => `<g transform="translate(${cx} ${cy}) rotate(${tilt})"><rect class="bt-eye" x="${-w / 2}" y="${-h52 / 2}" width="${w}" height="${h52}" rx="${w / 2}"/></g>`;++var happyEyeMarkup = ([cx, cy, w, h52, tilt]) => `<g transform="translate(${cx} ${cy}) rotate(${tilt})"><path class="bt-eye-happy" opacity="0" d="M${-w * 0.62} ${h52 * 0.14}Q0 ${-h52 * 0.42} ${w * 0.62} ${h52 * 0.14}" fill="none" stroke="#000" stroke-width="${w * 0.5}" stroke-linecap="round"/></g>`;var maskBox = (size) => `maskUnits="userSpaceOnUse" x="${-size}" y="${-size}" width="${size * 3}" height="${size * 3}"`;var holes = (def, eyes) => `<rect x="${-def.size}" y="${-def.size}" width="${def.size * 3}" height="${def.size * 3}" fill="#fff"/>${eyes}`;var MASK_ID = "%MASK%";@@@ -2289,12 -2283,12 +2340,12 @@@ function liveSprings(apply2)const dt = Math.min(0.5, Math.max(1e-3, (now - last) / 1e3));last = now;const steps = Math.ceil(dt * 240);- const h50 = dt / steps;- const h51 = dt / steps;++ const h52 = dt / steps;let moving = false;for (const value of values.values()) {for (let index = 0; index < steps; index += 1) {- value.v += (-value.k * (value.x - value.to) - value.c * value.v) * h50;- value.x += value.v * h50;- value.v += (-value.k * (value.x - value.to) - value.c * value.v) * h51;- value.x += value.v * h51;++ value.v += (-value.k * (value.x - value.to) - value.c * value.v) * h52;++ value.x += value.v * h52;}if (Math.abs(value.x - value.to) < 0.05 && Math.abs(value.v) < 1) {value.x = value.to;@@@ -8362,11 -9089,10 +9148,11 @@@ function TriggerCell({ node, sessionId});}if (source.role === "report") {- return (0, import_react16.createElement)(GroupEvent, { prefix: t("Replies from"), room: roster.roomsById[source.roomId], name: t("a group chat"), roster, actions });+ return (0, import_react19.createElement)(GroupEvent, { prefix: t("Replies from"), room: roster.roomsById[source.roomId], name: t("a group chat"), roster, actions });}- if (source.role === "resume" || source.resumed === true) return (0, import_react16.createElement)("div", { className: "bt-event" }, t("Picked up its work after a restart"));- if (source.role === "retry" || source.retried === true) return (0, import_react16.createElement)("div", { className: "bt-event" }, t("Asked to make the tool call it wrote as text"));- if (source.role === "continue") return (0, import_react16.createElement)("div", { className: "bt-event" }, t("Went on after the failed turn"));+ if (source.role === "resume" || source.resumed === true) return (0, import_react19.createElement)("div", { className: "bt-event" }, t("Picked up its work after a restart"));+ if (source.role === "retry" || source.retried === true) return (0, import_react19.createElement)("div", { className: "bt-event" }, t("Asked to make the tool call it wrote as text"));++ if (source.role === "continue") return (0, import_react19.createElement)("div", { className: "bt-event" }, t("Went on after the failed turn"));const run2 = relayed ? commRunOf(order.split(",").filter(Boolean).map(Number),Object.fromEntries(peers.split(",").filter(Boolean).map((pair) => [Number(pair.slice(0, pair.indexOf(":"))), pair.slice(pair.indexOf(":") + 1)])),@@@ -9618,11 -10317,10 +10377,11 @@@ function TeamSidebar(props)const main = roster.byId[roster.mainBotId];useListGlide(listRef, wideContent, order.map((entry) => entry.item.id).join(","));useLandOnMainBot(roster, useSessions, actions);+ useReportReady(roster.ready);const openWidth = drag?.width ?? frameSnap.sidebarWidth;- const ourWidth = mode === "rail" ? RAIL_WIDTH : openWidth;+ const ourWidth = shown === "rail" ? RAIL_WIDTH : openWidth;const pushed = mode === "open" ? openWidth : mode === "hidden" ? 0 : RAIL_WIDTH;- (0, import_react18.useLayoutEffect)(() => {+ (0, import_react21.useLayoutEffect)(() => {if (typeof document === "undefined") return;chatRoom.setLeft(Math.max(0, pushed - (frameSnap.collapsedWidth ?? 0)));}, [pushed, frameSnap.collapsedWidth]);@@@ -9947,18 -10696,6 +10757,18 @@@ function openHarnessOnboarding(id)else openHarnessSettings();});}+var MODELS_STEP = "ds-bot-models";+var MODELS_STEP_ORDER = 1e3;+function OpenModelsStep({ explicit, complete, openSection }) {- (0, import_react18.useEffect)(() => {++ (0, import_react21.useEffect)(() => {+ if (explicit) {+ if (typeof openSection === "function") openSection("models");+ else openHarnessSettings();+ }+ complete();+ }, [explicit]);+ return null;+}function openThroughMenu(trigger) {const before = new Set(document.querySelectorAll('[role="menu"]'));trigger.click();@@@ -10043,15 -10780,14 +10853,15 @@@ function AccountLauncher({ seat = true};}, [open]);const signIn = actions.signInEntry?.() ?? null;- const ops = (0, import_react18.useMemo)(() => signIn?.inject?.() ?? {}, [signIn]);+ const ops = (0, import_react21.useMemo)(() => signIn?.inject?.() ?? {}, [signIn]);const accountSource = ops.hooks?.account;- const account = (0, import_react18.useSyncExternalStore)(accountSource?.subscribe ?? NO_SUBSCRIBE, accountSource ? () => accountSource.getSnapshot() : NO_SNAPSHOT);+ const account = (0, import_react21.useSyncExternalStore)(accountSource?.subscribe ?? NO_SUBSCRIBE, accountSource ? () => accountSource.getSnapshot() : NO_SNAPSHOT);const signedIn = signIn !== null && typeof ops.signOut === "function" && account?.view?.status === "credential-stored";+ const signedOut = signIn !== null && typeof actions.signIn === "function" && account?.view?.status === "signed-out";const accountT = actions.accountT?.() ?? ((key) => key);- const [confirm, setConfirm] = (0, import_react18.useState)(null);- const [busy, setBusy] = (0, import_react18.useState)(false);- const [signOutError, setSignOutError] = (0, import_react18.useState)("");+ const [confirm, setConfirm] = (0, import_react21.useState)(null);+ const [busy, setBusy] = (0, import_react21.useState)(false);+ const [signOutError, setSignOutError] = (0, import_react21.useState)("");const askSignOut = async () => {setSignOutError("");let state = "none";@@@ -10111,28 -10845,27 +10921,28 @@@]];if (signedIn) groups.push([[accountT("signOut"), SignOutIcon, askSignOut, void 0, true]]);+ else if (signedOut) groups.push([[t("Sign in to DeepSeek"), SignInIcon, () => actions.signIn()]]);- return (0, import_react18.createElement)(- import_react18.Fragment,+ return (0, import_react21.createElement)(+ import_react21.Fragment,null,- (0, import_react18.createElement)(+ (0, import_react21.createElement)("button",{ ref: button, type: "button", className: "bt-account", "aria-label": t("Account"), "aria-haspopup": "menu", "aria-expanded": open, onClick: toggle },- (0, import_react18.createElement)("span", { className: "bt-you", "aria-hidden": true }, (0, import_react18.createElement)(BotMark, { look: MAIN_LOOK, size: 24 }))+ (0, import_react21.createElement)("span", { className: "bt-you", "aria-hidden": true }, (0, import_react21.createElement)(GearIcon))),- open && box ? (0, import_react_dom3.createPortal)((0, import_react18.createElement)(+ open && box ? (0, import_react_dom3.createPortal)((0, import_react21.createElement)("div",{ className: "bt-menu bt-menu-up bt-account-menu", role: "menu", "aria-label": t("Account"), style: box },- confirm !== null ? (0, import_react18.createElement)(+ confirm !== null ? (0, import_react21.createElement)("div",{ className: "bt-confirm", role: "alertdialog", "aria-label": accountT("signOut") },- (0, import_react18.createElement)("p", { className: "bt-confirm-text" }, accountT(confirm === "running" ? "signOutRunningDescription" : confirm === "unknown" ? "signOutUnknownDescription" : "signOutDescription")),- signOutError !== "" ? (0, import_react18.createElement)("p", { className: "bt-confirm-error", role: "alert" }, signOutError) : null,- (0, import_react18.createElement)(+ (0, import_react21.createElement)("p", { className: "bt-confirm-text" }, accountT(confirm === "running" ? "signOutRunningDescription" : confirm === "unknown" ? "signOutUnknownDescription" : "signOutDescription")),+ signOutError !== "" ? (0, import_react21.createElement)("p", { className: "bt-confirm-error", role: "alert" }, signOutError) : null,+ (0, import_react21.createElement)("div",{ className: "bt-confirm-row" },- (0, import_react18.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: cancelSignOut }, t("Cancel")),- (0, import_react18.createElement)("button", { type: "button", className: "bt-confirm-go", disabled: busy, onClick: () => {+ (0, import_react21.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: cancelSignOut }, t("Cancel")),+ (0, import_react21.createElement)("button", { type: "button", className: "bt-confirm-go", disabled: busy, onClick: () => {void runSignOut();} }, accountT("signOut")))@@@ -10153,14 -10886,6 +10963,14 @@@), document.body) : null);}+var readyReported = false;+function useReportReady(drawn) {- (0, import_react18.useEffect)(() => {++ (0, import_react21.useEffect)(() => {+ if (!drawn || readyReported) return;+ readyReported = true;+ void Promise.resolve().then(() => globalThis.dsBotApp?.ready?.()).catch(quietly("app ready"));+ }, [drawn]);+}function useLandOnMainBot(roster, useSessions, actions) {const mainView = useSessions((list) => {const row = Object.values(list.byId).find((session) => (session?.retainedBy?.mainView ?? 0) > 0);@@@ -10188,18 -10919,16 +11004,18 @@@function FooterAccount(props) {const seated = props.useUi((value) => value.accountSeated === true);if (seated) return null;- return (0, import_react18.createElement)("span", { className: "bt-foot-account" }, (0, import_react18.createElement)(AccountLauncher, { ...props, seat: false }));+ return (0, import_react21.createElement)("span", { className: "bt-foot-account" }, (0, import_react21.createElement)(AccountLauncher, { ...props, seat: false }));}-function BotReturn({ wide, useSurface, actions }) {+function BotReturn({ wide, useSurface, useRoster, actions }) {const mode = useSurface((value) => value.mode);+ const ready = useRoster((value) => value.ready);+ useReportReady(mode === "agent" && ready);if (mode !== "agent") return null;- return (0, import_react18.createElement)(+ return (0, import_react21.createElement)("button",{ type: "button", className: "bt-return", "aria-label": t("DS Bot"), title: t("DS Bot"), onClick: () => actions.setSurface("bot") },- (0, import_react18.createElement)(BotMark, { look: MAIN_LOOK, size: 20 }),- wide ? (0, import_react18.createElement)("span", { className: "bt-return-name" }, t("DS Bot")) : null+ (0, import_react21.createElement)(BotMark, { look: MAIN_LOOK, size: 20 }),+ wide ? (0, import_react21.createElement)("span", { className: "bt-return-name" }, t("DS Bot")) : null);}var RETURN_CSS = `@@@ -11370,8 -12148,204 +12235,8 @@@ function installHeaderNavigation(slots};}-// src/client/palette.js-var import_react25 = require("react");-var PALETTE_EXIT_MS = 160;-function CommandPalette({ start, token, roster, actions, useSessions }) {- const [query, setQuery] = (0, import_react25.useState)(start ?? "");- const [cursor, setCursor] = (0, import_react25.useState)(0);- const [leaving, setLeaving] = (0, import_react25.useState)(false);- const wanted = query.trim().toLowerCase();- const close = () => {- if (leaving) return;- setLeaving(true);- setTimeout(() => actions.closePalette(token), PALETTE_EXIT_MS);- };- useEscape(close);- const ids = [...roster.bots.map(currentPart), ...roster.rooms.map((item) => item.id)];- const found = useSessions((list) => {- if (wanted.length < 2) return "[]";- const hits = [];- for (const id of ids) {- const outline = list.projectionsBySession?.[id]?.values?.turnOutline ?? list.byId[id]?.projectionValues?.turnOutline;- if (!Array.isArray(outline)) continue;- const hidden = roster.exchangeTurns[id] ?? [];- for (let index2 = outline.length - 1; index2 >= 0 && hits.length < 30; index2 -= 1) {- const entry = outline[index2];- if (hidden.includes(entry.turn)) continue;- for (const raw of [entry.response, entry.prompt]) {- const text = stripHeader(raw ?? "").replace(/\s+/g, " ").trim();- const at = text.toLowerCase().indexOf(wanted);- if (at < 0) continue;- const from = Math.max(0, at - 24);- hits.push([id, entry.turn, (from > 0 ? "…" : "") + text.slice(from, at + wanted.length + 60)]);- break;- }- }- }- return JSON.stringify(hits);- });- const matchesName = (...fields) => wanted === "" || fields.some((field) => (field ?? "").toLowerCase().includes(wanted));- const sections = [];- const people = [- ...roster.bots.filter((bot) => matchesName(bot.name, bot.role)).map((bot) => ({- key: bot.id,- avatar: (0, import_react25.createElement)(BotAvatar, { bot, size: 24, badge: false, live: false }),- title: bot.name,- subtitle: [bot.role, isMainOf(roster, bot.id) ? t("Main Bot") : ""].filter(Boolean).join(" · "),- badge: bot.hidden ? t("Hidden") : void 0,- run: async () => {- if (bot.hidden) await actions.setFlags(bot.id, { hidden: false });- actions.openSession(bot.id);- }- })),- ...roster.rooms.filter((room2) => matchesName(room2.name)).map((room2) => ({- key: room2.id,- avatar: (0, import_react25.createElement)(RoomAvatar, { room: room2, roster, size: 24 }),- title: room2.name,- subtitle: t("{count} members", { count: room2.members.length }),- badge: room2.hidden ? t("Hidden") : void 0,- run: async () => {- if (room2.hidden) await actions.setFlags(room2.id, { hidden: false });- actions.openSession(room2.id);- }- }))- ];- if (people.length) sections.push([t("Bots"), people]);- const agents = (roster.agents ?? []).filter(() => matchesName("DSH Agent")).map((agent) => ({- key: agent.id,- avatar: (0, import_react25.createElement)("span", { className: "bt-palette-agent" }, (0, import_react25.createElement)(import_dsh_client_ui_primitives.FishLogo, { size: 18 })),- title: "DSH Agent",- subtitle: t("Plain dsh session"),- run: () => actions.openAgent(agent.id)- }));- if (agents.length) sections.push(["DSH Agent", agents]);- const messages = JSON.parse(found).map(([id, turn, snippet]) => {- const bot = roster.byId[id];- const room2 = roster.roomsById[id];- return {- key: `${id}:${turn}`,- title: bot?.name ?? room2?.name ?? t("Bot"),- subtitle: snippet,- avatar: bot ? (0, import_react25.createElement)(BotAvatar, { bot, size: 24, badge: false, live: false }) : (0, import_react25.createElement)(RoomAvatar, { room: room2, roster, size: 24 }),- run: () => actions.openSession(id)- };- });- if (messages.length) sections.push([t("Messages"), messages]);- const commands = [- { key: "cmd:new", icon: (0, import_react25.createElement)(PlusIcon), title: t("New chat"), run: () => actions.openNewChat("new") },- { key: "cmd:bot", icon: (0, import_react25.createElement)(PlusIcon), title: t("Create Bot"), run: () => actions.openNewChat("create") },- { key: "cmd:group", icon: (0, import_react25.createElement)(PeopleIcon), title: t("Create group chat"), run: () => actions.openNewChat("group") },- { key: "cmd:settings", icon: (0, import_react25.createElement)(GearIcon), title: t("Bot settings"), run: () => actions.openSettings("general") }- ].filter((command) => matchesName(command.title));- if (commands.length) sections.push([t("Commands"), commands]);- const rows2 = sections.flatMap(([, items]) => items);- const active = Math.min(cursor, Math.max(rows2.length - 1, 0));- const shown = rows2.map((row) => row.key).join("\n");- const glide = useGlide(`${active}-${shown}`, { axis: "y", ...QUICK_EDGES });- const listRef = glide.box;- useFlip(listRef, shown, "[data-flip]");- (0, import_react25.useEffect)(() => {- listRef.current?.querySelector("[aria-selected=true]")?.scrollIntoView({ block: "nearest" });- }, [active, query]);- const choose = (row) => {- if (!row || leaving) return;- void Promise.resolve(row.run()).catch((error) => actions.reportError(error, "menu"));- close();- };- let index = -1;- return (0, import_react25.createElement)(- "div",- { className: "bt-palette-layer", "data-leaving": leaving || void 0 },- (0, import_react25.createElement)("div", { className: "bt-backdrop", onMouseDown: close }),- (0, import_react25.createElement)(- "div",- { className: "bt-palette", role: "dialog", "aria-label": t("Search"), "aria-modal": true },- (0, import_react25.createElement)(- "div",- { className: "bt-palette-head" },- (0, import_react25.createElement)("span", { className: "bt-palette-glyph", "aria-hidden": true }, (0, import_react25.createElement)(SearchIcon)),- (0, import_react25.createElement)("input", {- autoFocus: true,- value: query,- placeholder: t("Search Bots, chats and messages"),- "aria-label": t("Search"),- role: "combobox",- "aria-expanded": true,- "aria-controls": "bt-palette-list",- onChange: (event) => {- setQuery(event.target.value);- setCursor(0);- },- onKeyDown: (event) => {- if (event.nativeEvent.isComposing) return;- if (event.key === "ArrowDown") {- event.preventDefault();- setCursor(Math.min(active + 1, rows2.length - 1));- } else if (event.key === "ArrowUp") {- event.preventDefault();- setCursor(Math.max(active - 1, 0));- } else if (event.key === "Enter") {- event.preventDefault();- choose(rows2[active]);- }- }- }),- query ? (0, import_react25.createElement)("button", { type: "button", className: "bt-palette-clear", "aria-label": t("Clear search"), onClick: () => {- setQuery("");- setCursor(0);- } }, (0, import_react25.createElement)(CloseIcon)) : null- ),- (0, import_react25.createElement)(- "div",- { ref: listRef, id: "bt-palette-list", className: "bt-palette-list", role: "listbox", "aria-label": t("Results") },- (0, import_react25.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),- rows2.length === 0 ? (0, import_react25.createElement)(- "div",- { className: "bt-palette-empty" },- (0, import_react25.createElement)("span", { className: "bt-palette-empty-icon", "aria-hidden": true }, (0, import_react25.createElement)(SearchIcon)),- (0, import_react25.createElement)("span", { className: "bt-palette-empty-label" }, t("No results")),- (0, import_react25.createElement)("span", { className: "bt-palette-empty-hint" }, t("Try a Bot name or words from a message"))- ) : sections.map(([title, items]) => (0, import_react25.createElement)(- import_react25.Fragment,- { key: title },- (0, import_react25.createElement)("div", { className: "bt-palette-section", role: "presentation", "data-flip": `section:${title}` }, title),- items.map((row) => {- index += 1;- const at = index;- return (0, import_react25.createElement)(- "button",- {- key: row.key,- type: "button",- role: "option",- className: "bt-palette-row",- "aria-selected": at === active,- "data-flip": row.key,- onMouseMove: () => {- if (cursor !== at) setCursor(at);- },- onClick: () => choose(row)- },- (0, import_react25.createElement)("span", { className: "bt-palette-lead" }, row.avatar ?? (0, import_react25.createElement)("span", { className: "bt-palette-cmd" }, row.icon)),- (0, import_react25.createElement)(- "span",- { className: "bt-palette-text" },- (0, import_react25.createElement)("span", { className: "bt-palette-title" }, row.title),- row.subtitle ? (0, import_react25.createElement)("span", { className: "bt-palette-sub" }, row.subtitle) : null- ),- row.badge ? (0, import_react25.createElement)("span", { className: "bt-palette-badge" }, row.badge) : null- );- })- ))- )- )- );-}-// src/client/model-menu.js- var import_react22 = require("react");-var import_react26 = require("react");++var import_react25 = require("react");var import_react_dom6 = require("react-dom");var MENU_EXIT_MS = 120;function groupModels(models) {@@@ -11401,8 -12375,8 +12266,8 @@@ function modelOf(bot, roster)}var effortCache = /* @__PURE__ */ new Map();function useEfforts(served, ref, actions) {- const [fetched, setFetched] = (0, import_react22.useState)(void 0);- (0, import_react22.useEffect)(() => {- const [fetched, setFetched] = (0, import_react26.useState)(void 0);- (0, import_react26.useEffect)(() => {++ const [fetched, setFetched] = (0, import_react25.useState)(void 0);++ (0, import_react25.useEffect)(() => {setFetched(void 0);if (ref === void 0 || served?.reasoning !== void 0 || actions?.efforts === void 0) return void 0;let live = true;@@@ -11427,12 -12401,12 +12292,12 @@@ function effortRows(reasoning)];}function EffortRows({ reasoning, current, onPick }) {- return (0, import_react22.createElement)(- import_react22.Fragment,- return (0, import_react26.createElement)(- import_react26.Fragment,++ return (0, import_react25.createElement)(++ import_react25.Fragment,null,- (0, import_react22.createElement)("div", { className: "bt-menu-sep", role: "separator" }),- (0, import_react22.createElement)("div", { className: "bt-model-group", role: "presentation" }, t("Thinking level")),- effortRows(reasoning).map((row) => (0, import_react22.createElement)(- (0, import_react26.createElement)("div", { className: "bt-menu-sep", role: "separator" }),- (0, import_react26.createElement)("div", { className: "bt-model-group", role: "presentation" }, t("Thinking level")),- effortRows(reasoning).map((row) => (0, import_react26.createElement)(++ (0, import_react25.createElement)("div", { className: "bt-menu-sep", role: "separator" }),++ (0, import_react25.createElement)("div", { className: "bt-model-group", role: "presentation" }, t("Thinking level")),++ effortRows(reasoning).map((row) => (0, import_react25.createElement)("button",{key: row.effort ?? "default",@@@ -11441,17 -12415,17 +12306,17 @@@"aria-checked": (row.effort ?? null) === (current ?? null),onClick: () => onPick(row.effort)},- (0, import_react22.createElement)("span", { className: "bt-menu-label" }, row.label),- (0, import_react22.createElement)("span", { className: "bt-model-tick", "aria-hidden": true }, (row.effort ?? null) === (current ?? null) ? (0, import_react22.createElement)(CheckIcon) : null)- (0, import_react26.createElement)("span", { className: "bt-menu-label" }, row.label),- (0, import_react26.createElement)("span", { className: "bt-model-tick", "aria-hidden": true }, (row.effort ?? null) === (current ?? null) ? (0, import_react26.createElement)(CheckIcon) : null)++ (0, import_react25.createElement)("span", { className: "bt-menu-label" }, row.label),++ (0, import_react25.createElement)("span", { className: "bt-model-tick", "aria-hidden": true }, (row.effort ?? null) === (current ?? null) ? (0, import_react25.createElement)(CheckIcon) : null))));}function ModelRows({ roster, current, onPick }) {- return groupModels(roster.models).map(([provider, list]) => (0, import_react22.createElement)(- import_react22.Fragment,- return groupModels(roster.models).map(([provider, list]) => (0, import_react26.createElement)(- import_react26.Fragment,++ return groupModels(roster.models).map(([provider, list]) => (0, import_react25.createElement)(++ import_react25.Fragment,{ key: list[0].provider ?? provider },- (0, import_react22.createElement)("div", { className: "bt-model-group", role: "presentation" }, provider),- list.map((model) => (0, import_react22.createElement)(- (0, import_react26.createElement)("div", { className: "bt-model-group", role: "presentation" }, provider),- list.map((model) => (0, import_react26.createElement)(++ (0, import_react25.createElement)("div", { className: "bt-model-group", role: "presentation" }, provider),++ list.map((model) => (0, import_react25.createElement)("button",{key: model.ref,@@@ -11461,25 -12435,25 +12326,25 @@@title: model.ref,onClick: () => onPick(model.ref)},- (0, import_react22.createElement)("span", { className: "bt-menu-label" }, model.name),- model.ref === roster.defaultModel ? (0, import_react22.createElement)("span", { className: "bt-menu-hint" }, t("Default")) : null,- (0, import_react22.createElement)("span", { className: "bt-model-tick", "aria-hidden": true }, model.ref === current ? (0, import_react22.createElement)(CheckIcon) : null)- (0, import_react26.createElement)("span", { className: "bt-menu-label" }, model.name),- model.ref === roster.defaultModel ? (0, import_react26.createElement)("span", { className: "bt-menu-hint" }, t("Default")) : null,- (0, import_react26.createElement)("span", { className: "bt-model-tick", "aria-hidden": true }, model.ref === current ? (0, import_react26.createElement)(CheckIcon) : null)++ (0, import_react25.createElement)("span", { className: "bt-menu-label" }, model.name),++ model.ref === roster.defaultModel ? (0, import_react25.createElement)("span", { className: "bt-menu-hint" }, t("Default")) : null,++ (0, import_react25.createElement)("span", { className: "bt-model-tick", "aria-hidden": true }, model.ref === current ? (0, import_react25.createElement)(CheckIcon) : null)))));}- var Caret = () => (0, import_react22.createElement)("svg", { className: "bt-model-caret", width: 12, height: 12, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true }, (0, import_react22.createElement)("path", { d: "M5.5 8l4.5 4.5L14.5 8" }));-var Caret = () => (0, import_react26.createElement)("svg", { className: "bt-model-caret", width: 12, height: 12, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true }, (0, import_react26.createElement)("path", { d: "M5.5 8l4.5 4.5L14.5 8" }));++var Caret = () => (0, import_react25.createElement)("svg", { className: "bt-model-caret", width: 12, height: 12, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true }, (0, import_react25.createElement)("path", { d: "M5.5 8l4.5 4.5L14.5 8" }));function useAnchoredMenu() {- const [anchor, setAnchor] = (0, import_react22.useState)(null);- const [place, setPlace] = (0, import_react22.useState)(null);- const [anchor, setAnchor] = (0, import_react26.useState)(null);- const [place, setPlace] = (0, import_react26.useState)(null);++ const [anchor, setAnchor] = (0, import_react25.useState)(null);++ const [place, setPlace] = (0, import_react25.useState)(null);const [shownPlace, leaving] = useLinger(place, MENU_EXIT_MS);- const button = (0, import_react22.useRef)(null);- const menu = (0, import_react22.useRef)(null);- const button = (0, import_react26.useRef)(null);- const menu = (0, import_react26.useRef)(null);++ const button = (0, import_react25.useRef)(null);++ const menu = (0, import_react25.useRef)(null);const tick = useViewport();const close = () => {setAnchor(null);setPlace(null);};- (0, import_react22.useEffect)(() => {- (0, import_react26.useEffect)(() => {++ (0, import_react25.useEffect)(() => {if (place === null) return void 0;const onDown = (event) => {if (menu.current?.contains(event.target) || button.current?.contains(event.target)) return;@@@ -11505,7 -12479,7 +12370,7 @@@};}, [place]);const open = () => setAnchor({});- (0, import_react22.useLayoutEffect)(() => {- (0, import_react26.useLayoutEffect)(() => {++ (0, import_react25.useLayoutEffect)(() => {if (anchor === null || !button.current) return;const rect = button.current.getBoundingClientRect();const width = Math.max(240, rect.width);@@@ -11544,10 -12518,10 +12409,10 @@@ function ModelMenu({ bot, roster, actio};const models = roster.models ?? [];const manage = manageModels(actions);- return (0, import_react22.createElement)(- import_react22.Fragment,- return (0, import_react26.createElement)(- import_react26.Fragment,++ return (0, import_react25.createElement)(++ import_react25.Fragment,null,- (0, import_react22.createElement)(- (0, import_react26.createElement)(++ (0, import_react25.createElement)("button",{ref: button,@@@ -11560,34 -12534,34 +12425,34 @@@"data-missing": shown !== void 0 && !shown.served && models.length > 0 ? "" : void 0,onClick: toggle},- (0, import_react22.createElement)(- (0, import_react26.createElement)(++ (0, import_react25.createElement)("span",{ className: "bt-model-copy" },- (0, import_react22.createElement)("span", { className: "bt-model-name" }, shown?.name ?? t("Choose a model")),- shown ? (0, import_react22.createElement)("span", { className: "bt-model-provider" }, shown.served || models.length === 0 ? effortLabel === void 0 ? shown.provider : `${shown.provider} · ${effortLabel}` : t("{provider} · not available", { provider: shown.provider })) : null- (0, import_react26.createElement)("span", { className: "bt-model-name" }, shown?.name ?? t("Choose a model")),- shown ? (0, import_react26.createElement)("span", { className: "bt-model-provider" }, shown.served || models.length === 0 ? !withEfforts || effortLabel === void 0 ? shown.provider : `${shown.provider} · ${effortLabel}` : t("{provider} · not available", { provider: shown.provider })) : null++ (0, import_react25.createElement)("span", { className: "bt-model-name" }, shown?.name ?? t("Choose a model")),++ shown ? (0, import_react25.createElement)("span", { className: "bt-model-provider" }, shown.served || models.length === 0 ? !withEfforts || effortLabel === void 0 ? shown.provider : `${shown.provider} · ${effortLabel}` : t("{provider} · not available", { provider: shown.provider })) : null),- (0, import_react22.createElement)(Caret)- (0, import_react26.createElement)(Caret)++ (0, import_react25.createElement)(Caret)),- shownPlace ? (0, import_react_dom6.createPortal)((0, import_react22.createElement)(- shownPlace ? (0, import_react_dom6.createPortal)((0, import_react26.createElement)(++ shownPlace ? (0, import_react_dom6.createPortal)((0, import_react25.createElement)("div",{ ref: menu, className: `bt-menu bt-model-menu${shownPlace.bottom !== void 0 ? " bt-menu-up" : ""}`, role: "menu", "aria-label": t("Model for {name}", { name: bot.name }), style: shownPlace, "data-leaving": leaving || void 0 },- models.length > 0 ? (0, import_react22.createElement)(ModelRows, { roster, current, onPick: pick2 }) : (0, import_react22.createElement)("div", { className: "bt-model-none" }, t("No models are set up in DeepSeek Harness yet.")),- effortRows(reasoning).length > 0 ? (0, import_react22.createElement)(EffortRows, { reasoning, current: picked, onPick: pickEffort }) : null,- manage ? (0, import_react22.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,- manage ? (0, import_react22.createElement)("button", { type: "button", role: "menuitem", onClick: () => {- models.length > 0 ? (0, import_react26.createElement)(ModelRows, { roster, current, onPick: pick2 }) : (0, import_react26.createElement)("div", { className: "bt-model-none" }, t("No models are set up in DeepSeek Harness yet.")),- withEfforts && effortRows(reasoning).length > 0 ? (0, import_react26.createElement)(EffortRows, { reasoning, current: picked, onPick: pickEffort }) : null,- manage ? (0, import_react26.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,- manage ? (0, import_react26.createElement)("button", { type: "button", role: "menuitem", onClick: () => {++ models.length > 0 ? (0, import_react25.createElement)(ModelRows, { roster, current, onPick: pick2 }) : (0, import_react25.createElement)("div", { className: "bt-model-none" }, t("No models are set up in DeepSeek Harness yet.")),++ withEfforts && effortRows(reasoning).length > 0 ? (0, import_react25.createElement)(EffortRows, { reasoning, current: picked, onPick: pickEffort }) : null,++ manage ? (0, import_react25.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,++ manage ? (0, import_react25.createElement)("button", { type: "button", role: "menuitem", onClick: () => {close();manage();- } }, (0, import_react22.createElement)(SlidersIcon), (0, import_react22.createElement)("span", { className: "bt-menu-label" }, t("Models and providers…"))) : null- } }, (0, import_react26.createElement)(SlidersIcon), (0, import_react26.createElement)("span", { className: "bt-menu-label" }, t("Models and providers…"))) : null++ } }, (0, import_react25.createElement)(SlidersIcon), (0, import_react25.createElement)("span", { className: "bt-menu-label" }, t("Models and providers…"))) : null), document.body) : null);}function ModelChoiceDock({ sessionId, useRoster, actions }) {const roster = useRoster((value) => value);const bot = roster.byId[sessionId];- const [busy, setBusy] = (0, import_react22.useState)("");- const [error, setError] = (0, import_react22.useState)("");- const [busy, setBusy] = (0, import_react26.useState)("");- const [error, setError] = (0, import_react26.useState)("");++ const [busy, setBusy] = (0, import_react25.useState)("");++ const [error, setError] = (0, import_react25.useState)("");const shown = Boolean(bot) && currentPart(bot) === sessionId && roster.ready;- (0, import_react22.useEffect)(() => {- (0, import_react26.useEffect)(() => {++ (0, import_react25.useEffect)(() => {if (shown) void actions.refreshModels?.();}, [shown, sessionId]);if (!bot || currentPart(bot) !== sessionId || !roster.ready) return null;@@@ -11606,12 -12580,12 +12471,12 @@@}).finally(() => setBusy(""));};const text = lost ? t("{model} is not available anymore. Pick another model for me.", { model: bot.model.split("/").slice(1).join("/") }) : keyFor ? t("Hi, I'm {name}. I need a {provider} API key before I can start.", { name: bot.name, provider: keyFor.providerName ?? keyFor.provider }) : usable.length === 0 ? t("Hi, I'm {name}. I don't have a model yet. How do you want to set one up?", { name: bot.name }) : t("Hi, I'm {name}. Pick a model for me first. You can change it later in my details.", { name: bot.name });- const choices = usable.length === 0 ? setupChoices(actions).map(([label, run2]) => (0, import_react22.createElement)("button", { key: label, type: "button", className: "bt-model-chip", onClick: run2 }, label)) : [- ...groupModels(usable).map(([provider, list]) => (0, import_react22.createElement)(- const choices = usable.length === 0 ? setupChoices(actions).map(([label, run2]) => (0, import_react26.createElement)("button", { key: label, type: "button", className: "bt-model-chip", onClick: run2 }, label)) : [- ...groupModels(usable).map(([provider, list]) => (0, import_react26.createElement)(++ const choices = usable.length === 0 ? setupChoices(actions).map(([label, run2]) => (0, import_react25.createElement)("button", { key: label, type: "button", className: "bt-model-chip", onClick: run2 }, label)) : [++ ...groupModels(usable).map(([provider, list]) => (0, import_react25.createElement)("div",{ key: list[0].provider ?? provider, className: "bt-model-choice-group", role: "group", "aria-label": provider },- (0, import_react22.createElement)("div", { className: "bt-model-choice-provider", "aria-hidden": true }, provider),- (0, import_react22.createElement)("div", { className: "bt-model-choice-chips" }, list.map((model) => (0, import_react22.createElement)("button", {- (0, import_react26.createElement)("div", { className: "bt-model-choice-provider", "aria-hidden": true }, provider),- (0, import_react26.createElement)("div", { className: "bt-model-choice-chips" }, list.map((model) => (0, import_react26.createElement)("button", {++ (0, import_react25.createElement)("div", { className: "bt-model-choice-provider", "aria-hidden": true }, provider),++ (0, import_react25.createElement)("div", { className: "bt-model-choice-chips" }, list.map((model) => (0, import_react25.createElement)("button", {key: model.ref,type: "button",className: "bt-model-chip",@@@ -11620,65 -12594,54 +12485,65 @@@"aria-label": `${model.name} · ${provider}`,title: model.ref === roster.defaultModel ? `${model.ref} · ${t("Harness default")}` : model.ref,onClick: () => pick2(model.ref)- }, model.name, busy === model.ref ? (0, import_react22.createElement)("span", { className: "bt-model-spin", "aria-label": t("Saving…") }) : null)))- }, model.name, busy === model.ref ? (0, import_react26.createElement)("span", { className: "bt-model-spin", "aria-label": t("Saving…") }) : null)))++ }, model.name, busy === model.ref ? (0, import_react25.createElement)("span", { className: "bt-model-spin", "aria-label": t("Saving…") }) : null))))),- manage ? (0, import_react22.createElement)("button", { key: "manage", type: "button", className: "bt-model-chip bt-model-chip-quiet", onClick: manage }, (0, import_react22.createElement)(SlidersIcon), t("Manage models")) : null- manage ? (0, import_react26.createElement)("button", { key: "manage", type: "button", className: "bt-model-chip bt-model-chip-quiet", onClick: manage }, (0, import_react26.createElement)(SlidersIcon), t("Manage models")) : null++ manage ? (0, import_react25.createElement)("button", { key: "manage", type: "button", className: "bt-model-chip bt-model-chip-quiet", onClick: manage }, (0, import_react25.createElement)(SlidersIcon), t("Manage models")) : null];- return (0, import_react22.createElement)(- return (0, import_react26.createElement)(++ return (0, import_react25.createElement)("div",{ className: "bt-model-dock" },- (0, import_react22.createElement)(- (0, import_react26.createElement)(++ (0, import_react25.createElement)("div",{ className: "bt-astack", "data-lead": "" },- (0, import_react22.createElement)(- (0, import_react26.createElement)(++ (0, import_react25.createElement)("div",{ className: "bt-msg" },- (0, import_react22.createElement)(- (0, import_react26.createElement)(++ (0, import_react25.createElement)("div",{ className: "bt-msg-line" },- (0, import_react22.createElement)(BotMark, { bot, size: 22 }),- (0, import_react22.createElement)("div", { className: "bt-bubble" }, text)- (0, import_react26.createElement)(BotMark, { bot, size: 22 }),- (0, import_react26.createElement)("div", { className: "bt-bubble" }, text)++ (0, import_react25.createElement)(BotMark, { bot, size: 22 }),++ (0, import_react25.createElement)("div", { className: "bt-bubble" }, text)))),- keyFor ? (0, import_react22.createElement)(ModelKeyCard, { key: keyFor.provider, model: keyFor, actions }) : (0, import_react22.createElement)("div", { className: "bt-model-chips", role: "group", "aria-label": t("Choose a model") }, choices),- error ? (0, import_react22.createElement)("div", { className: "bt-secret-error bt-model-error", role: "alert" }, error) : null- keyFor ? (0, import_react26.createElement)(ModelKeyCard, { key: keyFor.provider, model: keyFor, actions }) : (0, import_react26.createElement)("div", { className: "bt-model-chips", role: "group", "aria-label": t("Choose a model") }, choices),- error ? (0, import_react26.createElement)("div", { className: "bt-secret-error bt-model-error", role: "alert" }, error) : null++ keyFor ? (0, import_react25.createElement)(ModelKeyCard, { key: keyFor.provider, model: keyFor, actions }) : (0, import_react25.createElement)("div", { className: "bt-model-chips", role: "group", "aria-label": t("Choose a model") }, choices),++ error ? (0, import_react25.createElement)("div", { className: "bt-secret-error bt-model-error", role: "alert" }, error) : null);}-function ModelKeyCard({ model, actions }) {- const [value, setValue] = (0, import_react26.useState)("");- const [busy, setBusy] = (0, import_react26.useState)(false);- const [error, setError] = (0, import_react26.useState)("");+var DEEPSEEK_KEYS_URL = "https://platform.deepseek.com/api_keys";+function ModelKeyCard({ model, actions, onSaved }) {- const [value, setValue] = (0, import_react22.useState)("");- const [busy, setBusy] = (0, import_react22.useState)(false);- const [error, setError] = (0, import_react22.useState)("");++ const [value, setValue] = (0, import_react25.useState)("");++ const [busy, setBusy] = (0, import_react25.useState)(false);++ const [error, setError] = (0, import_react25.useState)("");const label = t("{provider} API key", { provider: model.providerName ?? model.provider });const ready = value.trim() !== "" && !busy;const save = () => {if (!ready) return;setBusy(true);setError("");- void Promise.resolve(actions.setProviderKey(model.provider, value)).then(() => setValue(""), (failure) => setError(hostText(failure?.message ?? String(failure)))).finally(() => setBusy(false));+ void Promise.resolve(actions.setProviderKey(model.provider, value)).then(() => {+ setValue("");+ onSaved?.();+ }, (failure) => setError(hostText(failure?.message ?? String(failure)))).finally(() => setBusy(false));};- return (0, import_react26.createElement)(+ const official = model.provider === "deepseek-official";- return (0, import_react22.createElement)(++ return (0, import_react25.createElement)("div",{ className: "bt-q bt-model-key", role: "group", "aria-label": label },- (0, import_react22.createElement)("div", { className: "bt-model-key-title" }, (0, import_react22.createElement)(KeyIcon), label),- (0, import_react22.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react22.createElement)(MaskedInput, { value, onChange: setValue, onEnter: save, label, autoFocus: true })),- official ? (0, import_react22.createElement)(- (0, import_react26.createElement)("div", { className: "bt-model-key-title" }, (0, import_react26.createElement)(KeyIcon), label),- (0, import_react26.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react26.createElement)(MaskedInput, { value, onChange: setValue, onEnter: save, label, autoFocus: true })),- error ? (0, import_react26.createElement)("div", { className: "bt-secret-error", role: "alert" }, error) : null,- (0, import_react26.createElement)(++ (0, import_react25.createElement)("div", { className: "bt-model-key-title" }, (0, import_react25.createElement)(KeyIcon), label),++ (0, import_react25.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react25.createElement)(MaskedInput, { value, onChange: setValue, onEnter: save, label, autoFocus: true })),++ official ? (0, import_react25.createElement)(+ "div",+ { className: "bt-model-key-help" },- (0, import_react22.createElement)("a", { className: "bt-model-key-link", href: DEEPSEEK_KEYS_URL, target: "_blank", rel: "noopener noreferrer" }, t("Create a key on the DeepSeek platform ↗")),- (0, import_react22.createElement)("span", { className: "bt-model-key-note" }, t("The API is billed by usage; the account needs a balance first."))++ (0, import_react25.createElement)("a", { className: "bt-model-key-link", href: DEEPSEEK_KEYS_URL, target: "_blank", rel: "noopener noreferrer" }, t("Create a key on the DeepSeek platform ↗")),++ (0, import_react25.createElement)("span", { className: "bt-model-key-note" }, t("The API is billed by usage; the account needs a balance first."))+ ) : null,- error ? (0, import_react22.createElement)("div", { className: "bt-secret-error", role: "alert" }, error) : null,- (0, import_react22.createElement)(++ error ? (0, import_react25.createElement)("div", { className: "bt-secret-error", role: "alert" }, error) : null,++ (0, import_react25.createElement)("div",{ className: "bt-q-foot" },- actions.openModels ? (0, import_react22.createElement)("button", { type: "button", className: "bt-q-btn bt-model-key-other", onClick: actions.openModels }, t("Another provider")) : null,- (0, import_react22.createElement)("button", { type: "button", className: "bt-q-submit", disabled: !ready, onClick: save }, busy ? t("Saving…") : t("Save"))- actions.openModels ? (0, import_react26.createElement)("button", { type: "button", className: "bt-q-btn bt-model-key-other", onClick: actions.openModels }, t("Another provider")) : null,- (0, import_react26.createElement)("button", { type: "button", className: "bt-q-submit", disabled: !ready, onClick: save }, busy ? t("Saving…") : t("Save"))++ actions.openModels ? (0, import_react25.createElement)("button", { type: "button", className: "bt-q-btn bt-model-key-other", onClick: actions.openModels }, t("Another provider")) : null,++ (0, import_react25.createElement)("button", { type: "button", className: "bt-q-submit", disabled: !ready, onClick: save }, busy ? t("Saving…") : t("Save"))));}@@@ -11695,14 -12657,14 +12560,14 @@@ function DeepSeekSignIn({ useUi, actionconst open = useUi((state) => state.signIn);const entry = open ? actions.signInEntry?.() : null;if (!entry) return null;- return (0, import_react22.createElement)(SignInHost, { key: open, entry, actions });- return (0, import_react26.createElement)(SignInHost, { key: open, entry, actions });++ return (0, import_react25.createElement)(SignInHost, { key: open, entry, actions });}function SignInHost({ entry, actions }) {- const [ops] = (0, import_react22.useState)(() => entry.inject?.() ?? {});- const [ops] = (0, import_react26.useState)(() => entry.inject?.() ?? {});++ const [ops] = (0, import_react25.useState)(() => entry.inject?.() ?? {});const close = () => actions.closeSignIn();- const useHook = (source) => (selector) => (0, import_react22.useSyncExternalStore)(source.subscribe, () => selector(source.getSnapshot()));- const [hooks] = (0, import_react22.useState)(() => ({ useAccount: useHook(ops.hooks.account), useTheme: useHook(ops.hooks.theme) }));- return (0, import_react22.createElement)(entry.component, {- const useHook = (source) => (selector) => (0, import_react26.useSyncExternalStore)(source.subscribe, () => selector(source.getSnapshot()));- const [hooks] = (0, import_react26.useState)(() => ({ useAccount: useHook(ops.hooks.account), useTheme: useHook(ops.hooks.theme) }));- return (0, import_react26.createElement)(entry.component, {++ const useHook = (source) => (selector) => (0, import_react25.useSyncExternalStore)(source.subscribe, () => selector(source.getSnapshot()));++ const [hooks] = (0, import_react25.useState)(() => ({ useAccount: useHook(ops.hooks.account), useTheme: useHook(ops.hooks.theme) }));++ return (0, import_react25.createElement)(entry.component, {...ops,...hooks,t: actions.accountT(),@@@ -11759,506 -12718,36 +12625,479 @@@ var MODEL_CSS =@media (prefers-reduced-motion:reduce){.bt-model-dock{animation:none}.bt-model-spin{animation-duration:2s}.bt-model-caret{transition:none}.bt-model-tick svg{animation:none}}`;-// src/client/folder-menu.js-var import_react27 = require("react");-var import_react_dom7 = require("react-dom");-var folderName = (path) => String(path).replace(/[\\/]+$/, "").split(/[\\/]/).pop() || String(path);-var Tick = ({ on }) => (0, import_react27.createElement)("span", { className: "bt-model-tick", "aria-hidden": true }, on ? (0, import_react27.createElement)(CheckIcon) : null);-function FolderMenu({ value, group = false, team = false, actions, run: run2, onPick, wide = false, disabled = false }) {- const { isOpen, shownPlace, leaving, button, menu, open, close } = useAnchoredMenu();- const [info, setInfo] = (0, import_react27.useState)(null);- const [view, setView] = (0, import_react27.useState)("list");- const [draft, setDraft] = (0, import_react27.useState)("");- const [listing, setListing] = (0, import_react27.useState)(null);- const [problem, setProblem] = (0, import_react27.useState)("");- const fallback = group ? t("Each Bot's own folder") : t("Team workspace");- const toggle = () => {- if (isOpen) {- close();+// src/client/turn-error.js- var import_react23 = require("react");++var import_react26 = require("react");+var OFFICIAL = "deepseek-official";+var ACCOUNT = "deepseek-account";+var TOP_UP_URL = "https://platform.deepseek.com/top_up";+var ACCOUNT_MODELS_WAIT_MS = 2e4;+var SIGNED_OUT = /* @__PURE__ */ new Set(["ACCOUNT_SIGN_IN_REQUIRED", "ACCOUNT_SIGNED_OUT", "ACCOUNT_TOKEN_INVALID"]);+var KEY_CODES = /* @__PURE__ */ new Set(["MISSING_CREDENTIAL", "INVALID_CREDENTIAL", "AUTH"]);+var CREDENTIAL_CODES = /* @__PURE__ */ new Set([...KEY_CODES, ...SIGNED_OUT]);+function failureText2(code, { name, provider, status }) {+ switch (code) {+ case "MISSING_CREDENTIAL":+ return t("{name}'s model has no API key yet.", { name });+ case "INVALID_CREDENTIAL":+ return t("This API key is not in the right format.");+ case "AUTH":+ return status === void 0 ? t("{provider} did not accept the current API key.", { provider }) : t("{provider} did not accept the current API key ({status}).", { provider, status });+ case "QUOTA":+ return status === void 0 ? t("{provider} is out of balance or quota.", { provider }) : t("{provider} is out of balance or quota ({status}).", { provider, status });+ case "ACCOUNT_QUOTA":+ return t("The DeepSeek account balance is too low.");+ case "ACCOUNT_SIGN_IN_REQUIRED":+ case "ACCOUNT_SIGNED_OUT":+ case "ACCOUNT_TOKEN_INVALID":+ return t("The DeepSeek account sign-in has expired.");+ case "TRANSPORT":+ case "TIMEOUT":+ return t("Could not reach the model service.");+ case "RATE_LIMIT":+ return t("Too many requests. Wait a moment, then try again.");+ case "SERVER":+ return t("The model service failed.");+ case "INTERRUPTED":+ return t("DeepSeek Harness stopped before this turn finished.");+ default:+ return knownFailure(code) ?? t("This turn failed.");+ }+}+function fixesFor(code, { canSignIn, official, topUp, onAccount = false }) {+ if (onAccount && KEY_CODES.has(code)) return [];+ if (SIGNED_OUT.has(code)) return canSignIn ? ["sign-in-again"] : ["model"];+ switch (code) {+ case "MISSING_CREDENTIAL":+ return ["key", canSignIn ? "sign-in" : null, "model"].filter(Boolean);+ case "INVALID_CREDENTIAL":+ return ["rekey", "model"];+ case "AUTH":+ return ["rekey", canSignIn ? "use-account" : null, "model"].filter(Boolean);+ case "QUOTA":+ return official ? ["top-up"] : [];+ case "ACCOUNT_QUOTA":+ return topUp ? ["top-up"] : [];+ default:+ return [];+ }+}+var retryShown = (code, blocked) => !CREDENTIAL_CODES.has(code) || blocked === void 0;+var FIX_LABELS = {+ key: () => t("Enter API key"),+ rekey: () => t("Enter the key again"),+ "sign-in": (signedIn) => signedIn ? t("Use the DeepSeek account") : t("Sign in with a DeepSeek account"),+ "use-account": () => t("Use a DeepSeek account instead"),+ "sign-in-again": () => t("Sign in again"),+ model: () => t("Pick another model"),+ "top-up": () => t("Top up ↗")+};+var NO_SUBSCRIBE2 = () => () => {+};+var NO_VIEW = () => null;+function useAccountView(actions) {+ const entry = actions.signInEntry?.() ?? null;- const ops = (0, import_react23.useMemo)(() => entry?.inject?.() ?? {}, [entry]);++ const ops = (0, import_react26.useMemo)(() => entry?.inject?.() ?? {}, [entry]);+ const source = ops.hooks?.account;+ const read = source ? () => source.getSnapshot()?.view ?? null : NO_VIEW;- return (0, import_react23.useSyncExternalStore)(source?.subscribe ?? NO_SUBSCRIBE2, read, read);++ return (0, import_react26.useSyncExternalStore)(source?.subscribe ?? NO_SUBSCRIBE2, read, read);+}+var topUpOf = (view) => {+ const url = view?.links?.topUpUrl;+ return typeof url === "string" && url.startsWith("https://") ? url : void 0;+};+function accountModel(roster) {+ const models = (roster.models ?? []).filter((model) => model.provider === ACCOUNT);+ return (models.find((model) => model.ref === roster.defaultModel) ?? models[0])?.ref;+}+var providerOf = (bot, roster) => {+ const ref = bot?.model ?? bot?.appliedModel;+ if (!ref) return void 0;+ return (roster.models ?? []).find((model) => model.ref === ref)?.provider ?? ref.split("/")[0];+};+var KNOWN_PROVIDERS = { "deepseek-official": "DeepSeek", "deepseek-account": "DeepSeek account" };+var providerName = (roster, provider) => provider === void 0 ? t("The model service") : (roster.models ?? []).find((model) => model.provider === provider)?.providerName ?? (KNOWN_PROVIDERS[provider] ? t(KNOWN_PROVIDERS[provider]) : provider);+function failureFacts(data, blocked) {+ const facts = [];+ if (data.code) facts.push(["Code", t("Code"), data.code]);+ if (blocked?.status !== void 0) facts.push(["HTTP status", t("HTTP status"), String(blocked.status)]);+ if (blocked?.requestId) facts.push(["Request ID", t("Request ID"), blocked.requestId]);+ if (data.code !== "AUTH" && data.message) facts.push(["Message", t("Provider message"), data.message]);+ return facts;+}+function TechnicalDetails({ facts }) {- const [copied, setCopied] = (0, import_react23.useState)(false);++ const [copied, setCopied] = (0, import_react26.useState)(false);+ if (facts.length === 0) return null;+ const copy2 = () => {+ const text = facts.map(([name, , value]) => `${name}: ${value}`).join("\n");+ void navigator.clipboard?.writeText(text).then(() => {+ setCopied(true);+ setTimeout(() => setCopied(false), 1e3);+ }).catch(() => {+ });+ };- return (0, import_react23.createElement)(++ return (0, import_react26.createElement)(+ "details",+ { className: "bt-fail-tech" },- (0, import_react23.createElement)("summary", null, t("Technical details")),- (0, import_react23.createElement)("dl", null, facts.map(([name, label, value]) => [(0, import_react23.createElement)("dt", { key: `${name}:t` }, label), (0, import_react23.createElement)("dd", { key: `${name}:d` }, value)])),- (0, import_react23.createElement)("button", { type: "button", className: "bt-mini bt-fail-copy", onClick: copy2 }, copied ? (0, import_react23.createElement)(CheckIcon) : (0, import_react23.createElement)(CopyIcon), copied ? t("Copied") : t("Copy"))++ (0, import_react26.createElement)("summary", null, t("Technical details")),++ (0, import_react26.createElement)("dl", null, facts.map(([name, label, value]) => [(0, import_react26.createElement)("dt", { key: `${name}:t` }, label), (0, import_react26.createElement)("dd", { key: `${name}:d` }, value)])),++ (0, import_react26.createElement)("button", { type: "button", className: "bt-mini bt-fail-copy", onClick: copy2 }, copied ? (0, import_react26.createElement)(CheckIcon) : (0, import_react26.createElement)(CopyIcon), copied ? t("Copied") : t("Copy"))+ );+}+function FailureCell({ node, sessionId, useRoster, useTurnClock, actions }) {+ const roster = useRoster((value) => value);+ const data = node?.data ?? {};+ const bot = roster.byId?.[sessionId];+ const later = useTurnClock((state) => Object.keys(state[sessionId] ?? {}).some((turn) => Number(turn) > data.turn));+ const account = useAccountView(actions);+ const signedIn = account?.status === "credential-stored";+ const topUp = topUpOf(account);- const [keying, setKeying] = (0, import_react23.useState)(false);- const [retry, setRetry] = (0, import_react23.useState)("idle");- const [error, setError] = (0, import_react23.useState)("");- const [joining, setJoining] = (0, import_react23.useState)(null);++ const [keying, setKeying] = (0, import_react26.useState)(false);++ const [retry, setRetry] = (0, import_react26.useState)("idle");++ const [error, setError] = (0, import_react26.useState)("");++ const [joining, setJoining] = (0, import_react26.useState)(null);+ const blocked = bot?.blocked?.code === data.code ? bot.blocked : void 0;+ const provider = blocked?.provider ?? providerOf(bot, roster);+ const text = failureText2(data.code, { name: bot?.name ?? t("This Bot"), provider: providerName(roster, provider), status: blocked?.status });+ const facts = failureFacts(data, blocked);+ const current = bot !== void 0 && currentPart(bot) === sessionId && !later;+ const moveToAccount = () => {+ const model = accountModel(roster);+ if (model === void 0) {+ actions.showDetails?.(sessionId);return;}- setView("list");- setProblem("");- void Promise.resolve(actions.folders()).then(setInfo).catch(() => setInfo((last) => last ?? { team: null, picker: null, folders: [] }));- open();- };- const choose = (path) => {- close();- if (path !== (value ?? "")) void onPick(path);+ if (model === bot.model) return;+ setError("");+ void Promise.resolve(actions.updateBot(bot.id, { model })).catch((failure) => setError(hostText(failure?.message ?? String(failure))));};- const browse = (path) => {- setProblem("");- void Promise.resolve(actions.folderList(path)).then((next) => {+ const listed = accountModel(roster);- (0, import_react23.useEffect)(() => {++ (0, import_react26.useEffect)(() => {+ if (joining === null || !signedIn) return void 0;+ if (bot === void 0 || bot.model !== joining.from) {+ setJoining(null);+ return void 0;+ }+ if (listed !== void 0) {+ setJoining(null);+ moveToAccount();+ return void 0;+ }+ void actions.refreshModels?.();+ const timer = setTimeout(() => {+ setJoining(null);+ actions.showDetails?.(sessionId);+ }, ACCOUNT_MODELS_WAIT_MS);+ return () => clearTimeout(timer);+ }, [joining, signedIn, listed]);- const settled = () => (0, import_react23.createElement)(++ const settled = () => (0, import_react26.createElement)(+ "div",+ { className: "bt-fail", "data-settled": "", role: "status" },- (0, import_react23.createElement)("div", { className: "bt-fail-head" }, (0, import_react23.createElement)("span", { className: "bt-fail-dot", "aria-hidden": true }), (0, import_react23.createElement)("span", { className: "bt-fail-text" }, text)),- (0, import_react23.createElement)(TechnicalDetails, { facts })++ (0, import_react26.createElement)("div", { className: "bt-fail-head" }, (0, import_react26.createElement)("span", { className: "bt-fail-dot", "aria-hidden": true }), (0, import_react26.createElement)("span", { className: "bt-fail-text" }, text)),++ (0, import_react26.createElement)(TechnicalDetails, { facts })+ );+ if (!current) return settled();+ const official = provider === OFFICIAL;+ const canSignIn = typeof actions.signIn === "function" && actions.canSignIn?.() === true;+ const keyHere = typeof actions.setProviderKey === "function" && provider !== void 0;+ const keyElsewhere = official && actions.openHarnessOnboarding ? () => actions.openHarnessOnboarding(OFFICIAL) : manageModels(actions);+ const viaAccount = () => {+ if (signedIn) {+ moveToAccount();+ return;+ }+ setJoining({ from: bot.model });+ actions.signIn();+ };+ const runs = {+ key: keyHere ? () => setKeying((value) => !value) : keyElsewhere,+ rekey: keyHere ? () => setKeying((value) => !value) : keyElsewhere,+ "sign-in": viaAccount,+ "use-account": viaAccount,+ "sign-in-again": () => actions.signIn(),+ model: actions.showDetails ? () => actions.showDetails(sessionId) : void 0+ };+ const fixes = fixesFor(data.code, { canSignIn, official, topUp: topUp !== void 0, onAccount: provider === ACCOUNT }).filter((fix) => fix === "top-up" || runs[fix] !== void 0);+ const asked = isHiddenTurn(roster, sessionId, data.turn);+ const retrying = !asked && typeof actions.resume === "function" && retryShown(data.code, blocked);+ const retryFirst = retrying && (fixes.length === 0 || CREDENTIAL_CODES.has(data.code));+ const resume = () => {+ setRetry("busy");+ setError("");+ void Promise.resolve(actions.resume(bot.id)).then(() => setRetry("sent"), (failure) => {+ setRetry("idle");+ setError(hostText(failure?.message ?? String(failure)));+ });+ };+ const button = (fix, primary) => {+ const className = primary ? "bt-send bt-fail-go" : "bt-soft bt-soft-sm";+ if (fix === "top-up") {- return (0, import_react23.createElement)("a", { key: fix, className: `${className} bt-fail-link`, href: data.code === "ACCOUNT_QUOTA" ? topUp : TOP_UP_URL, target: "_blank", rel: "noopener noreferrer" }, FIX_LABELS[fix]());++ return (0, import_react26.createElement)("a", { key: fix, className: `${className} bt-fail-link`, href: data.code === "ACCOUNT_QUOTA" ? topUp : TOP_UP_URL, target: "_blank", rel: "noopener noreferrer" }, FIX_LABELS[fix]());+ }+ const toggles = keyHere && (fix === "key" || fix === "rekey");- return (0, import_react23.createElement)("button", { key: fix, type: "button", className, "aria-expanded": toggles ? keying : void 0, onClick: () => runs[fix]() }, FIX_LABELS[fix](signedIn));++ return (0, import_react26.createElement)("button", { key: fix, type: "button", className, "aria-expanded": toggles ? keying : void 0, onClick: () => runs[fix]() }, FIX_LABELS[fix](signedIn));+ };- const retryButton = (primary) => (0, import_react23.createElement)("button", { key: "retry", type: "button", className: primary ? "bt-send bt-fail-go" : "bt-soft bt-soft-sm", disabled: retry !== "idle", onClick: resume }, retry === "idle" ? t("Retry") : t("Retrying…"));++ const retryButton = (primary) => (0, import_react26.createElement)("button", { key: "retry", type: "button", className: primary ? "bt-send bt-fail-go" : "bt-soft bt-soft-sm", disabled: retry !== "idle", onClick: resume }, retry === "idle" ? t("Retry") : t("Retrying…"));+ const row = retryFirst ? [retryButton(true), ...fixes.map((fix) => button(fix, false))] : [...fixes.map((fix, index) => button(fix, index === 0)), retrying ? retryButton(false) : null];+ if (!row.some(Boolean)) return settled();- return (0, import_react23.createElement)(++ return (0, import_react26.createElement)(+ "div",+ { className: "bt-fail", role: "status" },- (0, import_react23.createElement)("div", { className: "bt-fail-head" }, (0, import_react23.createElement)("span", { className: "bt-fail-dot", "aria-hidden": true }), (0, import_react23.createElement)("span", { className: "bt-fail-text" }, text)),- (0, import_react23.createElement)("div", { className: "bt-fail-actions" }, row),- keying && keyHere ? (0, import_react23.createElement)(ModelKeyCard, { model: { provider, providerName: providerName(roster, provider) }, actions, onSaved: () => setKeying(false) }) : null,- error ? (0, import_react23.createElement)("div", { className: "bt-fail-error", role: "alert" }, error) : null,- (0, import_react23.createElement)(TechnicalDetails, { facts })++ (0, import_react26.createElement)("div", { className: "bt-fail-head" }, (0, import_react26.createElement)("span", { className: "bt-fail-dot", "aria-hidden": true }), (0, import_react26.createElement)("span", { className: "bt-fail-text" }, text)),++ (0, import_react26.createElement)("div", { className: "bt-fail-actions" }, row),++ keying && keyHere ? (0, import_react26.createElement)(ModelKeyCard, { model: { provider, providerName: providerName(roster, provider) }, actions, onSaved: () => setKeying(false) }) : null,++ error ? (0, import_react26.createElement)("div", { className: "bt-fail-error", role: "alert" }, error) : null,++ (0, import_react26.createElement)(TechnicalDetails, { facts })+ );+}+var TURN_ERROR_CSS = `+.bt-fail{display:flex;flex-direction:column;gap:10px;margin:4px 0 6px;width:max-content;max-width:min(550px,86%);padding:12px 14px;border-radius:16px;background:var(--bt-card);box-shadow:inset 0 0 0 1px var(--bt-line);box-sizing:border-box;color:var(--bt-ink);font-size:14px;line-height:20px}+.bt-fail[data-settled]{gap:4px;padding:2px 0;background:none;box-shadow:none;color:var(--bt-ink-2);font-size:13px;line-height:18px}+.bt-fail-head{display:flex;align-items:flex-start;gap:8px;min-width:0}+.bt-fail-dot{flex:none;width:7px;height:7px;margin-top:6.5px;border-radius:50%;background:var(--bt-danger)}+.bt-fail[data-settled] .bt-fail-dot{margin-top:5.5px}+.bt-fail-text{min-width:0;overflow-wrap:anywhere}+.bt-fail-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-left:15px}+.bt-fail-actions .bt-fail-go{height:28px;padding:0 12px;font:inherit;font-size:12px}+.bt-fail-link{display:inline-flex;align-items:center;box-sizing:border-box;text-decoration:none}+.bt-fail:has(.bt-model-key){width:min(480px,86%)}+.bt-fail .bt-q.bt-model-key{margin:0 0 0 15px;width:auto;padding:0;background:none;box-shadow:none;border-radius:0;animation:none}+.bt-fail-error{margin-left:15px;font-size:12px;line-height:17px;color:var(--bt-danger);overflow-wrap:anywhere}+.bt-fail-tech{margin-left:15px;font-size:12px;line-height:17px;color:var(--bt-ink-2)}+.bt-fail-tech summary{width:max-content;cursor:pointer;color:var(--bt-ink-3)}+.bt-fail-tech summary:hover{color:var(--bt-ink-2)}+.bt-fail-tech dl{display:grid;grid-template-columns:auto minmax(0,1fr);gap:2px 10px;margin:6px 0}+.bt-fail-tech dt{color:var(--bt-ink-3)}+.bt-fail-tech dd{margin:0;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px;overflow-wrap:anywhere;white-space:pre-wrap;user-select:text}+.bt-fail-copy{display:inline-flex;align-items:center;gap:4px}+.bt-fail-copy svg{width:13px;height:13px}+`;+- // src/client/overlay-hooks.js- var import_react24 = require("react");- var escapeLayers = [];- var onEscapeKey = (event) => {- if (event.key === "Escape") escapeLayers.at(-1)?.current();- };- function useEscape(onClose) {- const ref = (0, import_react24.useRef)(onClose);- ref.current = onClose;- (0, import_react24.useEffect)(() => {- if (escapeLayers.length === 0) window.addEventListener("keydown", onEscapeKey);- escapeLayers.push(ref);- return () => {- escapeLayers.splice(escapeLayers.indexOf(ref), 1);- if (escapeLayers.length === 0) window.removeEventListener("keydown", onEscapeKey);- };- }, []);- }- function usePaneLeft() {- const [paneLeft, setPaneLeft] = (0, import_react24.useState)(280);- (0, import_react24.useLayoutEffect)(() => {- const column = document.querySelector('[class*="_footArea"]')?.parentElement;- if (column) setPaneLeft(Math.round(column.getBoundingClientRect().right));- }, []);- return paneLeft;- }-+// src/client/palette.js- var import_react25 = require("react");++var import_react27 = require("react");+var PALETTE_EXIT_MS = 160;+function CommandPalette({ start, token, roster, actions, useSessions }) {- const [query, setQuery] = (0, import_react25.useState)(start ?? "");- const [cursor, setCursor] = (0, import_react25.useState)(0);- const [leaving, setLeaving] = (0, import_react25.useState)(false);++ const [query, setQuery] = (0, import_react27.useState)(start ?? "");++ const [cursor, setCursor] = (0, import_react27.useState)(0);++ const [leaving, setLeaving] = (0, import_react27.useState)(false);+ const wanted = query.trim().toLowerCase();+ const close = () => {+ if (leaving) return;+ setLeaving(true);+ setTimeout(() => actions.closePalette(token), PALETTE_EXIT_MS);+ };+ useEscape(close);+ const ids = [...roster.bots.map(currentPart), ...roster.rooms.map((item) => item.id)];+ const found = useSessions((list) => {+ if (wanted.length < 2) return "[]";+ const hits = [];+ for (const id of ids) {+ const outline = list.projectionsBySession?.[id]?.values?.turnOutline ?? list.byId[id]?.projectionValues?.turnOutline;+ if (!Array.isArray(outline)) continue;+ const hidden = roster.exchangeTurns[id] ?? [];+ for (let index2 = outline.length - 1; index2 >= 0 && hits.length < 30; index2 -= 1) {+ const entry = outline[index2];+ if (hidden.includes(entry.turn)) continue;+ for (const raw of [entry.response, entry.prompt]) {+ const text = stripHeader(raw ?? "").replace(/\s+/g, " ").trim();+ const at = text.toLowerCase().indexOf(wanted);+ if (at < 0) continue;+ const from = Math.max(0, at - 24);+ hits.push([id, entry.turn, (from > 0 ? "…" : "") + text.slice(from, at + wanted.length + 60)]);+ break;+ }+ }+ }+ return JSON.stringify(hits);+ });+ const matchesName = (...fields) => wanted === "" || fields.some((field) => (field ?? "").toLowerCase().includes(wanted));+ const sections = [];+ const people = [+ ...roster.bots.filter((bot) => matchesName(bot.name, bot.role)).map((bot) => ({+ key: bot.id,- avatar: (0, import_react25.createElement)(BotAvatar, { bot, size: 24, badge: false, live: false }),++ avatar: (0, import_react27.createElement)(BotAvatar, { bot, size: 24, badge: false, live: false }),+ title: bot.name,+ subtitle: [bot.role, isMainOf(roster, bot.id) ? t("Main Bot") : ""].filter(Boolean).join(" · "),+ badge: bot.hidden ? t("Hidden") : void 0,+ run: async () => {+ if (bot.hidden) await actions.setFlags(bot.id, { hidden: false });+ actions.openSession(bot.id);+ }+ })),+ ...roster.rooms.filter((room2) => matchesName(room2.name)).map((room2) => ({+ key: room2.id,- avatar: (0, import_react25.createElement)(RoomAvatar, { room: room2, roster, size: 24 }),++ avatar: (0, import_react27.createElement)(RoomAvatar, { room: room2, roster, size: 24 }),+ title: room2.name,+ subtitle: t("{count} members", { count: room2.members.length }),+ badge: room2.hidden ? t("Hidden") : void 0,+ run: async () => {+ if (room2.hidden) await actions.setFlags(room2.id, { hidden: false });+ actions.openSession(room2.id);+ }+ }))+ ];+ if (people.length) sections.push([t("Bots"), people]);+ const agents = (roster.agents ?? []).filter(() => matchesName("DSH Agent")).map((agent) => ({+ key: agent.id,- avatar: (0, import_react25.createElement)("span", { className: "bt-palette-agent" }, (0, import_react25.createElement)(import_dsh_client_ui_primitives.FishLogo, { size: 18 })),++ avatar: (0, import_react27.createElement)("span", { className: "bt-palette-agent" }, (0, import_react27.createElement)(import_dsh_client_ui_primitives.FishLogo, { size: 18 })),+ title: "DSH Agent",+ subtitle: t("Plain dsh session"),+ run: () => actions.openAgent(agent.id)+ }));+ if (agents.length) sections.push(["DSH Agent", agents]);+ const messages = JSON.parse(found).map(([id, turn, snippet]) => {+ const bot = roster.byId[id];+ const room2 = roster.roomsById[id];+ return {+ key: `${id}:${turn}`,+ title: bot?.name ?? room2?.name ?? t("Bot"),+ subtitle: snippet,- avatar: bot ? (0, import_react25.createElement)(BotAvatar, { bot, size: 24, badge: false, live: false }) : (0, import_react25.createElement)(RoomAvatar, { room: room2, roster, size: 24 }),++ avatar: bot ? (0, import_react27.createElement)(BotAvatar, { bot, size: 24, badge: false, live: false }) : (0, import_react27.createElement)(RoomAvatar, { room: room2, roster, size: 24 }),+ run: () => actions.openSession(id)+ };+ });+ if (messages.length) sections.push([t("Messages"), messages]);+ const commands = [- { key: "cmd:new", icon: (0, import_react25.createElement)(PlusIcon), title: t("New chat"), run: () => actions.openNewChat("new") },- { key: "cmd:bot", icon: (0, import_react25.createElement)(PlusIcon), title: t("Create Bot"), run: () => actions.openNewChat("create") },- { key: "cmd:group", icon: (0, import_react25.createElement)(PeopleIcon), title: t("Create group chat"), run: () => actions.openNewChat("group") },- { key: "cmd:settings", icon: (0, import_react25.createElement)(GearIcon), title: t("Bot settings"), run: () => actions.openSettings("general") }++ { key: "cmd:new", icon: (0, import_react27.createElement)(PlusIcon), title: t("New chat"), run: () => actions.openNewChat("new") },++ { key: "cmd:bot", icon: (0, import_react27.createElement)(PlusIcon), title: t("Create Bot"), run: () => actions.openNewChat("create") },++ { key: "cmd:group", icon: (0, import_react27.createElement)(PeopleIcon), title: t("Create group chat"), run: () => actions.openNewChat("group") },++ { key: "cmd:settings", icon: (0, import_react27.createElement)(GearIcon), title: t("Bot settings"), run: () => actions.openSettings("general") }+ ].filter((command) => matchesName(command.title));+ if (commands.length) sections.push([t("Commands"), commands]);+ const rows2 = sections.flatMap(([, items]) => items);+ const active = Math.min(cursor, Math.max(rows2.length - 1, 0));+ const shown = rows2.map((row) => row.key).join("\n");+ const glide = useGlide(`${active}+${shown}`, { axis: "y", ...QUICK_EDGES });+ const listRef = glide.box;+ useFlip(listRef, shown, "[data-flip]");- (0, import_react25.useEffect)(() => {++ (0, import_react27.useEffect)(() => {+ listRef.current?.querySelector("[aria-selected=true]")?.scrollIntoView({ block: "nearest" });+ }, [active, query]);+ const choose = (row) => {+ if (!row || leaving) return;+ void Promise.resolve(row.run()).catch((error) => actions.reportError(error, "menu"));+ close();+ };+ let index = -1;- return (0, import_react25.createElement)(++ return (0, import_react27.createElement)(+ "div",+ { className: "bt-palette-layer", "data-leaving": leaving || void 0 },- (0, import_react25.createElement)("div", { className: "bt-backdrop", onMouseDown: close }),- (0, import_react25.createElement)(++ (0, import_react27.createElement)("div", { className: "bt-backdrop", onMouseDown: close }),++ (0, import_react27.createElement)(+ "div",+ { className: "bt-palette", role: "dialog", "aria-label": t("Search"), "aria-modal": true },- (0, import_react25.createElement)(++ (0, import_react27.createElement)(+ "div",+ { className: "bt-palette-head" },- (0, import_react25.createElement)("span", { className: "bt-palette-glyph", "aria-hidden": true }, (0, import_react25.createElement)(SearchIcon)),- (0, import_react25.createElement)("input", {++ (0, import_react27.createElement)("span", { className: "bt-palette-glyph", "aria-hidden": true }, (0, import_react27.createElement)(SearchIcon)),++ (0, import_react27.createElement)("input", {+ autoFocus: true,+ value: query,+ placeholder: t("Search Bots, chats and messages"),+ "aria-label": t("Search"),+ role: "combobox",+ "aria-expanded": true,+ "aria-controls": "bt-palette-list",+ onChange: (event) => {+ setQuery(event.target.value);+ setCursor(0);+ },+ onKeyDown: (event) => {+ if (event.nativeEvent.isComposing) return;+ if (event.key === "ArrowDown") {+ event.preventDefault();+ setCursor(Math.min(active + 1, rows2.length - 1));+ } else if (event.key === "ArrowUp") {+ event.preventDefault();+ setCursor(Math.max(active - 1, 0));+ } else if (event.key === "Enter") {+ event.preventDefault();+ choose(rows2[active]);+ }+ }+ }),- query ? (0, import_react25.createElement)("button", { type: "button", className: "bt-palette-clear", "aria-label": t("Clear search"), onClick: () => {++ query ? (0, import_react27.createElement)("button", { type: "button", className: "bt-palette-clear", "aria-label": t("Clear search"), onClick: () => {+ setQuery("");+ setCursor(0);- } }, (0, import_react25.createElement)(CloseIcon)) : null++ } }, (0, import_react27.createElement)(CloseIcon)) : null+ ),- (0, import_react25.createElement)(++ (0, import_react27.createElement)(+ "div",+ { ref: listRef, id: "bt-palette-list", className: "bt-palette-list", role: "listbox", "aria-label": t("Results") },- (0, import_react25.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),- rows2.length === 0 ? (0, import_react25.createElement)(++ (0, import_react27.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),++ rows2.length === 0 ? (0, import_react27.createElement)(+ "div",+ { className: "bt-palette-empty" },- (0, import_react25.createElement)("span", { className: "bt-palette-empty-icon", "aria-hidden": true }, (0, import_react25.createElement)(SearchIcon)),- (0, import_react25.createElement)("span", { className: "bt-palette-empty-label" }, t("No results")),- (0, import_react25.createElement)("span", { className: "bt-palette-empty-hint" }, t("Try a Bot name or words from a message"))- ) : sections.map(([title, items]) => (0, import_react25.createElement)(- import_react25.Fragment,++ (0, import_react27.createElement)("span", { className: "bt-palette-empty-icon", "aria-hidden": true }, (0, import_react27.createElement)(SearchIcon)),++ (0, import_react27.createElement)("span", { className: "bt-palette-empty-label" }, t("No results")),++ (0, import_react27.createElement)("span", { className: "bt-palette-empty-hint" }, t("Try a Bot name or words from a message"))++ ) : sections.map(([title, items]) => (0, import_react27.createElement)(++ import_react27.Fragment,+ { key: title },- (0, import_react25.createElement)("div", { className: "bt-palette-section", role: "presentation", "data-flip": `section:${title}` }, title),++ (0, import_react27.createElement)("div", { className: "bt-palette-section", role: "presentation", "data-flip": `section:${title}` }, title),+ items.map((row) => {+ index += 1;+ const at = index;- return (0, import_react25.createElement)(++ return (0, import_react27.createElement)(+ "button",+ {+ key: row.key,+ type: "button",+ role: "option",+ className: "bt-palette-row",+ "aria-selected": at === active,+ "data-flip": row.key,+ onMouseMove: () => {+ if (cursor !== at) setCursor(at);+ },+ onClick: () => choose(row)+ },- (0, import_react25.createElement)("span", { className: "bt-palette-lead" }, row.avatar ?? (0, import_react25.createElement)("span", { className: "bt-palette-cmd" }, row.icon)),- (0, import_react25.createElement)(++ (0, import_react27.createElement)("span", { className: "bt-palette-lead" }, row.avatar ?? (0, import_react27.createElement)("span", { className: "bt-palette-cmd" }, row.icon)),++ (0, import_react27.createElement)(+ "span",+ { className: "bt-palette-text" },- (0, import_react25.createElement)("span", { className: "bt-palette-title" }, row.title),- row.subtitle ? (0, import_react25.createElement)("span", { className: "bt-palette-sub" }, row.subtitle) : null++ (0, import_react27.createElement)("span", { className: "bt-palette-title" }, row.title),++ row.subtitle ? (0, import_react27.createElement)("span", { className: "bt-palette-sub" }, row.subtitle) : null+ ),- row.badge ? (0, import_react25.createElement)("span", { className: "bt-palette-badge" }, row.badge) : null++ row.badge ? (0, import_react27.createElement)("span", { className: "bt-palette-badge" }, row.badge) : null+ );+ })+ ))+ )+ )+ );+}++// src/client/folder-menu.js- var import_react26 = require("react");++var import_react28 = require("react");+var import_react_dom7 = require("react-dom");+var folderName = (path) => String(path).replace(/[\\/]+$/, "").split(/[\\/]/).pop() || String(path);- var Tick = ({ on }) => (0, import_react26.createElement)("span", { className: "bt-model-tick", "aria-hidden": true }, on ? (0, import_react26.createElement)(CheckIcon) : null);++var Tick = ({ on }) => (0, import_react28.createElement)("span", { className: "bt-model-tick", "aria-hidden": true }, on ? (0, import_react28.createElement)(CheckIcon) : null);+function FolderMenu({ value, group = false, team = false, actions, run: run2, onPick, wide = false, disabled = false }) {+ const { isOpen, shownPlace, leaving, button, menu, open, close } = useAnchoredMenu();- const [info, setInfo] = (0, import_react26.useState)(null);- const [view, setView] = (0, import_react26.useState)("list");- const [draft, setDraft] = (0, import_react26.useState)("");- const [listing, setListing] = (0, import_react26.useState)(null);- const [problem, setProblem] = (0, import_react26.useState)("");++ const [info, setInfo] = (0, import_react28.useState)(null);++ const [view, setView] = (0, import_react28.useState)("list");++ const [draft, setDraft] = (0, import_react28.useState)("");++ const [listing, setListing] = (0, import_react28.useState)(null);++ const [problem, setProblem] = (0, import_react28.useState)("");+ const fallback = group ? t("Each Bot's own folder") : t("Team workspace");+ const toggle = () => {+ if (isOpen) {+ close();+ return;+ }+ setView("list");+ setProblem("");+ void Promise.resolve(actions.folders()).then(setInfo).catch(() => setInfo((last) => last ?? { team: null, picker: null, folders: [] }));+ open();+ };+ const choose = (path) => {+ close();+ if (path !== (value ?? "")) void onPick(path);+ };+ const browse = (path) => {+ setProblem("");+ void Promise.resolve(actions.folderList(path)).then((next) => {setListing(next);setView("browse");}).catch((failure) => setProblem(failure?.message ?? String(failure)));@@@ -12273,35 -12762,35 +13112,35 @@@};const known = info?.folders ?? [];const folders = value && !known.some((folder) => folder.path === value) ? [{ path: value, title: folderName(value) }, ...known] : known;- const listView = (0, import_react26.createElement)(- const listView = (0, import_react27.createElement)(++ const listView = (0, import_react28.createElement)("div",{ key: "list", className: "bt-folder-view" },- team ? null : (0, import_react26.createElement)(- team ? null : (0, import_react27.createElement)(++ team ? null : (0, import_react28.createElement)("button",{ type: "button", role: "menuitemradio", "aria-checked": !value, title: group ? void 0 : info?.team ?? void 0, onClick: () => choose("") },- (0, import_react26.createElement)("span", { className: "bt-menu-label" }, fallback),- (0, import_react26.createElement)(Tick, { on: !value })- (0, import_react27.createElement)("span", { className: "bt-menu-label" }, fallback),- (0, import_react27.createElement)(Tick, { on: !value })++ (0, import_react28.createElement)("span", { className: "bt-menu-label" }, fallback),++ (0, import_react28.createElement)(Tick, { on: !value })),- folders.length > 0 ? (0, import_react26.createElement)("div", { className: "bt-model-group", role: "presentation" }, t("Folders")) : null,- folders.map((folder) => (0, import_react26.createElement)(- folders.length > 0 ? (0, import_react27.createElement)("div", { className: "bt-model-group", role: "presentation" }, t("Folders")) : null,- folders.map((folder) => (0, import_react27.createElement)(++ folders.length > 0 ? (0, import_react28.createElement)("div", { className: "bt-model-group", role: "presentation" }, t("Folders")) : null,++ folders.map((folder) => (0, import_react28.createElement)("button",{ key: folder.path, type: "button", role: "menuitemradio", "aria-checked": folder.path === value, title: folder.path, onClick: () => choose(folder.path) },- (0, import_react26.createElement)("span", { className: "bt-folder-copy" }, (0, import_react26.createElement)("span", { className: "bt-menu-label" }, folder.title), (0, import_react26.createElement)("span", { className: "bt-folder-path" }, folder.path)),- (0, import_react26.createElement)(Tick, { on: folder.path === value })- (0, import_react27.createElement)("span", { className: "bt-folder-copy" }, (0, import_react27.createElement)("span", { className: "bt-menu-label" }, folder.title), (0, import_react27.createElement)("span", { className: "bt-folder-path" }, folder.path)),- (0, import_react27.createElement)(Tick, { on: folder.path === value })++ (0, import_react28.createElement)("span", { className: "bt-folder-copy" }, (0, import_react28.createElement)("span", { className: "bt-menu-label" }, folder.title), (0, import_react28.createElement)("span", { className: "bt-folder-path" }, folder.path)),++ (0, import_react28.createElement)(Tick, { on: folder.path === value }))),- (0, import_react26.createElement)("div", { className: "bt-menu-sep", role: "separator" }),- info?.picker === "native" ? (0, import_react26.createElement)("button", { type: "button", role: "menuitem", onClick: pickNative }, (0, import_react26.createElement)(FolderIcon), (0, import_react26.createElement)("span", { className: "bt-menu-label" }, t("Choose a folder…"))) : null,- info?.picker === "browse" ? (0, import_react26.createElement)("button", { type: "button", role: "menuitem", onClick: () => browse(value) }, (0, import_react26.createElement)(FolderIcon), (0, import_react26.createElement)("span", { className: "bt-menu-label" }, t("Browse folders…"))) : null,- (0, import_react26.createElement)("button", { type: "button", role: "menuitem", onClick: () => {- (0, import_react27.createElement)("div", { className: "bt-menu-sep", role: "separator" }),- info?.picker === "native" ? (0, import_react27.createElement)("button", { type: "button", role: "menuitem", onClick: pickNative }, (0, import_react27.createElement)(FolderIcon), (0, import_react27.createElement)("span", { className: "bt-menu-label" }, t("Choose a folder…"))) : null,- info?.picker === "browse" ? (0, import_react27.createElement)("button", { type: "button", role: "menuitem", onClick: () => browse(value) }, (0, import_react27.createElement)(FolderIcon), (0, import_react27.createElement)("span", { className: "bt-menu-label" }, t("Browse folders…"))) : null,- (0, import_react27.createElement)("button", { type: "button", role: "menuitem", onClick: () => {++ (0, import_react28.createElement)("div", { className: "bt-menu-sep", role: "separator" }),++ info?.picker === "native" ? (0, import_react28.createElement)("button", { type: "button", role: "menuitem", onClick: pickNative }, (0, import_react28.createElement)(FolderIcon), (0, import_react28.createElement)("span", { className: "bt-menu-label" }, t("Choose a folder…"))) : null,++ info?.picker === "browse" ? (0, import_react28.createElement)("button", { type: "button", role: "menuitem", onClick: () => browse(value) }, (0, import_react28.createElement)(FolderIcon), (0, import_react28.createElement)("span", { className: "bt-menu-label" }, t("Browse folders…"))) : null,++ (0, import_react28.createElement)("button", { type: "button", role: "menuitem", onClick: () => {setDraft(value ?? "");setView("type");- } }, (0, import_react26.createElement)(PencilIcon), (0, import_react26.createElement)("span", { className: "bt-menu-label" }, t("Enter a path…")))- } }, (0, import_react27.createElement)(PencilIcon), (0, import_react27.createElement)("span", { className: "bt-menu-label" }, t("Enter a path…")))++ } }, (0, import_react28.createElement)(PencilIcon), (0, import_react28.createElement)("span", { className: "bt-menu-label" }, t("Enter a path…"))));- const typeView = (0, import_react26.createElement)(- const typeView = (0, import_react27.createElement)(++ const typeView = (0, import_react28.createElement)("div",{ key: "type", className: "bt-folder-view" },- (0, import_react26.createElement)("button", { type: "button", className: "bt-folder-back", onClick: () => setView("list") }, (0, import_react26.createElement)(ChevronLeftIcon), (0, import_react26.createElement)("span", { className: "bt-menu-label" }, t("Back"))),- (0, import_react26.createElement)("input", {- (0, import_react27.createElement)("button", { type: "button", className: "bt-folder-back", onClick: () => setView("list") }, (0, import_react27.createElement)(ChevronLeftIcon), (0, import_react27.createElement)("span", { className: "bt-menu-label" }, t("Back"))),- (0, import_react27.createElement)("input", {++ (0, import_react28.createElement)("button", { type: "button", className: "bt-folder-back", onClick: () => setView("list") }, (0, import_react28.createElement)(ChevronLeftIcon), (0, import_react28.createElement)("span", { className: "bt-menu-label" }, t("Back"))),++ (0, import_react28.createElement)("input", {className: "bt-folder-input",autoFocus: true,value: draft,@@@ -12313,33 -12802,33 +13152,33 @@@if (event.key === "Enter" && !event.nativeEvent.isComposing) typed();}}),- (0, import_react26.createElement)("button", { type: "button", className: "bt-folder-use", disabled: draft.trim() === "", onClick: typed }, t("Use this folder"))- (0, import_react27.createElement)("button", { type: "button", className: "bt-folder-use", disabled: draft.trim() === "", onClick: typed }, t("Use this folder"))++ (0, import_react28.createElement)("button", { type: "button", className: "bt-folder-use", disabled: draft.trim() === "", onClick: typed }, t("Use this folder")));const parent = listing?.crumbs?.length > 1 ? listing.crumbs.at(-2) : void 0;const inside = listing?.entries?.filter((entry) => !entry.hidden) ?? [];- const browseView = listing ? (0, import_react26.createElement)(- const browseView = listing ? (0, import_react27.createElement)(++ const browseView = listing ? (0, import_react28.createElement)("div",{ key: `browse:${listing.path}`, className: "bt-folder-view" },- (0, import_react26.createElement)("button", { type: "button", className: "bt-folder-back", onClick: () => setView("list") }, (0, import_react26.createElement)(ChevronLeftIcon), (0, import_react26.createElement)("span", { className: "bt-menu-label" }, t("Back"))),- (0, import_react26.createElement)("div", { className: "bt-folder-path bt-folder-here" }, listing.path),- parent ? (0, import_react26.createElement)("button", { type: "button", role: "menuitem", title: parent.path, onClick: () => browse(parent.path) }, (0, import_react26.createElement)(FolderIcon), (0, import_react26.createElement)("span", { className: "bt-menu-label" }, t("Up one level"))) : null,- inside.map((entry) => (0, import_react26.createElement)(- (0, import_react27.createElement)("button", { type: "button", className: "bt-folder-back", onClick: () => setView("list") }, (0, import_react27.createElement)(ChevronLeftIcon), (0, import_react27.createElement)("span", { className: "bt-menu-label" }, t("Back"))),- (0, import_react27.createElement)("div", { className: "bt-folder-path bt-folder-here" }, listing.path),- parent ? (0, import_react27.createElement)("button", { type: "button", role: "menuitem", title: parent.path, onClick: () => browse(parent.path) }, (0, import_react27.createElement)(FolderIcon), (0, import_react27.createElement)("span", { className: "bt-menu-label" }, t("Up one level"))) : null,- inside.map((entry) => (0, import_react27.createElement)(++ (0, import_react28.createElement)("button", { type: "button", className: "bt-folder-back", onClick: () => setView("list") }, (0, import_react28.createElement)(ChevronLeftIcon), (0, import_react28.createElement)("span", { className: "bt-menu-label" }, t("Back"))),++ (0, import_react28.createElement)("div", { className: "bt-folder-path bt-folder-here" }, listing.path),++ parent ? (0, import_react28.createElement)("button", { type: "button", role: "menuitem", title: parent.path, onClick: () => browse(parent.path) }, (0, import_react28.createElement)(FolderIcon), (0, import_react28.createElement)("span", { className: "bt-menu-label" }, t("Up one level"))) : null,++ inside.map((entry) => (0, import_react28.createElement)("button",{ key: entry.path, type: "button", role: "menuitem", onClick: () => browse(entry.path) },- (0, import_react26.createElement)(FolderIcon),- (0, import_react26.createElement)("span", { className: "bt-menu-label" }, entry.name),- (0, import_react26.createElement)(ChevronRightIcon)- (0, import_react27.createElement)(FolderIcon),- (0, import_react27.createElement)("span", { className: "bt-menu-label" }, entry.name),- (0, import_react27.createElement)(ChevronRightIcon)++ (0, import_react28.createElement)(FolderIcon),++ (0, import_react28.createElement)("span", { className: "bt-menu-label" }, entry.name),++ (0, import_react28.createElement)(ChevronRightIcon))),- inside.length === 0 ? (0, import_react26.createElement)("div", { className: "bt-model-none" }, t("No folders inside.")) : null,- listing.truncated ? (0, import_react26.createElement)("div", { className: "bt-folder-path bt-folder-here" }, t("Some folders are not shown.")) : null,- (0, import_react26.createElement)("div", { className: "bt-menu-sep", role: "separator" }),- (0, import_react26.createElement)("button", { type: "button", className: "bt-folder-use", onClick: () => choose(listing.path) }, t("Use this folder"))- inside.length === 0 ? (0, import_react27.createElement)("div", { className: "bt-model-none" }, t("No folders inside.")) : null,- listing.truncated ? (0, import_react27.createElement)("div", { className: "bt-folder-path bt-folder-here" }, t("Some folders are not shown.")) : null,- (0, import_react27.createElement)("div", { className: "bt-menu-sep", role: "separator" }),- (0, import_react27.createElement)("button", { type: "button", className: "bt-folder-use", onClick: () => choose(listing.path) }, t("Use this folder"))++ inside.length === 0 ? (0, import_react28.createElement)("div", { className: "bt-model-none" }, t("No folders inside.")) : null,++ listing.truncated ? (0, import_react28.createElement)("div", { className: "bt-folder-path bt-folder-here" }, t("Some folders are not shown.")) : null,++ (0, import_react28.createElement)("div", { className: "bt-menu-sep", role: "separator" }),++ (0, import_react28.createElement)("button", { type: "button", className: "bt-folder-use", onClick: () => choose(listing.path) }, t("Use this folder"))) : null;const shownView = view === "type" ? typeView : view === "browse" && browseView ? browseView : listView;- return (0, import_react26.createElement)(- import_react26.Fragment,- return (0, import_react27.createElement)(- import_react27.Fragment,++ return (0, import_react28.createElement)(++ import_react28.Fragment,null,- (0, import_react26.createElement)(- (0, import_react27.createElement)(++ (0, import_react28.createElement)("button",{ref: button,@@@ -12353,19 -12842,19 +13192,19 @@@onClick: toggle,disabled},- (0, import_react26.createElement)(- (0, import_react27.createElement)(++ (0, import_react28.createElement)("span",{ className: "bt-model-copy" },- (0, import_react26.createElement)("span", { className: "bt-model-name" }, value ? folderName(value) : fallback),- value ? (0, import_react26.createElement)("span", { className: "bt-model-provider" }, value) : null- (0, import_react27.createElement)("span", { className: "bt-model-name" }, value ? folderName(value) : fallback),- value ? (0, import_react27.createElement)("span", { className: "bt-model-provider" }, value) : null++ (0, import_react28.createElement)("span", { className: "bt-model-name" }, value ? folderName(value) : fallback),++ value ? (0, import_react28.createElement)("span", { className: "bt-model-provider" }, value) : null),- (0, import_react26.createElement)(Caret)- (0, import_react27.createElement)(Caret)++ (0, import_react28.createElement)(Caret)),- shownPlace ? (0, import_react_dom7.createPortal)((0, import_react26.createElement)(- shownPlace ? (0, import_react_dom7.createPortal)((0, import_react27.createElement)(++ shownPlace ? (0, import_react_dom7.createPortal)((0, import_react28.createElement)("div",{ ref: menu, className: `bt-menu bt-model-menu bt-folder-menu${shownPlace.bottom !== void 0 ? " bt-menu-up" : ""}`, role: "menu", "aria-label": team ? t("Team workspace") : t("Working folder"), style: shownPlace, "data-leaving": leaving || void 0 },shownView,- problem ? (0, import_react26.createElement)("div", { className: "bt-folder-error", role: "alert" }, problem) : null- problem ? (0, import_react27.createElement)("div", { className: "bt-folder-error", role: "alert" }, problem) : null++ problem ? (0, import_react28.createElement)("div", { className: "bt-folder-error", role: "alert" }, problem) : null), document.body) : null);}@@@ -12386,7 -12875,7 +13225,7 @@@ var FOLDER_CSS =`;// src/client/schedules.js- var import_react27 = require("react");-var import_react28 = require("react");++var import_react29 = require("react");var POLL_MS = 3e4;var shared = null;var listeners = /* @__PURE__ */ new Set();@@@ -12395,8 -12884,8 +13234,8 @@@ function publish(view)for (const listener of listeners) listener(view);}function useSchedules(actions) {- const [view, setView] = (0, import_react27.useState)(shared);- (0, import_react27.useEffect)(() => {- const [view, setView] = (0, import_react28.useState)(shared);- (0, import_react28.useEffect)(() => {++ const [view, setView] = (0, import_react29.useState)(shared);++ (0, import_react29.useEffect)(() => {listeners.add(setView);let stopped = false;let timer;@@@ -12452,11 -12941,15 +13291,15 @@@ function timingText(task)return "";}}- var nextText = (task) => task.status === "active" ? t("Next: {time}", { time: dayAndTime(Date.parse(task.scheduledAt)) }) : t("Finished");- function TaskRow({ task, actions, onView, showBot, roster }) {- const [confirming, setConfirming] = (0, import_react27.useState)(false);- const [busy, setBusy] = (0, import_react27.useState)(false);- (0, import_react27.useEffect)(() => {+ var nextText = (task) => {+ if (task.state === "overdue" || task.state === void 0 && task.status === "active" && Date.parse(task.scheduledAt) <= Date.now()) return t("Overdue: {time}", { time: dayAndTime(Date.parse(task.scheduledAt)) });+ return task.status === "active" ? t("Next: {time}", { time: dayAndTime(Date.parse(task.scheduledAt)) }) : t("Finished");+ };+ function TaskRow2({ task, actions, onView, showBot, roster }) {- const [confirming, setConfirming] = (0, import_react28.useState)(false);- const [expanded, setExpanded] = (0, import_react28.useState)(false);- const [busy, setBusy] = (0, import_react28.useState)(false);- (0, import_react28.useEffect)(() => {++ const [confirming, setConfirming] = (0, import_react29.useState)(false);++ const [expanded, setExpanded] = (0, import_react29.useState)(false);++ const [busy, setBusy] = (0, import_react29.useState)(false);++ (0, import_react29.useEffect)(() => {if (!confirming) return void 0;const timer = setTimeout(() => setConfirming(false), 3e3);return () => clearTimeout(timer);@@@ -12470,19 -12963,19 +13313,19 @@@void actions.scheduleDelete(task.sessionId, task.id).then(onView, () => setBusy(false));};const room2 = task.roomId ? roster.roomsById[task.roomId] : void 0;- return (0, import_react27.createElement)(- return (0, import_react28.createElement)(++ return (0, import_react29.createElement)("div",{ className: "bt-set-row bt-task", "data-done": task.status === "active" ? void 0 : "", "data-busy": busy || void 0 },- showBot ? (0, import_react27.createElement)(BotAvatar, { bot: roster.byId[task.botId], size: 28, badge: false, live: false }) : null,- (0, import_react27.createElement)(- "span",- { className: "bt-set-copy" },- (0, import_react27.createElement)("span", { className: "bt-task-title" }, task.title),- (0, import_react27.createElement)("span", { className: "bt-set-hint" }, [timingText(task), room2 ? t("in {name}", { name: room2.name }) : ""].filter(Boolean).join(" · ")),- task.prompt && task.prompt !== task.title ? (0, import_react27.createElement)("span", { className: "bt-task-prompt" }, task.prompt) : null- showBot ? (0, import_react28.createElement)(BotAvatar, { bot: roster.byId[task.botId], size: 28, badge: false, live: false }) : null,- (0, import_react28.createElement)(++ showBot ? (0, import_react29.createElement)(BotAvatar, { bot: roster.byId[task.botId], size: 28, badge: false, live: false }) : null,++ (0, import_react29.createElement)(+ "button",+ { type: "button", className: "bt-set-copy bt-task-copy", "aria-expanded": expanded || void 0, onClick: () => setExpanded((open) => !open) },- (0, import_react28.createElement)("span", { className: "bt-task-title" }, task.title),- (0, import_react28.createElement)("span", { className: "bt-set-hint" }, [timingText(task), room2 ? t("in {name}", { name: room2.name }) : ""].filter(Boolean).join(" · ")),- task.prompt && task.prompt !== task.title ? (0, import_react28.createElement)("span", { className: "bt-task-prompt", "data-open": expanded || void 0 }, task.prompt) : null++ (0, import_react29.createElement)("span", { className: "bt-task-title" }, task.title),++ (0, import_react29.createElement)("span", { className: "bt-set-hint" }, [timingText(task), room2 ? t("in {name}", { name: room2.name }) : ""].filter(Boolean).join(" · ")),++ task.prompt && task.prompt !== task.title ? (0, import_react29.createElement)("span", { className: "bt-task-prompt", "data-open": expanded || void 0 }, task.prompt) : null),- (0, import_react27.createElement)("span", { className: "bt-task-next" }, nextText(task)),- (0, import_react27.createElement)("button", {- (0, import_react28.createElement)("span", { className: "bt-task-next", "data-state": task.state === "overdue" ? "overdue" : void 0 }, nextText(task)),- (0, import_react28.createElement)("button", {++ (0, import_react29.createElement)("span", { className: "bt-task-next", "data-state": task.state === "overdue" ? "overdue" : void 0 }, nextText(task)),++ (0, import_react29.createElement)("button", {type: "button",className: "bt-mini bt-task-remove","data-confirm": confirming || void 0,@@@ -12490,7 -12983,7 +13333,7 @@@"aria-label": confirming ? t("Click again to delete") : t("Delete task"),title: confirming ? void 0 : t("Delete task"),onClick: remove- }, confirming ? t("Delete") : (0, import_react27.createElement)(TrashIcon))- }, confirming ? t("Delete") : (0, import_react28.createElement)(TrashIcon))++ }, confirming ? t("Delete") : (0, import_react29.createElement)(TrashIcon)));}var pad = (number) => String(number).padStart(2, "0");@@@ -12502,17 -12995,17 +13345,17 @@@ function inAnHour()var KINDS = [["at", "Once"], ["daily", "Every day"], ["weekly", "Every week"], ["every", "Repeat"]];var UNITS = [["minutes", 1, "minutes"], ["hours", 60, "hours"], ["days", 1440, "days"]];function TaskForm({ roster, actions, start, onDone, onCancel }) {- const [target, setTarget] = (0, import_react27.useState)(start ?? roster.bots[0]?.id ?? "");- const [title, setTitle] = (0, import_react27.useState)("");- const [prompt, setPrompt] = (0, import_react27.useState)("");- const [kind, setKind] = (0, import_react27.useState)("daily");- const [at, setAt] = (0, import_react27.useState)(inAnHour);- const [time, setTime] = (0, import_react27.useState)("09:00");- const [weekdays, setWeekdays] = (0, import_react27.useState)([1, 2, 3, 4, 5]);- const [count, setCount] = (0, import_react27.useState)(1);- const [unit, setUnit] = (0, import_react27.useState)("hours");- const [busy, setBusy] = (0, import_react27.useState)(false);- const [error, setError] = (0, import_react27.useState)("");- const [target, setTarget] = (0, import_react28.useState)(start ?? roster.bots[0]?.id ?? "");- const [title, setTitle] = (0, import_react28.useState)("");- const [prompt, setPrompt] = (0, import_react28.useState)("");- const [kind, setKind] = (0, import_react28.useState)("daily");- const [at, setAt] = (0, import_react28.useState)(inAnHour);- const [time, setTime] = (0, import_react28.useState)("09:00");- const [weekdays, setWeekdays] = (0, import_react28.useState)([1, 2, 3, 4, 5]);- const [count, setCount] = (0, import_react28.useState)(1);- const [unit, setUnit] = (0, import_react28.useState)("hours");- const [busy, setBusy] = (0, import_react28.useState)(false);- const [error, setError] = (0, import_react28.useState)("");++ const [target, setTarget] = (0, import_react29.useState)(start ?? roster.bots[0]?.id ?? "");++ const [title, setTitle] = (0, import_react29.useState)("");++ const [prompt, setPrompt] = (0, import_react29.useState)("");++ const [kind, setKind] = (0, import_react29.useState)("daily");++ const [at, setAt] = (0, import_react29.useState)(inAnHour);++ const [time, setTime] = (0, import_react29.useState)("09:00");++ const [weekdays, setWeekdays] = (0, import_react29.useState)([1, 2, 3, 4, 5]);++ const [count, setCount] = (0, import_react29.useState)(1);++ const [unit, setUnit] = (0, import_react29.useState)("hours");++ const [busy, setBusy] = (0, import_react29.useState)(false);++ const [error, setError] = (0, import_react29.useState)("");const timing = () => {if (kind === "at") return { kind, at: new Date(at).toISOString() };if (kind === "every") return { kind, minutes: Math.round(Number(count) * UNITS.find(([id]) => id === unit)[1]) };@@@ -12537,101 -13030,107 +13380,107 @@@});};const toggleDay = (day) => setWeekdays((days) => days.includes(day) ? days.filter((item) => item !== day) : [...days, day].sort());- return (0, import_react27.createElement)(- return (0, import_react28.createElement)(++ return (0, import_react29.createElement)("form",{ className: "bt-set-card bt-task-form", onSubmit: submit },- (0, import_react27.createElement)(- (0, import_react28.createElement)(++ (0, import_react29.createElement)("label",{ className: "bt-set-row bt-bs-row" },- (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, t("Send to"))),- (0, import_react27.createElement)(- (0, import_react28.createElement)("span", { className: "bt-set-copy" }, (0, import_react28.createElement)("span", { className: "bt-bs-label" }, t("Send to"))),- (0, import_react28.createElement)(++ (0, import_react29.createElement)("span", { className: "bt-set-copy" }, (0, import_react29.createElement)("span", { className: "bt-bs-label" }, t("Send to"))),++ (0, import_react29.createElement)("select",{ className: "bt-select bt-task-bot", value: target, onChange: (event) => setTarget(event.target.value) },- (0, import_react27.createElement)("optgroup", { label: t("Bots") }, roster.bots.map((bot) => (0, import_react27.createElement)("option", { key: bot.id, value: bot.id }, bot.name))),- roster.rooms.length > 0 ? (0, import_react27.createElement)("optgroup", { label: t("Group chats") }, roster.rooms.map((room2) => (0, import_react27.createElement)("option", { key: room2.id, value: room2.id }, room2.name))) : null- (0, import_react28.createElement)("optgroup", { label: t("Bots") }, roster.bots.map((bot) => (0, import_react28.createElement)("option", { key: bot.id, value: bot.id }, bot.name))),- roster.rooms.length > 0 ? (0, import_react28.createElement)("optgroup", { label: t("Group chats") }, roster.rooms.map((room2) => (0, import_react28.createElement)("option", { key: room2.id, value: room2.id }, room2.name))) : null++ (0, import_react29.createElement)("optgroup", { label: t("Bots") }, roster.bots.map((bot) => (0, import_react29.createElement)("option", { key: bot.id, value: bot.id }, bot.name))),++ roster.rooms.length > 0 ? (0, import_react29.createElement)("optgroup", { label: t("Group chats") }, roster.rooms.map((room2) => (0, import_react29.createElement)("option", { key: room2.id, value: room2.id }, room2.name))) : null)),- (0, import_react27.createElement)(- (0, import_react28.createElement)(++ (0, import_react29.createElement)("label",{ className: "bt-set-row bt-bs-row" },- (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, t("Name"))),- (0, import_react27.createElement)("input", { className: "bt-bs-input", value: title, maxLength: 120, placeholder: t("Morning briefing"), autoFocus: true, onChange: (event) => setTitle(event.target.value) })- (0, import_react28.createElement)("span", { className: "bt-set-copy" }, (0, import_react28.createElement)("span", { className: "bt-bs-label" }, t("Name"))),- (0, import_react28.createElement)("input", { className: "bt-bs-input", value: title, maxLength: 120, placeholder: t("Morning briefing"), autoFocus: true, onChange: (event) => setTitle(event.target.value) })++ (0, import_react29.createElement)("span", { className: "bt-set-copy" }, (0, import_react29.createElement)("span", { className: "bt-bs-label" }, t("Name"))),++ (0, import_react29.createElement)("input", { className: "bt-bs-input", value: title, maxLength: 120, placeholder: t("Morning briefing"), autoFocus: true, onChange: (event) => setTitle(event.target.value) })),- (0, import_react27.createElement)(- (0, import_react28.createElement)(++ (0, import_react29.createElement)("label",{ className: "bt-set-row bt-bs-row bt-bs-stack" },- (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, t("What to do"))),- (0, import_react27.createElement)("textarea", { className: "bt-bs-input bt-bs-area", value: prompt, rows: 3, placeholder: t("Sum up what changed since yesterday and what needs me today."), onChange: (event) => setPrompt(event.target.value) })- (0, import_react28.createElement)("span", { className: "bt-set-copy" }, (0, import_react28.createElement)("span", { className: "bt-bs-label" }, t("What to do"))),- (0, import_react28.createElement)("textarea", { className: "bt-bs-input bt-bs-area", value: prompt, rows: 3, placeholder: t("Sum up what changed since yesterday and what needs me today."), onChange: (event) => setPrompt(event.target.value) })++ (0, import_react29.createElement)("span", { className: "bt-set-copy" }, (0, import_react29.createElement)("span", { className: "bt-bs-label" }, t("What to do"))),++ (0, import_react29.createElement)("textarea", { className: "bt-bs-input bt-bs-area", value: prompt, rows: 3, placeholder: t("Sum up what changed since yesterday and what needs me today."), onChange: (event) => setPrompt(event.target.value) })),- (0, import_react27.createElement)(- (0, import_react28.createElement)(++ (0, import_react29.createElement)("div",{ className: "bt-set-row bt-bs-row bt-bs-stack" },- (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, t("When"))),- (0, import_react27.createElement)(Segmented, { label: t("When"), value: kind }, KINDS.map(([id, label]) => (0, import_react27.createElement)("button", { key: id, type: "button", "aria-pressed": kind === id, onClick: () => setKind(id) }, t(label)))),- (0, import_react27.createElement)(- (0, import_react28.createElement)("span", { className: "bt-set-copy" }, (0, import_react28.createElement)("span", { className: "bt-bs-label" }, t("When"))),- (0, import_react28.createElement)(Segmented, { label: t("When"), value: kind }, KINDS.map(([id, label]) => (0, import_react28.createElement)("button", { key: id, type: "button", "aria-pressed": kind === id, onClick: () => setKind(id) }, t(label)))),- (0, import_react28.createElement)(++ (0, import_react29.createElement)("span", { className: "bt-set-copy" }, (0, import_react29.createElement)("span", { className: "bt-bs-label" }, t("When"))),++ (0, import_react29.createElement)(Segmented, { label: t("When"), value: kind }, KINDS.map(([id, label]) => (0, import_react29.createElement)("button", { key: id, type: "button", "aria-pressed": kind === id, onClick: () => setKind(id) }, t(label)))),++ (0, import_react29.createElement)("div",{ key: kind, className: "bt-task-when bt-veil" },- kind === "at" ? (0, import_react27.createElement)("input", { className: "bt-input", type: "datetime-local", value: at, "aria-label": t("Date and time"), onChange: (event) => setAt(event.target.value) }) : null,- kind === "weekly" ? (0, import_react27.createElement)("div", { className: "bt-task-days", role: "group", "aria-label": t("Days") }, [1, 2, 3, 4, 5, 6, 7].map((day) => (0, import_react27.createElement)("button", {- kind === "at" ? (0, import_react28.createElement)("input", { className: "bt-input", type: "datetime-local", value: at, "aria-label": t("Date and time"), onChange: (event) => setAt(event.target.value) }) : null,- kind === "weekly" ? (0, import_react28.createElement)("div", { className: "bt-task-days", role: "group", "aria-label": t("Days") }, [1, 2, 3, 4, 5, 6, 7].map((day) => (0, import_react28.createElement)("button", {++ kind === "at" ? (0, import_react29.createElement)("input", { className: "bt-input", type: "datetime-local", value: at, "aria-label": t("Date and time"), onChange: (event) => setAt(event.target.value) }) : null,++ kind === "weekly" ? (0, import_react29.createElement)("div", { className: "bt-task-days", role: "group", "aria-label": t("Days") }, [1, 2, 3, 4, 5, 6, 7].map((day) => (0, import_react29.createElement)("button", {key: day,type: "button",className: "bt-task-day","aria-pressed": weekdays.includes(day),onClick: () => toggleDay(day)}, when2(Date.UTC(2024, 0, day), { weekday: "narrow", timeZone: "UTC" })))) : null,- kind === "daily" || kind === "weekly" ? (0, import_react27.createElement)("input", { className: "bt-input bt-task-time", type: "time", value: time, "aria-label": t("Time"), onChange: (event) => setTime(event.target.value) }) : null,- kind === "every" ? (0, import_react27.createElement)(- import_react27.Fragment,- kind === "daily" || kind === "weekly" ? (0, import_react28.createElement)("input", { className: "bt-input bt-task-time", type: "time", value: time, "aria-label": t("Time"), onChange: (event) => setTime(event.target.value) }) : null,- kind === "every" ? (0, import_react28.createElement)(- import_react28.Fragment,++ kind === "daily" || kind === "weekly" ? (0, import_react29.createElement)("input", { className: "bt-input bt-task-time", type: "time", value: time, "aria-label": t("Time"), onChange: (event) => setTime(event.target.value) }) : null,++ kind === "every" ? (0, import_react29.createElement)(++ import_react29.Fragment,null,- (0, import_react27.createElement)("span", { className: "bt-task-every" }, t("Every")),- (0, import_react27.createElement)("input", { className: "bt-input bt-task-count", type: "number", min: 1, value: count, "aria-label": t("How many"), onChange: (event) => setCount(event.target.value) }),- (0, import_react27.createElement)(- (0, import_react28.createElement)("span", { className: "bt-task-every" }, t("Every")),- (0, import_react28.createElement)("input", { className: "bt-input bt-task-count", type: "number", min: 1, value: count, "aria-label": t("How many"), onChange: (event) => setCount(event.target.value) }),- (0, import_react28.createElement)(++ (0, import_react29.createElement)("span", { className: "bt-task-every" }, t("Every")),++ (0, import_react29.createElement)("input", { className: "bt-input bt-task-count", type: "number", min: 1, value: count, "aria-label": t("How many"), onChange: (event) => setCount(event.target.value) }),++ (0, import_react29.createElement)("select",{ className: "bt-select bt-task-unit", value: unit, "aria-label": t("Unit"), onChange: (event) => setUnit(event.target.value) },- UNITS.map(([id, , label]) => (0, import_react27.createElement)("option", { key: id, value: id }, t(label)))- UNITS.map(([id, , label]) => (0, import_react28.createElement)("option", { key: id, value: id }, t(label)))++ UNITS.map(([id, , label]) => (0, import_react29.createElement)("option", { key: id, value: id }, t(label))))) : null)),- error ? (0, import_react27.createElement)("div", { className: "bt-set-row" }, (0, import_react27.createElement)("span", { className: "bt-danger bt-set-hint" }, error)) : null,- (0, import_react27.createElement)(- error ? (0, import_react28.createElement)("div", { className: "bt-set-row" }, (0, import_react28.createElement)("span", { className: "bt-danger bt-set-hint" }, error)) : null,- (0, import_react28.createElement)(++ error ? (0, import_react29.createElement)("div", { className: "bt-set-row" }, (0, import_react29.createElement)("span", { className: "bt-danger bt-set-hint" }, error)) : null,++ (0, import_react29.createElement)("div",{ className: "bt-set-row bt-task-foot" },- (0, import_react27.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),- (0, import_react27.createElement)("button", { type: "submit", className: "bt-send bt-soft-sm", disabled: busy || !target || title.trim() === "" || prompt.trim() === "" }, busy ? t("Creating…") : t("Create task"))- (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),- (0, import_react28.createElement)("button", { type: "submit", className: "bt-send bt-soft-sm", disabled: busy || !target || title.trim() === "" || prompt.trim() === "" }, busy ? t("Creating…") : t("Create task"))++ (0, import_react29.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),++ (0, import_react29.createElement)("button", { type: "submit", className: "bt-send bt-soft-sm", disabled: busy || !target || title.trim() === "" || prompt.trim() === "" }, busy ? t("Creating…") : t("Create task"))));}function AutomationOff({ actions }) {- return (0, import_react27.createElement)(- return (0, import_react28.createElement)(++ return (0, import_react29.createElement)("div",{ className: "bt-set-card bt-task-off" },- (0, import_react27.createElement)("span", { className: "bt-task-off-mark" }, (0, import_react27.createElement)(ClockIcon)),- (0, import_react27.createElement)("span", { className: "bt-task-off-title" }, t("Turn on Automation tasks in DSH")),- (0, import_react27.createElement)("span", { className: "bt-set-hint" }, t("Switch on Automation tasks on the Plugins page in Advanced settings (DeepSeek Harness).")),- actions.openHarnessSettings ? (0, import_react27.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: actions.openHarnessSettings }, t("Open Advanced settings (DeepSeek Harness)")) : null- (0, import_react28.createElement)("span", { className: "bt-task-off-mark" }, (0, import_react28.createElement)(ClockIcon)),- (0, import_react28.createElement)("span", { className: "bt-task-off-title" }, t("Turn on Automation tasks in DSH")),- (0, import_react28.createElement)("span", { className: "bt-set-hint" }, t("Switch on Automation tasks on the Plugins page in Harness settings.")),- actions.openHarnessSettings ? (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: actions.openHarnessSettings }, t("Open Harness settings")) : null++ (0, import_react29.createElement)("span", { className: "bt-task-off-mark" }, (0, import_react29.createElement)(ClockIcon)),++ (0, import_react29.createElement)("span", { className: "bt-task-off-title" }, t("Turn on Automation tasks in DSH")),++ (0, import_react29.createElement)("span", { className: "bt-set-hint" }, t("Switch on Automation tasks on the Plugins page in Harness settings.")),++ actions.openHarnessSettings ? (0, import_react29.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: actions.openHarnessSettings }, t("Open Harness settings")) : null);}function SchedulesPage({ roster, actions, start }) {const view = useSchedules(actions);- const [adding, setAdding] = (0, import_react27.useState)(Boolean(start));- if (view === null) return (0, import_react27.createElement)("div", { className: "bt-set-hint" }, t("Loading…"));- if (!view.available) return (0, import_react27.createElement)(AutomationOff, { actions });+ const owner = start?.startsWith("bot:") ? start.slice(4) : start?.startsWith("room:") ? start.slice(5) : null;- const [adding, setAdding] = (0, import_react28.useState)(Boolean(start) && owner === null);- if (view === null) return (0, import_react28.createElement)("div", { className: "bt-set-hint" }, t("Loading…"));- if (!view.available) return (0, import_react28.createElement)(AutomationOff, { actions });++ const [adding, setAdding] = (0, import_react29.useState)(Boolean(start) && owner === null);++ if (view === null) return (0, import_react29.createElement)("div", { className: "bt-set-hint" }, t("Loading…"));++ if (!view.available) return (0, import_react29.createElement)(AutomationOff, { actions });const shown = (next) => {publish(next);setAdding(false);};const byChat = [- ...roster.bots.map((bot) => [bot.id, (0, import_react27.createElement)(BotAvatar, { bot, size: 18, badge: false, live: false }), bot.name, view.tasks.filter((task) => task.botId === bot.id)]),- ...roster.rooms.map((room2) => [room2.id, (0, import_react27.createElement)(RoomAvatar, { room: room2, roster, size: 18 }), room2.name, view.tasks.filter((task) => task.botId === void 0 && task.roomId === room2.id)])- ].filter(([, , , tasks]) => tasks.length > 0);- ...roster.bots.map((bot) => [bot.id, (0, import_react28.createElement)(BotAvatar, { bot, size: 18, badge: false, live: false }), bot.name, view.tasks.filter((task) => task.botId === bot.id)]),- ...roster.rooms.map((room2) => [room2.id, (0, import_react28.createElement)(RoomAvatar, { room: room2, roster, size: 18 }), room2.name, view.tasks.filter((task) => task.botId === void 0 && task.roomId === room2.id)])++ ...roster.bots.map((bot) => [bot.id, (0, import_react29.createElement)(BotAvatar, { bot, size: 18, badge: false, live: false }), bot.name, view.tasks.filter((task) => task.botId === bot.id)]),++ ...roster.rooms.map((room2) => [room2.id, (0, import_react29.createElement)(RoomAvatar, { room: room2, roster, size: 18 }), room2.name, view.tasks.filter((task) => task.botId === void 0 && task.roomId === room2.id)])+ ].filter(([id, , , tasks]) => tasks.length > 0 && (owner === null || id === owner));return [- adding ? (0, import_react27.createElement)(TaskForm, { key: "form", roster, actions, start, onDone: shown, onCancel: () => setAdding(false) }) : (0, import_react27.createElement)("div", { key: "add", className: "bt-actions" }, (0, import_react27.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", onClick: () => setAdding(true) }, (0, import_react27.createElement)(PlusIcon), t("New task"))),- byChat.length === 0 && !adding ? (0, import_react27.createElement)("div", { key: "none", className: "bt-set-card" }, (0, import_react27.createElement)("div", { className: "bt-set-row" }, (0, import_react27.createElement)("span", { className: "bt-set-hint" }, t("No scheduled tasks yet.")))) : byChat.map(([id, avatar, name, tasks]) => (0, import_react27.createElement)(- adding ? (0, import_react28.createElement)(TaskForm, { key: "form", roster, actions, start: owner ?? start, onDone: shown, onCancel: () => setAdding(false) }) : (0, import_react28.createElement)(++ adding ? (0, import_react29.createElement)(TaskForm, { key: "form", roster, actions, start: owner ?? start, onDone: shown, onCancel: () => setAdding(false) }) : (0, import_react29.createElement)(+ "div",+ { key: "add", className: "bt-actions" },- (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", onClick: () => setAdding(true) }, (0, import_react28.createElement)(PlusIcon), t("New task")),- owner !== null ? (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("schedules") }, t("Show all")) : null++ (0, import_react29.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", onClick: () => setAdding(true) }, (0, import_react29.createElement)(PlusIcon), t("New task")),++ owner !== null ? (0, import_react29.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("schedules") }, t("Show all")) : null+ ),- byChat.length === 0 && !adding ? (0, import_react28.createElement)("div", { key: "none", className: "bt-set-card" }, (0, import_react28.createElement)("div", { className: "bt-set-row" }, (0, import_react28.createElement)("span", { className: "bt-set-hint" }, t("No scheduled tasks yet.")))) : byChat.map(([id, avatar, name, tasks]) => (0, import_react28.createElement)(++ byChat.length === 0 && !adding ? (0, import_react29.createElement)("div", { key: "none", className: "bt-set-card" }, (0, import_react29.createElement)("div", { className: "bt-set-row" }, (0, import_react29.createElement)("span", { className: "bt-set-hint" }, t("No scheduled tasks yet.")))) : byChat.map(([id, avatar, name, tasks]) => (0, import_react29.createElement)("section",{ key: id, className: "bt-set-section" },- (0, import_react27.createElement)("h3", { className: "bt-task-head" }, avatar, name),- (0, import_react27.createElement)("div", { className: "bt-set-card" }, tasks.map((task) => (0, import_react27.createElement)(TaskRow, { key: task.id, task, actions, roster, onView: publish })))- (0, import_react28.createElement)("h3", { className: "bt-task-head" }, avatar, name),- (0, import_react28.createElement)("div", { className: "bt-set-card" }, tasks.map((task) => (0, import_react28.createElement)(TaskRow2, { key: task.id, task, actions, roster, onView: publish })))++ (0, import_react29.createElement)("h3", { className: "bt-task-head" }, avatar, name),++ (0, import_react29.createElement)("div", { className: "bt-set-card" }, tasks.map((task) => (0, import_react29.createElement)(TaskRow2, { key: task.id, task, actions, roster, onView: publish })))))];}@@@ -12639,21 -13138,21 +13488,21 @@@ function BotSchedules({ bot, roster, acconst view = useSchedules(actions);if (view === null) return null;const tasks = view.available ? view.tasks.filter((task) => task.botId === bot.id) : [];- return (0, import_react27.createElement)(- return (0, import_react28.createElement)(++ return (0, import_react29.createElement)("section",{ className: "bt-set-section" },- (0, import_react27.createElement)("h3", null, t("Scheduled tasks")),- (0, import_react27.createElement)(- (0, import_react28.createElement)("h3", null, t("Scheduled tasks")),- (0, import_react28.createElement)(++ (0, import_react29.createElement)("h3", null, t("Scheduled tasks")),++ (0, import_react29.createElement)("div",{ className: "bt-set-card" },- !view.available ? (0, import_react27.createElement)(- !view.available ? (0, import_react28.createElement)(++ !view.available ? (0, import_react29.createElement)("div",{ className: "bt-set-row bt-bs-row" },- (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-set-hint" }, t("Switch on Automation tasks on the Plugins page in Advanced settings (DeepSeek Harness)."))),- actions.openHarnessSettings ? (0, import_react27.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: actions.openHarnessSettings }, t("Open Advanced settings (DeepSeek Harness)")) : null- (0, import_react28.createElement)("span", { className: "bt-set-copy" }, (0, import_react28.createElement)("span", { className: "bt-set-hint" }, t("Switch on Automation tasks on the Plugins page in Harness settings."))),- actions.openHarnessSettings ? (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: actions.openHarnessSettings }, t("Open Harness settings")) : null++ (0, import_react29.createElement)("span", { className: "bt-set-copy" }, (0, import_react29.createElement)("span", { className: "bt-set-hint" }, t("Switch on Automation tasks on the Plugins page in Harness settings."))),++ actions.openHarnessSettings ? (0, import_react29.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: actions.openHarnessSettings }, t("Open Harness settings")) : null) : [- ...tasks.map((task) => (0, import_react27.createElement)(TaskRow, { key: task.id, task, actions, roster, onView: publish })),- (0, import_react27.createElement)("button", { key: "new", type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => actions.openSettings("schedules", bot.id) }, (0, import_react27.createElement)(PlusIcon), t("New task"))- ...tasks.map((task) => (0, import_react28.createElement)(TaskRow2, { key: task.id, task, actions, roster, onView: publish })),- (0, import_react28.createElement)("button", { key: "new", type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => actions.openSettings("schedules", bot.id) }, (0, import_react28.createElement)(PlusIcon), t("New task"))++ ...tasks.map((task) => (0, import_react29.createElement)(TaskRow2, { key: task.id, task, actions, roster, onView: publish })),++ (0, import_react29.createElement)("button", { key: "new", type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => actions.openSettings("schedules", bot.id) }, (0, import_react29.createElement)(PlusIcon), t("New task"))]));@@@ -12661,16 -13160,16 +13510,16 @@@function ScheduleSummary({ bot, actions }) {const view = useSchedules(actions);const tasks = view?.available ? view.tasks.filter((task) => task.botId === bot.id && task.status === "active") : [];- return (0, import_react27.createElement)(- return (0, import_react28.createElement)(++ return (0, import_react29.createElement)("div",null,- (0, import_react27.createElement)("div", { className: "bt-section-title" }, t("Scheduled tasks")),- tasks.length === 0 ? (0, import_react27.createElement)("button", { type: "button", className: "bt-more", onClick: () => actions.openSettings("schedules", bot.id) }, view?.available === false ? t("Switch on Automation tasks on the Plugins page in Advanced settings (DeepSeek Harness).") : t("No scheduled tasks yet. Add one")) : (0, import_react27.createElement)("div", { className: "bt-task-list" }, tasks.slice(0, 3).map((task) => (0, import_react27.createElement)(- (0, import_react28.createElement)("div", { className: "bt-section-title" }, tasks.length === 0 ? t("Scheduled tasks") : t("Scheduled tasks · {count}", { count: tasks.length })),- tasks.length === 0 ? (0, import_react28.createElement)("button", { type: "button", className: "bt-more", onClick: () => actions.openSettings("schedules", bot.id) }, view?.available === false ? t("Switch on Automation tasks on the Plugins page in Harness settings.") : t("No scheduled tasks yet. Add one")) : (0, import_react28.createElement)("div", { className: "bt-task-list" }, tasks.slice(0, 3).map((task) => (0, import_react28.createElement)(++ (0, import_react29.createElement)("div", { className: "bt-section-title" }, tasks.length === 0 ? t("Scheduled tasks") : t("Scheduled tasks · {count}", { count: tasks.length })),++ tasks.length === 0 ? (0, import_react29.createElement)("button", { type: "button", className: "bt-more", onClick: () => actions.openSettings("schedules", bot.id) }, view?.available === false ? t("Switch on Automation tasks on the Plugins page in Harness settings.") : t("No scheduled tasks yet. Add one")) : (0, import_react29.createElement)("div", { className: "bt-task-list" }, tasks.slice(0, 3).map((task) => (0, import_react29.createElement)("button",- { key: task.id, type: "button", className: "bt-task-line", onClick: () => actions.openSettings("schedules") },- (0, import_react27.createElement)(ClockIcon),- (0, import_react27.createElement)("span", { className: "bt-task-line-title" }, task.title),- (0, import_react27.createElement)("span", { className: "bt-task-line-when" }, timingText(task))+ { key: task.id, type: "button", className: "bt-task-line", onClick: () => actions.openSettings("schedules", `bot:${bot.id}`) },- (0, import_react28.createElement)(ClockIcon),- (0, import_react28.createElement)("span", { className: "bt-task-line-title" }, task.title),- (0, import_react28.createElement)("span", { className: "bt-task-line-when" }, timingText(task))++ (0, import_react29.createElement)(ClockIcon),++ (0, import_react29.createElement)("span", { className: "bt-task-line-title" }, task.title),++ (0, import_react29.createElement)("span", { className: "bt-task-line-when" }, timingText(task))))));}@@@ -12721,7 -13223,7 +13573,7 @@@ var SCHEDULE_CSS =`;// src/client/capability-settings.js- var import_react28 = require("react");-var import_react29 = require("react");++var import_react30 = require("react");var blank = () => ({ name: "", kind: "mcp", description: "", transport: "stdio", command: "", argsText: "", envText: "{}", url: "", headersText: "{}", content: "", items: [] });var parseMap = (text, label) => {let value;@@@ -12735,11 -13237,11 +13587,11 @@@};var statusText = (status) => !status ? void 0 : status.state === "ready" ? t("Ready") : status.state === "needs-approval" ? t("Needs approval") : status.state === "error" ? t("Could not connect: {error}", { error: status.error ?? "" }) : t("Connecting…");function Field({ label, value, onChange, multiline = false, disabled = false, placeholder }) {- return (0, import_react28.createElement)(- return (0, import_react29.createElement)(++ return (0, import_react30.createElement)("label",{ className: "bt-set-row bt-bs-row bt-bs-stack" },- (0, import_react28.createElement)("span", { className: "bt-set-copy" }, (0, import_react28.createElement)("span", { className: "bt-bs-label" }, t(label))),- (0, import_react28.createElement)(multiline ? "textarea" : "input", {- (0, import_react29.createElement)("span", { className: "bt-set-copy" }, (0, import_react29.createElement)("span", { className: "bt-bs-label" }, t(label))),- (0, import_react29.createElement)(multiline ? "textarea" : "input", {++ (0, import_react30.createElement)("span", { className: "bt-set-copy" }, (0, import_react30.createElement)("span", { className: "bt-bs-label" }, t(label))),++ (0, import_react30.createElement)(multiline ? "textarea" : "input", {className: multiline ? "bt-input bt-input-area" : "bt-input",value,disabled,@@@ -12751,7 -13253,7 +13603,7 @@@);}function CapabilityForm({ draft, setDraft, items, actions, onClose }) {- const [error, setError] = (0, import_react28.useState)("");- const [error, setError] = (0, import_react29.useState)("");++ const [error, setError] = (0, import_react30.useState)("");const set = (key, value) => setDraft((previous) => ({ ...previous, [key]: value }));const submit = async (event) => {event.preventDefault();@@@ -12782,95 -13284,95 +13634,95 @@@}};const available = items.filter((item) => item.name !== draft.name && ["mcp", "skill"].includes(item.kind));- return (0, import_react28.createElement)(- return (0, import_react29.createElement)(++ return (0, import_react30.createElement)("form",{ className: "bt-connector-form", onSubmit: submit },- (0, import_react28.createElement)(Field, { label: "Name", value: draft.name, disabled: draft.originalName !== void 0, onChange: (value) => set("name", value), placeholder: "my-tool" }),- (0, import_react28.createElement)(- (0, import_react29.createElement)(Field, { label: "Name", value: draft.name, disabled: draft.originalName !== void 0, onChange: (value) => set("name", value), placeholder: "my-tool" }),- (0, import_react29.createElement)(++ (0, import_react30.createElement)(Field, { label: "Name", value: draft.name, disabled: draft.originalName !== void 0, onChange: (value) => set("name", value), placeholder: "my-tool" }),++ (0, import_react30.createElement)("label",{ className: "bt-set-row bt-bs-row bt-bs-stack" },- (0, import_react28.createElement)("span", { className: "bt-set-copy" }, (0, import_react28.createElement)("span", { className: "bt-bs-label" }, t("Type"))),- (0, import_react28.createElement)(- (0, import_react29.createElement)("span", { className: "bt-set-copy" }, (0, import_react29.createElement)("span", { className: "bt-bs-label" }, t("Type"))),- (0, import_react29.createElement)(++ (0, import_react30.createElement)("span", { className: "bt-set-copy" }, (0, import_react30.createElement)("span", { className: "bt-bs-label" }, t("Type"))),++ (0, import_react30.createElement)("select",{ className: "bt-input", value: draft.kind, disabled: draft.originalName !== void 0, onChange: (event) => set("kind", event.target.value) },- ["mcp", "skill", "pack"].map((kind) => (0, import_react28.createElement)("option", { key: kind, value: kind }, t(kind === "mcp" ? "MCP server" : kind === "skill" ? "Skill" : "Pack")))- ["mcp", "skill", "pack"].map((kind) => (0, import_react29.createElement)("option", { key: kind, value: kind }, t(kind === "mcp" ? "MCP server" : kind === "skill" ? "Skill" : "Pack")))++ ["mcp", "skill", "pack"].map((kind) => (0, import_react30.createElement)("option", { key: kind, value: kind }, t(kind === "mcp" ? "MCP server" : kind === "skill" ? "Skill" : "Pack"))))),- (0, import_react28.createElement)(Field, { label: "Description", value: draft.description, onChange: (value) => set("description", value) }),- draft.kind === "mcp" ? (0, import_react28.createElement)(- (0, import_react29.createElement)(Field, { label: "Description", value: draft.description, onChange: (value) => set("description", value) }),- draft.kind === "mcp" ? (0, import_react29.createElement)(++ (0, import_react30.createElement)(Field, { label: "Description", value: draft.description, onChange: (value) => set("description", value) }),++ draft.kind === "mcp" ? (0, import_react30.createElement)("label",{ className: "bt-set-row bt-bs-row bt-bs-stack" },- (0, import_react28.createElement)("span", { className: "bt-set-copy" }, (0, import_react28.createElement)("span", { className: "bt-bs-label" }, t("Connection"))),- (0, import_react28.createElement)(- (0, import_react29.createElement)("span", { className: "bt-set-copy" }, (0, import_react29.createElement)("span", { className: "bt-bs-label" }, t("Connection"))),- (0, import_react29.createElement)(++ (0, import_react30.createElement)("span", { className: "bt-set-copy" }, (0, import_react30.createElement)("span", { className: "bt-bs-label" }, t("Connection"))),++ (0, import_react30.createElement)("select",{ className: "bt-input", value: draft.transport, onChange: (event) => set("transport", event.target.value) },- (0, import_react28.createElement)("option", { value: "stdio" }, t("Local command")),- (0, import_react28.createElement)("option", { value: "streamable-http" }, t("HTTP server"))- (0, import_react29.createElement)("option", { value: "stdio" }, t("Local command")),- (0, import_react29.createElement)("option", { value: "streamable-http" }, t("HTTP server"))++ (0, import_react30.createElement)("option", { value: "stdio" }, t("Local command")),++ (0, import_react30.createElement)("option", { value: "streamable-http" }, t("HTTP server")))) : null,- draft.kind === "mcp" && draft.transport === "stdio" ? (0, import_react28.createElement)(- draft.kind === "mcp" && draft.transport === "stdio" ? (0, import_react29.createElement)(++ draft.kind === "mcp" && draft.transport === "stdio" ? (0, import_react30.createElement)("div",null,- (0, import_react28.createElement)(Field, { label: "Command", value: draft.command, onChange: (value) => set("command", value) }),- (0, import_react28.createElement)(Field, { label: "Arguments (one per line)", value: draft.argsText, onChange: (value) => set("argsText", value), multiline: true }),- (0, import_react28.createElement)(Field, { label: "Environment (JSON)", value: draft.envText, onChange: (value) => set("envText", value), multiline: true, placeholder: t('{"API_KEY": "$DSH_SECRET_MY_KEY"}') })- (0, import_react29.createElement)(Field, { label: "Command", value: draft.command, onChange: (value) => set("command", value) }),- (0, import_react29.createElement)(Field, { label: "Arguments (one per line)", value: draft.argsText, onChange: (value) => set("argsText", value), multiline: true }),- (0, import_react29.createElement)(Field, { label: "Environment (JSON)", value: draft.envText, onChange: (value) => set("envText", value), multiline: true, placeholder: t('{"API_KEY": "$DSH_SECRET_MY_KEY"}') })++ (0, import_react30.createElement)(Field, { label: "Command", value: draft.command, onChange: (value) => set("command", value) }),++ (0, import_react30.createElement)(Field, { label: "Arguments (one per line)", value: draft.argsText, onChange: (value) => set("argsText", value), multiline: true }),++ (0, import_react30.createElement)(Field, { label: "Environment (JSON)", value: draft.envText, onChange: (value) => set("envText", value), multiline: true, placeholder: t('{"API_KEY": "$DSH_SECRET_MY_KEY"}') })) : null,- draft.kind === "mcp" && draft.transport === "streamable-http" ? (0, import_react28.createElement)(- draft.kind === "mcp" && draft.transport === "streamable-http" ? (0, import_react29.createElement)(++ draft.kind === "mcp" && draft.transport === "streamable-http" ? (0, import_react30.createElement)("div",null,- (0, import_react28.createElement)(Field, { label: "URL", value: draft.url, onChange: (value) => set("url", value) }),- (0, import_react28.createElement)(Field, { label: "Headers (JSON)", value: draft.headersText, onChange: (value) => set("headersText", value), multiline: true, placeholder: t('{"API_KEY": "$DSH_SECRET_MY_KEY"}') })- (0, import_react29.createElement)(Field, { label: "URL", value: draft.url, onChange: (value) => set("url", value) }),- (0, import_react29.createElement)(Field, { label: "Headers (JSON)", value: draft.headersText, onChange: (value) => set("headersText", value), multiline: true, placeholder: t('{"API_KEY": "$DSH_SECRET_MY_KEY"}') })++ (0, import_react30.createElement)(Field, { label: "URL", value: draft.url, onChange: (value) => set("url", value) }),++ (0, import_react30.createElement)(Field, { label: "Headers (JSON)", value: draft.headersText, onChange: (value) => set("headersText", value), multiline: true, placeholder: t('{"API_KEY": "$DSH_SECRET_MY_KEY"}') })) : null,- draft.kind === "skill" ? (0, import_react28.createElement)(Field, { label: "Skill instructions", value: draft.content, onChange: (value) => set("content", value), multiline: true }) : null,- draft.kind === "pack" ? (0, import_react28.createElement)(- draft.kind === "skill" ? (0, import_react29.createElement)(Field, { label: "Skill instructions", value: draft.content, onChange: (value) => set("content", value), multiline: true }) : null,- draft.kind === "pack" ? (0, import_react29.createElement)(++ draft.kind === "skill" ? (0, import_react30.createElement)(Field, { label: "Skill instructions", value: draft.content, onChange: (value) => set("content", value), multiline: true }) : null,++ draft.kind === "pack" ? (0, import_react30.createElement)("div",{ className: "bt-set-card" },- available.length === 0 ? (0, import_react28.createElement)("div", { className: "bt-set-row" }, (0, import_react28.createElement)("span", { className: "bt-set-hint" }, t("Save an MCP server or skill first."))) : available.map((item) => (0, import_react28.createElement)(- available.length === 0 ? (0, import_react29.createElement)("div", { className: "bt-set-row" }, (0, import_react29.createElement)("span", { className: "bt-set-hint" }, t("Save an MCP server or skill first."))) : available.map((item) => (0, import_react29.createElement)(++ available.length === 0 ? (0, import_react30.createElement)("div", { className: "bt-set-row" }, (0, import_react30.createElement)("span", { className: "bt-set-hint" }, t("Save an MCP server or skill first."))) : available.map((item) => (0, import_react30.createElement)("label",{ key: item.name, className: "bt-set-row bt-bs-row" },- (0, import_react28.createElement)("span", { className: "bt-set-copy" }, (0, import_react28.createElement)("span", { className: "bt-bs-label" }, item.name)),- (0, import_react28.createElement)("input", { type: "checkbox", checked: draft.items.includes(item.name), onChange: (event) => set("items", event.target.checked ? [...draft.items, item.name] : draft.items.filter((name) => name !== item.name)) })- (0, import_react29.createElement)("span", { className: "bt-set-copy" }, (0, import_react29.createElement)("span", { className: "bt-bs-label" }, item.name)),- (0, import_react29.createElement)("input", { type: "checkbox", checked: draft.items.includes(item.name), onChange: (event) => set("items", event.target.checked ? [...draft.items, item.name] : draft.items.filter((name) => name !== item.name)) })++ (0, import_react30.createElement)("span", { className: "bt-set-copy" }, (0, import_react30.createElement)("span", { className: "bt-bs-label" }, item.name)),++ (0, import_react30.createElement)("input", { type: "checkbox", checked: draft.items.includes(item.name), onChange: (event) => set("items", event.target.checked ? [...draft.items, item.name] : draft.items.filter((name) => name !== item.name)) })))) : null,- error ? (0, import_react28.createElement)("div", { className: "bt-connector-error", role: "alert" }, error) : null,- (0, import_react28.createElement)(- error ? (0, import_react29.createElement)("div", { className: "bt-connector-error", role: "alert" }, error) : null,- (0, import_react29.createElement)(++ error ? (0, import_react30.createElement)("div", { className: "bt-connector-error", role: "alert" }, error) : null,++ (0, import_react30.createElement)("div",{ className: "bt-connector-form-row" },- (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onClose }, t("Cancel")),- (0, import_react28.createElement)("button", { type: "submit", className: "bt-soft bt-soft-sm" }, draft.originalName ? t("Save changes") : t("Add capability"))- (0, import_react29.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onClose }, t("Cancel")),- (0, import_react29.createElement)("button", { type: "submit", className: "bt-soft bt-soft-sm" }, draft.originalName ? t("Save changes") : t("Add capability"))++ (0, import_react30.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onClose }, t("Cancel")),++ (0, import_react30.createElement)("button", { type: "submit", className: "bt-soft bt-soft-sm" }, draft.originalName ? t("Save changes") : t("Add capability"))));}function CapabilityRow({ item, onEdit, onDelete, onApprove, confirming }) {const detail = item.kind === "pack" ? `${t("Pack")}: ${(item.items ?? []).join(", ") || t("No items")}` : item.kind === "mcp" ? item.transport === "stdio" ? t("Local command") : t("HTTP server") : t("Skill");const secondary = item.kind === "pack" ? [item.description, (item.items ?? []).join(", ") || t("No items")].filter(Boolean).join(" · ") : item.description || detail;- return (0, import_react28.createElement)(- return (0, import_react29.createElement)(++ return (0, import_react30.createElement)("div",{ className: "bt-connector" },- (0, import_react28.createElement)(- (0, import_react29.createElement)(++ (0, import_react30.createElement)("div",{ className: "bt-connector-head" },- (0, import_react28.createElement)(- (0, import_react29.createElement)(++ (0, import_react30.createElement)("span",{ className: "bt-connector-text" },- (0, import_react28.createElement)("span", { className: "bt-connector-name" }, item.name),- (0, import_react28.createElement)("span", { className: "bt-connector-status" }, secondary)- (0, import_react29.createElement)("span", { className: "bt-connector-name" }, item.name),- (0, import_react29.createElement)("span", { className: "bt-connector-status" }, secondary)++ (0, import_react30.createElement)("span", { className: "bt-connector-name" }, item.name),++ (0, import_react30.createElement)("span", { className: "bt-connector-status" }, secondary)),- (0, import_react28.createElement)(- (0, import_react29.createElement)(++ (0, import_react30.createElement)("span",{ className: "bt-connector-actions" },- item.kind === "mcp" && item.transport === "stdio" && !item.approved ? (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onApprove }, t("Allow")) : null,- (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onEdit }, t("Edit")),- (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onDelete }, confirming ? t("Click again to delete.") : t("Delete"))- item.kind === "mcp" && item.transport === "stdio" && !item.approved ? (0, import_react29.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onApprove }, t("Allow")) : null,- (0, import_react29.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onEdit }, t("Edit")),- (0, import_react29.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onDelete }, confirming ? t("Click again to delete.") : t("Delete"))++ item.kind === "mcp" && item.transport === "stdio" && !item.approved ? (0, import_react30.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onApprove }, t("Allow")) : null,++ (0, import_react30.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onEdit }, t("Edit")),++ (0, import_react30.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onDelete }, confirming ? t("Click again to delete.") : t("Delete")))));}function CapabilitiesPage({ roster, actions, run: run2 }) {const items = [...roster.capabilities ?? []].sort((a, b) => a.name.localeCompare(b.name));- const [draft, setDraft] = (0, import_react28.useState)(null);- const [confirming, setConfirming] = (0, import_react28.useState)("");- (0, import_react28.useEffect)(() => {- const [draft, setDraft] = (0, import_react29.useState)(null);- const [confirming, setConfirming] = (0, import_react29.useState)("");- (0, import_react29.useEffect)(() => {++ const [draft, setDraft] = (0, import_react30.useState)(null);++ const [confirming, setConfirming] = (0, import_react30.useState)("");++ (0, import_react30.useEffect)(() => {if (!confirming) return void 0;const timer = setTimeout(() => setConfirming(""), 4e3);return () => clearTimeout(timer);@@@ -12893,20 -13395,20 +13745,20 @@@setConfirming("");void run2(actions.deleteCapability(item.name));};- return (0, import_react28.createElement)(- return (0, import_react29.createElement)(++ return (0, import_react30.createElement)("section",{ className: "bt-set-section" },- (0, import_react28.createElement)("h3", null, t("Shared capabilities")),- (0, import_react28.createElement)(- (0, import_react29.createElement)("h3", null, t("Shared capabilities")),- (0, import_react29.createElement)(++ (0, import_react30.createElement)("h3", null, t("Shared capabilities")),++ (0, import_react30.createElement)("div",{ className: "bt-actions" },- (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: startNew }, t("Add capability"))- (0, import_react29.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: startNew }, t("Add capability"))++ (0, import_react30.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: startNew }, t("Add capability"))),- draft ? (0, import_react28.createElement)(CapabilityForm, { draft, setDraft, items, actions, onClose: () => setDraft(null) }) : null,- (0, import_react28.createElement)(- draft ? (0, import_react29.createElement)(CapabilityForm, { draft, setDraft, items, actions, onClose: () => setDraft(null) }) : null,- (0, import_react29.createElement)(++ draft ? (0, import_react30.createElement)(CapabilityForm, { draft, setDraft, items, actions, onClose: () => setDraft(null) }) : null,++ (0, import_react30.createElement)("div",{ className: "bt-set-card bt-connectors-card" },- items.length === 0 ? (0, import_react28.createElement)("div", { className: "bt-set-row" }, (0, import_react28.createElement)("span", { className: "bt-set-hint" }, t("No capabilities saved"))) : items.map((item) => (0, import_react28.createElement)(CapabilityRow, {- items.length === 0 ? (0, import_react29.createElement)("div", { className: "bt-set-row" }, (0, import_react29.createElement)("span", { className: "bt-set-hint" }, t("No capabilities saved"))) : items.map((item) => (0, import_react29.createElement)(CapabilityRow, {++ items.length === 0 ? (0, import_react30.createElement)("div", { className: "bt-set-row" }, (0, import_react30.createElement)("span", { className: "bt-set-hint" }, t("No capabilities saved"))) : items.map((item) => (0, import_react30.createElement)(CapabilityRow, {key: item.name,item,confirming: confirming === item.name,@@@ -12922,10 -13424,10 +13774,10 @@@ function BotCapabilitiesCard({ bot, rosconst attached = new Set(bot.capabilities ?? []);const statuses = roster.capabilityStatuses?.[bot.id] ?? {};if (items.length === 0) return null;- return (0, import_react28.createElement)(- return (0, import_react29.createElement)(++ return (0, import_react30.createElement)(Card3,{ title: t("Capabilities") },- items.map((item) => (0, import_react28.createElement)(SwitchRow2, {- items.map((item) => (0, import_react29.createElement)(SwitchRow2, {++ items.map((item) => (0, import_react30.createElement)(SwitchRow2, {key: item.name,label: item.name,hint: attached.has(item.name) ? statusText(statuses[item.name]) : void 0,@@@ -12936,7 -13438,7 +13788,7 @@@}// src/client/avatar-library.js- var import_react29 = require("react");-var import_react30 = require("react");++var import_react31 = require("react");var CHUNK = 20;var PAGE = 24;async function avatarImage(file) {@@@ -12983,14 -13485,14 +13835,14 @@@ async function loadLibrary(actions, { oreturn { items, total: value?.total ?? items.length, next: value?.next ?? offset + items.length };}function AvatarLibraryPanel({ actions, onPick }) {- const [items, setItems] = (0, import_react29.useState)(null);- const [total, setTotal] = (0, import_react29.useState)(0);- const [offset, setOffset] = (0, import_react29.useState)(0);- const [busy, setBusy] = (0, import_react29.useState)(false);- const [error, setError] = (0, import_react29.useState)("");- const [report, setReport] = (0, import_react29.useState)(null);- const fileRef = (0, import_react29.useRef)(null);- const load = (0, import_react29.useCallback)(async (from = 0, append = false) => {- const [items, setItems] = (0, import_react30.useState)(null);- const [total, setTotal] = (0, import_react30.useState)(0);- const [offset, setOffset] = (0, import_react30.useState)(0);- const [busy, setBusy] = (0, import_react30.useState)(false);- const [error, setError] = (0, import_react30.useState)("");- const [report, setReport] = (0, import_react30.useState)(null);- const fileRef = (0, import_react30.useRef)(null);- const load = (0, import_react30.useCallback)(async (from = 0, append = false) => {++ const [items, setItems] = (0, import_react31.useState)(null);++ const [total, setTotal] = (0, import_react31.useState)(0);++ const [offset, setOffset] = (0, import_react31.useState)(0);++ const [busy, setBusy] = (0, import_react31.useState)(false);++ const [error, setError] = (0, import_react31.useState)("");++ const [report, setReport] = (0, import_react31.useState)(null);++ const fileRef = (0, import_react31.useRef)(null);++ const load = (0, import_react31.useCallback)(async (from = 0, append = false) => {try {const page = await loadLibrary(actions, { offset: from });setItems((previous) => append ? [...previous ?? [], ...page.items] : page.items);@@@ -13000,7 -13502,7 +13852,7 @@@setError(failure?.message ?? String(failure));}}, [actions]);- (0, import_react29.useEffect)(() => {- (0, import_react30.useEffect)(() => {++ (0, import_react31.useEffect)(() => {void load();}, [load]);const importFiles = async (files) => {@@@ -13035,18 -13537,18 +13887,18 @@@}};const shown = items?.length ?? 0;- return (0, import_react29.createElement)(- return (0, import_react30.createElement)(++ return (0, import_react31.createElement)("div",{ className: "bt-lib" },- (0, import_react29.createElement)(- (0, import_react30.createElement)(++ (0, import_react31.createElement)("div",{ className: "bt-lib-bar" },- (0, import_react29.createElement)(- (0, import_react30.createElement)(++ (0, import_react31.createElement)("button",{ type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => fileRef.current?.click() },busy ? t("Importing photos…") : t("Import photos")),- (0, import_react29.createElement)("input", {- (0, import_react30.createElement)("input", {++ (0, import_react31.createElement)("input", {ref: fileRef,type: "file",accept: "image/png,image/jpeg,image/webp,image/gif",@@@ -13059,35 -13561,35 +13911,35 @@@}})),- error ? (0, import_react29.createElement)("div", { className: "bt-error", role: "alert" }, error) : null,- items === null ? (0, import_react29.createElement)("div", { className: "bt-note" }, t("Loading…")) : null,- items?.length === 0 && !error ? (0, import_react29.createElement)("div", { className: "bt-note" }, t("No photos in the library yet.")) : null,- items?.length ? (0, import_react29.createElement)("div", { className: "bt-lib-grid" }, items.map((entry) => (0, import_react29.createElement)(- error ? (0, import_react30.createElement)("div", { className: "bt-error", role: "alert" }, error) : null,- items === null ? (0, import_react30.createElement)("div", { className: "bt-note" }, t("Loading…")) : null,- items?.length === 0 && !error ? (0, import_react30.createElement)("div", { className: "bt-note" }, t("No photos in the library yet.")) : null,- items?.length ? (0, import_react30.createElement)("div", { className: "bt-lib-grid" }, items.map((entry) => (0, import_react30.createElement)(++ error ? (0, import_react31.createElement)("div", { className: "bt-error", role: "alert" }, error) : null,++ items === null ? (0, import_react31.createElement)("div", { className: "bt-note" }, t("Loading…")) : null,++ items?.length === 0 && !error ? (0, import_react31.createElement)("div", { className: "bt-note" }, t("No photos in the library yet.")) : null,++ items?.length ? (0, import_react31.createElement)("div", { className: "bt-lib-grid" }, items.map((entry) => (0, import_react31.createElement)("div",{ key: entry.id, className: "bt-lib-cell" },- (0, import_react29.createElement)(- (0, import_react30.createElement)(++ (0, import_react31.createElement)("button",{ type: "button", className: "bt-lib-pick", title: entry.name, "aria-label": t("Use this photo"), onClick: () => onPick(entry) },- (0, import_react29.createElement)("img", { src: entry.image, alt: "" })- (0, import_react30.createElement)("img", { src: entry.image, alt: "" })++ (0, import_react31.createElement)("img", { src: entry.image, alt: "" })),- (0, import_react29.createElement)(- (0, import_react30.createElement)(++ (0, import_react31.createElement)("button",{ type: "button", className: "bt-lib-del", "aria-label": t("Remove photo from the library"), onClick: () => void remove(entry) },- (0, import_react29.createElement)(TrashIcon)- (0, import_react30.createElement)(TrashIcon)++ (0, import_react31.createElement)(TrashIcon))))) : null,- shown < total ? (0, import_react29.createElement)(- shown < total ? (0, import_react30.createElement)(++ shown < total ? (0, import_react31.createElement)("div",{ className: "bt-lib-more" },- (0, import_react29.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => void load(offset, true) }, t("Show more photos")),- (0, import_react29.createElement)("span", { className: "bt-note" }, t("Showing {shown} of {total} photos", { shown, total }))- (0, import_react30.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => void load(offset, true) }, t("Show more photos")),- (0, import_react30.createElement)("span", { className: "bt-note" }, t("Showing {shown} of {total} photos", { shown, total }))++ (0, import_react31.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => void load(offset, true) }, t("Show more photos")),++ (0, import_react31.createElement)("span", { className: "bt-note" }, t("Showing {shown} of {total} photos", { shown, total }))) : null,- report ? (0, import_react29.createElement)(- report ? (0, import_react30.createElement)(++ report ? (0, import_react31.createElement)("div",{ className: "bt-lib-report" },- report.imported.length ? (0, import_react29.createElement)("div", { className: "bt-note" }, report.imported.length === 1 ? t("1 photo imported") : t("{count} photos imported", { count: report.imported.length })) : null,- report.duplicates.length ? (0, import_react29.createElement)("div", { className: "bt-note" }, report.duplicates.length === 1 ? t("1 photo was already in the library") : t("{count} photos were already in the library", { count: report.duplicates.length })) : null,- report.failed.map((item, index) => (0, import_react29.createElement)(- report.imported.length ? (0, import_react30.createElement)("div", { className: "bt-note" }, report.imported.length === 1 ? t("1 photo imported") : t("{count} photos imported", { count: report.imported.length })) : null,- report.duplicates.length ? (0, import_react30.createElement)("div", { className: "bt-note" }, report.duplicates.length === 1 ? t("1 photo was already in the library") : t("{count} photos were already in the library", { count: report.duplicates.length })) : null,- report.failed.map((item, index) => (0, import_react30.createElement)(++ report.imported.length ? (0, import_react31.createElement)("div", { className: "bt-note" }, report.imported.length === 1 ? t("1 photo imported") : t("{count} photos imported", { count: report.imported.length })) : null,++ report.duplicates.length ? (0, import_react31.createElement)("div", { className: "bt-note" }, report.duplicates.length === 1 ? t("1 photo was already in the library") : t("{count} photos were already in the library", { count: report.duplicates.length })) : null,++ report.failed.map((item, index) => (0, import_react31.createElement)("div",{ key: index, className: "bt-note bt-danger" },t("{name}: {reason}", { name: item.name || t("photo"), reason: hostText(item.message) })@@@ -13111,7 -13613,7 +13963,7 @@@ var AVATAR_LIBRARY_CSS =`;// src/client/memory-panel.js- var import_react30 = require("react");-var import_react31 = require("react");++var import_react32 = require("react");var POLL_MS2 = 1500;var MENU_EXIT_MS2 = 120;var counts = /* @__PURE__ */ new Map();@@@ -13122,8 -13624,8 +13974,8 @@@ function noteCount(id, count)for (const listener of countListeners) listener();}function useMemoryCount(id, actions) {- const [count, setCount] = (0, import_react30.useState)(counts.get(id) ?? null);- (0, import_react30.useEffect)(() => {- const [count, setCount] = (0, import_react31.useState)(counts.get(id) ?? null);- (0, import_react31.useEffect)(() => {++ const [count, setCount] = (0, import_react32.useState)(counts.get(id) ?? null);++ (0, import_react32.useEffect)(() => {const listener = () => setCount(counts.get(id) ?? null);countListeners.add(listener);listener();@@@ -13142,16 -13644,16 +13994,16 @@@function MemoryRow({ owner, actions }) {const count = useMemoryCount(owner.id, actions);const label = count === null ? t("Loading…") : count === 0 ? t("Nothing saved yet") : count === 1 ? t("1 entry") : t("{count} entries", { count });- return (0, import_react30.createElement)(- return (0, import_react31.createElement)(++ return (0, import_react32.createElement)("div",null,- (0, import_react30.createElement)("div", { className: "bt-section-title" }, t("Memory")),- (0, import_react30.createElement)(- (0, import_react31.createElement)("div", { className: "bt-section-title" }, t("Memory")),- (0, import_react31.createElement)(++ (0, import_react32.createElement)("div", { className: "bt-section-title" }, t("Memory")),++ (0, import_react32.createElement)("button",{ type: "button", className: "bt-mem-row", "aria-label": t("Manage {name}'s memory", { name: owner.name }), onClick: () => actions.openMemory(owner.id) },- (0, import_react30.createElement)(MemoryIcon),- (0, import_react30.createElement)("span", { className: "bt-mem-row-copy" }, label),- (0, import_react30.createElement)("span", { className: "bt-mem-row-go" }, t("Manage"), (0, import_react30.createElement)(ChevronRightIcon))- (0, import_react31.createElement)(MemoryIcon),- (0, import_react31.createElement)("span", { className: "bt-mem-row-copy" }, label),- (0, import_react31.createElement)("span", { className: "bt-mem-row-go" }, t("Manage"), (0, import_react31.createElement)(ChevronRightIcon))++ (0, import_react32.createElement)(MemoryIcon),++ (0, import_react32.createElement)("span", { className: "bt-mem-row-copy" }, label),++ (0, import_react32.createElement)("span", { className: "bt-mem-row-go" }, t("Manage"), (0, import_react32.createElement)(ChevronRightIcon))));}@@@ -13166,45 -13668,45 +14018,45 @@@ function ago(at, now)return format.format(-Math.round(hours / 24), "day");}function Skeleton({ label }) {- return (0, import_react30.createElement)(- return (0, import_react31.createElement)(++ return (0, import_react32.createElement)("div",{ className: "bt-mem-skel", "aria-busy": true },- [0, 1].map((block) => (0, import_react30.createElement)(- [0, 1].map((block) => (0, import_react31.createElement)(++ [0, 1].map((block) => (0, import_react32.createElement)("div",{ key: block, className: "bt-mem-skel-block" },- (0, import_react30.createElement)("span", { className: "bt-mem-skel-head" }),- (0, import_react30.createElement)("span", null),- (0, import_react30.createElement)("span", null),- (0, import_react30.createElement)("span", { style: { width: block === 0 ? "62%" : "48%" } })- (0, import_react31.createElement)("span", { className: "bt-mem-skel-head" }),- (0, import_react31.createElement)("span", null),- (0, import_react31.createElement)("span", null),- (0, import_react31.createElement)("span", { style: { width: block === 0 ? "62%" : "48%" } })++ (0, import_react32.createElement)("span", { className: "bt-mem-skel-head" }),++ (0, import_react32.createElement)("span", null),++ (0, import_react32.createElement)("span", null),++ (0, import_react32.createElement)("span", { style: { width: block === 0 ? "62%" : "48%" } }))),- label ? (0, import_react30.createElement)("div", { className: "bt-mem-skel-label" }, label) : null- label ? (0, import_react31.createElement)("div", { className: "bt-mem-skel-label" }, label) : null++ label ? (0, import_react32.createElement)("div", { className: "bt-mem-skel-label" }, label) : null);}function Summary({ owner, view, regenerate }) {if (view.entries.length === 0) {- return (0, import_react30.createElement)(- return (0, import_react31.createElement)(++ return (0, import_react32.createElement)("div",{ className: "bt-mem-empty" },- (0, import_react30.createElement)("div", { className: "bt-mem-empty-mark" }, (0, import_react30.createElement)(MemoryIcon)),- (0, import_react30.createElement)("div", { className: "bt-mem-empty-title" }, owner.group ? t("Nothing is saved for this group yet") : t("{name} has not saved anything yet", { name: owner.name })),- (0, import_react30.createElement)("div", { className: "bt-mem-empty-text" }, owner.group ? t("A group keeps the decisions, rules, and facts its work needs, for its members to read here. Tell it below, or in the group.") : t("Bots keep lasting preferences, decisions, and what you ask them to remember. Tell {name} below, or in its chat.", { name: owner.name }))- (0, import_react31.createElement)("div", { className: "bt-mem-empty-mark" }, (0, import_react31.createElement)(MemoryIcon)),- (0, import_react31.createElement)("div", { className: "bt-mem-empty-title" }, owner.group ? t("Nothing is saved for this group yet") : t("{name} has not saved anything yet", { name: owner.name })),- (0, import_react31.createElement)("div", { className: "bt-mem-empty-text" }, owner.group ? t("A group keeps the decisions, rules, and facts its work needs, for its members to read here. Tell it below, or in the group.") : t("Bots keep lasting preferences, decisions, and what you ask them to remember. Tell {name} below, or in its chat.", { name: owner.name }))++ (0, import_react32.createElement)("div", { className: "bt-mem-empty-mark" }, (0, import_react32.createElement)(MemoryIcon)),++ (0, import_react32.createElement)("div", { className: "bt-mem-empty-title" }, owner.group ? t("Nothing is saved for this group yet") : t("{name} has not saved anything yet", { name: owner.name })),++ (0, import_react32.createElement)("div", { className: "bt-mem-empty-text" }, owner.group ? t("A group keeps the decisions, rules, and facts its work needs, for its members to read here. Tell it below, or in the group.") : t("Bots keep lasting preferences, decisions, and what you ask them to remember. Tell {name} below, or in its chat.", { name: owner.name })));}- const failed = view.error && !view.summarizing ? (0, import_react30.createElement)(- const failed = view.error && !view.summarizing ? (0, import_react31.createElement)(++ const failed = view.error && !view.summarizing ? (0, import_react32.createElement)("div",{ className: "bt-mem-failed", role: "alert" },- (0, import_react30.createElement)("span", null, view.summary ? t("The summary is out of date: {reason}", { reason: hostText(view.error) }) : t("The summary could not be written: {reason}", { reason: hostText(view.error) })),- (0, import_react30.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: regenerate }, t("Try again"))- (0, import_react31.createElement)("span", null, view.summary ? t("The summary is out of date: {reason}", { reason: hostText(view.error) }) : t("The summary could not be written: {reason}", { reason: hostText(view.error) })),- (0, import_react31.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: regenerate }, t("Try again"))++ (0, import_react32.createElement)("span", null, view.summary ? t("The summary is out of date: {reason}", { reason: hostText(view.error) }) : t("The summary could not be written: {reason}", { reason: hostText(view.error) })),++ (0, import_react32.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: regenerate }, t("Try again"))) : null;- if (!view.summary) return (0, import_react30.createElement)(import_react30.Fragment, null, failed, failed ? null : (0, import_react30.createElement)(Skeleton, { label: t("Writing the summary…") }));- return (0, import_react30.createElement)(- import_react30.Fragment,- if (!view.summary) return (0, import_react31.createElement)(import_react31.Fragment, null, failed, failed ? null : (0, import_react31.createElement)(Skeleton, { label: t("Writing the summary…") }));- return (0, import_react31.createElement)(- import_react31.Fragment,++ if (!view.summary) return (0, import_react32.createElement)(import_react32.Fragment, null, failed, failed ? null : (0, import_react32.createElement)(Skeleton, { label: t("Writing the summary…") }));++ return (0, import_react32.createElement)(++ import_react32.Fragment,null,failed,- (0, import_react30.createElement)(- (0, import_react31.createElement)(++ (0, import_react32.createElement)("div",{ key: view.summary.at, className: "bt-mem-summary", "data-stale": !view.fresh || void 0 },- summaryBlocks(view.summary.text).map((block, index) => block.kind === "h" ? (0, import_react30.createElement)("h3", { key: index }, block.text) : (0, import_react30.createElement)("p", { key: index }, block.text))- summaryBlocks(view.summary.text).map((block, index) => block.kind === "h" ? (0, import_react31.createElement)("h3", { key: index }, block.text) : (0, import_react31.createElement)("p", { key: index }, block.text))++ summaryBlocks(view.summary.text).map((block, index) => block.kind === "h" ? (0, import_react32.createElement)("h3", { key: index }, block.text) : (0, import_react32.createElement)("p", { key: index }, block.text))));}@@@ -13216,9 -13718,9 +14068,9 @@@ var groupEntries = (entries2) => entriereturn groups;}, []);function EntryRow({ entry, remove }) {- const [confirming, setConfirming] = (0, import_react30.useState)(false);- const [busy, setBusy] = (0, import_react30.useState)(false);- (0, import_react30.useEffect)(() => {- const [confirming, setConfirming] = (0, import_react31.useState)(false);- const [busy, setBusy] = (0, import_react31.useState)(false);- (0, import_react31.useEffect)(() => {++ const [confirming, setConfirming] = (0, import_react32.useState)(false);++ const [busy, setBusy] = (0, import_react32.useState)(false);++ (0, import_react32.useEffect)(() => {if (!confirming) return void 0;const timer = setTimeout(() => setConfirming(false), 3e3);return () => clearTimeout(timer);@@@ -13233,16 -13735,16 +14085,16 @@@setBusy(true);if (!await remove(entry)) setBusy(false);};- return (0, import_react30.createElement)(- return (0, import_react31.createElement)(++ return (0, import_react32.createElement)("li",{ className: "bt-mem-entry", "data-busy": busy || void 0 },- (0, import_react30.createElement)(- (0, import_react31.createElement)(++ (0, import_react32.createElement)("div",{ className: "bt-mem-entry-copy" },- (0, import_react30.createElement)("span", { className: "bt-mem-entry-text" }, entry.text),- meta ? (0, import_react30.createElement)("span", { className: "bt-mem-entry-meta" }, meta) : null- (0, import_react31.createElement)("span", { className: "bt-mem-entry-text" }, entry.text),- meta ? (0, import_react31.createElement)("span", { className: "bt-mem-entry-meta" }, meta) : null++ (0, import_react32.createElement)("span", { className: "bt-mem-entry-text" }, entry.text),++ meta ? (0, import_react32.createElement)("span", { className: "bt-mem-entry-meta" }, meta) : null),- (0, import_react30.createElement)("button", {- (0, import_react31.createElement)("button", {++ (0, import_react32.createElement)("button", {type: "button",className: "bt-mem-remove","data-confirm": confirming || void 0,@@@ -13250,7 -13752,7 +14102,7 @@@"aria-label": confirming ? t("Click again to remove") : t("Remove from memory"),title: confirming ? void 0 : t("Remove from memory"),onClick: click- }, confirming ? t("Remove") : (0, import_react30.createElement)(TrashIcon))- }, confirming ? t("Remove") : (0, import_react31.createElement)(TrashIcon))++ }, confirming ? t("Remove") : (0, import_react32.createElement)(TrashIcon)));}function Entries({ owner, view, remove }) {@@@ -13259,25 -13761,25 +14111,25 @@@{ scope: "own", title: t("{name}'s memory", { name: owner.name }), size: view.sizes.own },{ scope: "team", title: t("Team memory"), hint: t("Every Bot reads it"), size: view.sizes.team }];- return (0, import_react30.createElement)(- return (0, import_react31.createElement)(++ return (0, import_react32.createElement)("div",{ className: "bt-mem-entries" },- sections.map((section) => (0, import_react30.createElement)(- sections.map((section) => (0, import_react31.createElement)(++ sections.map((section) => (0, import_react32.createElement)("section",{ key: section.scope, className: "bt-mem-section" },- (0, import_react30.createElement)(- (0, import_react31.createElement)(++ (0, import_react32.createElement)("div",{ className: "bt-mem-section-head" },- (0, import_react30.createElement)("h3", null, section.title),- section.hint ? (0, import_react30.createElement)("span", null, section.hint) : null,- (0, import_react30.createElement)("span", { className: "bt-mem-size", title: t("MEMORY.md, which every conversation reads") }, t("{used} of {limit} characters", { used: section.size.toLocaleString(dateLocale()), limit: view.limits.main.toLocaleString(dateLocale()) }))- (0, import_react31.createElement)("h3", null, section.title),- section.hint ? (0, import_react31.createElement)("span", null, section.hint) : null,- (0, import_react31.createElement)("span", { className: "bt-mem-size", title: t("MEMORY.md, which every conversation reads") }, t("{used} of {limit} characters", { used: section.size.toLocaleString(dateLocale()), limit: view.limits.main.toLocaleString(dateLocale()) }))++ (0, import_react32.createElement)("h3", null, section.title),++ section.hint ? (0, import_react32.createElement)("span", null, section.hint) : null,++ (0, import_react32.createElement)("span", { className: "bt-mem-size", title: t("MEMORY.md, which every conversation reads") }, t("{used} of {limit} characters", { used: section.size.toLocaleString(dateLocale()), limit: view.limits.main.toLocaleString(dateLocale()) }))),- groups.some((group) => group.scope === section.scope) ? groups.filter((group) => group.scope === section.scope).map((group) => (0, import_react30.createElement)(- import_react30.Fragment,- groups.some((group) => group.scope === section.scope) ? groups.filter((group) => group.scope === section.scope).map((group) => (0, import_react31.createElement)(- import_react31.Fragment,++ groups.some((group) => group.scope === section.scope) ? groups.filter((group) => group.scope === section.scope).map((group) => (0, import_react32.createElement)(++ import_react32.Fragment,{ key: group.key },- group.topic ? (0, import_react30.createElement)("div", { className: "bt-mem-topic" }, group.topic) : null,- (0, import_react30.createElement)("ul", { className: "bt-mem-list" }, group.entries.map((entry) => (0, import_react30.createElement)(EntryRow, { key: `${entry.topic ?? ""}:${entry.text}`, entry, remove })))- )) : (0, import_react30.createElement)("div", { className: "bt-mem-none" }, t("Nothing saved yet"))- group.topic ? (0, import_react31.createElement)("div", { className: "bt-mem-topic" }, group.topic) : null,- (0, import_react31.createElement)("ul", { className: "bt-mem-list" }, group.entries.map((entry) => (0, import_react31.createElement)(EntryRow, { key: `${entry.topic ?? ""}:${entry.text}`, entry, remove })))- )) : (0, import_react31.createElement)("div", { className: "bt-mem-none" }, t("Nothing saved yet"))++ group.topic ? (0, import_react32.createElement)("div", { className: "bt-mem-topic" }, group.topic) : null,++ (0, import_react32.createElement)("ul", { className: "bt-mem-list" }, group.entries.map((entry) => (0, import_react32.createElement)(EntryRow, { key: `${entry.topic ?? ""}:${entry.text}`, entry, remove })))++ )) : (0, import_react32.createElement)("div", { className: "bt-mem-none" }, t("Nothing saved yet")))));}@@@ -13289,40 -13791,40 +14141,40 @@@ function changeLine(change)return change.scope === "team" ? t("Added to team memory: {text}", { text }) : t("Added: {text}", { text });}function Reply({ answer, dismiss }) {- return (0, import_react30.createElement)(- return (0, import_react31.createElement)(++ return (0, import_react32.createElement)("div",{ className: "bt-mem-reply", role: "status" },- (0, import_react30.createElement)(- (0, import_react31.createElement)(++ (0, import_react32.createElement)("div",{ className: "bt-mem-reply-head" },- (0, import_react30.createElement)("span", { className: "bt-mem-reply-asked" }, answer.asked),- answer.pending ? null : (0, import_react30.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Dismiss"), onClick: dismiss }, (0, import_react30.createElement)(CloseIcon))- (0, import_react31.createElement)("span", { className: "bt-mem-reply-asked" }, answer.asked),- answer.pending ? null : (0, import_react31.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Dismiss"), onClick: dismiss }, (0, import_react31.createElement)(CloseIcon))++ (0, import_react32.createElement)("span", { className: "bt-mem-reply-asked" }, answer.asked),++ answer.pending ? null : (0, import_react32.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Dismiss"), onClick: dismiss }, (0, import_react32.createElement)(CloseIcon))),- answer.pending ? (0, import_react30.createElement)("div", { className: "bt-mem-reply-text bt-shimmer" }, t("Thinking…")) : answer.error ? (0, import_react30.createElement)("div", { className: "bt-mem-reply-text bt-danger" }, hostText(answer.error)) : (0, import_react30.createElement)(- import_react30.Fragment,- answer.pending ? (0, import_react31.createElement)("div", { className: "bt-mem-reply-text bt-shimmer" }, t("Thinking…")) : answer.error ? (0, import_react31.createElement)("div", { className: "bt-mem-reply-text bt-danger" }, hostText(answer.error)) : (0, import_react31.createElement)(- import_react31.Fragment,++ answer.pending ? (0, import_react32.createElement)("div", { className: "bt-mem-reply-text bt-shimmer" }, t("Thinking…")) : answer.error ? (0, import_react32.createElement)("div", { className: "bt-mem-reply-text bt-danger" }, hostText(answer.error)) : (0, import_react32.createElement)(++ import_react32.Fragment,null,- answer.reply ? (0, import_react30.createElement)("div", { className: "bt-mem-reply-text" }, answer.reply) : null,- answer.changes.length > 0 ? (0, import_react30.createElement)("ul", { className: "bt-mem-changes" }, answer.changes.map((change, index) => (0, import_react30.createElement)(- answer.reply ? (0, import_react31.createElement)("div", { className: "bt-mem-reply-text" }, answer.reply) : null,- answer.changes.length > 0 ? (0, import_react31.createElement)("ul", { className: "bt-mem-changes" }, answer.changes.map((change, index) => (0, import_react31.createElement)(++ answer.reply ? (0, import_react32.createElement)("div", { className: "bt-mem-reply-text" }, answer.reply) : null,++ answer.changes.length > 0 ? (0, import_react32.createElement)("ul", { className: "bt-mem-changes" }, answer.changes.map((change, index) => (0, import_react32.createElement)("li",{ key: index, "data-ok": change.ok || void 0 },- change.ok ? (0, import_react30.createElement)(CheckIcon) : (0, import_react30.createElement)(CloseIcon),- (0, import_react30.createElement)("span", null, changeLine(change))- change.ok ? (0, import_react31.createElement)(CheckIcon) : (0, import_react31.createElement)(CloseIcon),- (0, import_react31.createElement)("span", null, changeLine(change))++ change.ok ? (0, import_react32.createElement)(CheckIcon) : (0, import_react32.createElement)(CloseIcon),++ (0, import_react32.createElement)("span", null, changeLine(change))))) : null));}function useMemoryView(id, actions) {- const [view, setView] = (0, import_react30.useState)(null);- const [error, setError] = (0, import_react30.useState)("");- const timer = (0, import_react30.useRef)(0);- const latest = (0, import_react30.useRef)(0);- const alive = (0, import_react30.useRef)(true);- const show2 = (0, import_react30.useCallback)((next) => {- const [view, setView] = (0, import_react31.useState)(null);- const [error, setError] = (0, import_react31.useState)("");- const timer = (0, import_react31.useRef)(0);- const latest = (0, import_react31.useRef)(0);- const alive = (0, import_react31.useRef)(true);- const show2 = (0, import_react31.useCallback)((next) => {++ const [view, setView] = (0, import_react32.useState)(null);++ const [error, setError] = (0, import_react32.useState)("");++ const timer = (0, import_react32.useRef)(0);++ const latest = (0, import_react32.useRef)(0);++ const alive = (0, import_react32.useRef)(true);++ const show2 = (0, import_react32.useCallback)((next) => {setView(next);setError("");noteCount(id, next.entries.length);}, [id]);- const load = (0, import_react30.useCallback)(async (flags = {}) => {- const load = (0, import_react31.useCallback)(async (flags = {}) => {++ const load = (0, import_react32.useCallback)(async (flags = {}) => {clearTimeout(timer.current);const ticket = ++latest.current;try {@@@ -13334,7 -13836,7 +14186,7 @@@if (alive.current && ticket === latest.current) setError(failure?.message ?? String(failure));}}, [id]);- (0, import_react30.useEffect)(() => {- (0, import_react31.useEffect)(() => {++ (0, import_react32.useEffect)(() => {alive.current = true;void load({ summarize: true });return () => {@@@ -13345,8 -13847,8 +14197,8 @@@return { view, error, load, show: show2 };}function useNow(every) {- const [now, setNow] = (0, import_react30.useState)(Date.now());- (0, import_react30.useEffect)(() => {- const [now, setNow] = (0, import_react31.useState)(Date.now());- (0, import_react31.useEffect)(() => {++ const [now, setNow] = (0, import_react32.useState)(Date.now());++ (0, import_react32.useEffect)(() => {const id = setInterval(() => setNow(Date.now()), every);return () => clearInterval(id);}, [every]);@@@ -13354,18 -13856,18 +14206,18 @@@}function MemoryDialog({ owner, actions, leaving = false }) {const { view, error, load, show: show2 } = useMemoryView(owner.id, actions);- const [page, setPage] = (0, import_react30.useState)("summary");- const [menu, setMenu] = (0, import_react30.useState)(false);- const [page, setPage] = (0, import_react31.useState)("summary");- const [menu, setMenu] = (0, import_react31.useState)(false);++ const [page, setPage] = (0, import_react32.useState)("summary");++ const [menu, setMenu] = (0, import_react32.useState)(false);const [menuShown, menuLeaving] = useLinger(menu, MENU_EXIT_MS2);- const [text, setText] = (0, import_react30.useState)("");- const [answer, setAnswer] = (0, import_react30.useState)(null);- const menuRef = (0, import_react30.useRef)(null);- const dotsRef = (0, import_react30.useRef)(null);- const inputRef = (0, import_react30.useRef)(null);- const [text, setText] = (0, import_react31.useState)("");- const [answer, setAnswer] = (0, import_react31.useState)(null);- const menuRef = (0, import_react31.useRef)(null);- const dotsRef = (0, import_react31.useRef)(null);- const inputRef = (0, import_react31.useRef)(null);++ const [text, setText] = (0, import_react32.useState)("");++ const [answer, setAnswer] = (0, import_react32.useState)(null);++ const menuRef = (0, import_react32.useRef)(null);++ const dotsRef = (0, import_react32.useRef)(null);++ const inputRef = (0, import_react32.useRef)(null);const now = useNow(3e4);- const close = (0, import_react30.useCallback)(() => actions.closeMemory(), []);- const close = (0, import_react31.useCallback)(() => actions.closeMemory(), []);++ const close = (0, import_react32.useCallback)(() => actions.closeMemory(), []);useEscape(close);- (0, import_react30.useEffect)(() => {- (0, import_react31.useEffect)(() => {++ (0, import_react32.useEffect)(() => {if (!menu) return void 0;const onDown = (event) => {if (menuRef.current?.contains(event.target) || dotsRef.current?.contains(event.target)) return;@@@ -13427,52 -13929,52 +14279,52 @@@const when3 = view?.summary ? ago(view.summary.at, now) : null;const status = view === null ? "" : page === "entries" ? count === 1 ? t("1 entry") : t("{count} entries", { count }) : view.summarizing && view.summary ? t("Updating…") : view.summary && view.fresh ? when3 ? t("Updated {time}", { time: when3 }) : t("Updated just now") : "";const busy = answer?.pending === true;- return (0, import_react30.createElement)(- return (0, import_react31.createElement)(++ return (0, import_react32.createElement)("div",{ className: "bt-mem-layer", "data-leaving": leaving || void 0 },- (0, import_react30.createElement)("div", { className: "bt-scrim bt-mem-scrim", onMouseDown: close }),- (0, import_react30.createElement)(- (0, import_react31.createElement)("div", { className: "bt-scrim bt-mem-scrim", onMouseDown: close }),- (0, import_react31.createElement)(++ (0, import_react32.createElement)("div", { className: "bt-scrim bt-mem-scrim", onMouseDown: close }),++ (0, import_react32.createElement)("div",{ className: "bt-mem", role: "dialog", "aria-modal": true, "aria-label": t("{name}'s memory", { name: owner.name }) },- (0, import_react30.createElement)(- (0, import_react31.createElement)(++ (0, import_react32.createElement)("div",{ className: "bt-mem-head" },- page === "entries" ? (0, import_react30.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to the summary"), onClick: backToSummary }, (0, import_react30.createElement)(ChevronLeftIcon)) : null,- (0, import_react30.createElement)("h2", null, page === "entries" ? t("All entries") : t("Memory summary")),- (0, import_react30.createElement)("span", { className: "bt-mem-status" }, page === "summary" ? [owner.name, status].filter(Boolean).join(" · ") : status),- (0, import_react30.createElement)("span", { className: "bt-mem-head-gap" }),- (0, import_react30.createElement)("button", { ref: dotsRef, type: "button", className: "bt-icon-btn", "aria-label": t("Memory options"), "aria-haspopup": "menu", "aria-expanded": menu, onClick: () => setMenu((value) => !value) }, (0, import_react30.createElement)(DotsIcon)),- (0, import_react30.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close memory"), onClick: close }, (0, import_react30.createElement)(CloseIcon)),- menuShown ? (0, import_react30.createElement)(- page === "entries" ? (0, import_react31.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to the summary"), onClick: backToSummary }, (0, import_react31.createElement)(ChevronLeftIcon)) : null,- (0, import_react31.createElement)("h2", null, page === "entries" ? t("All entries") : t("Memory summary")),- (0, import_react31.createElement)("span", { className: "bt-mem-status" }, page === "summary" ? [owner.name, status].filter(Boolean).join(" · ") : status),- (0, import_react31.createElement)("span", { className: "bt-mem-head-gap" }),- (0, import_react31.createElement)("button", { ref: dotsRef, type: "button", className: "bt-icon-btn", "aria-label": t("Memory options"), "aria-haspopup": "menu", "aria-expanded": menu, onClick: () => setMenu((value) => !value) }, (0, import_react31.createElement)(DotsIcon)),- (0, import_react31.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close memory"), onClick: close }, (0, import_react31.createElement)(CloseIcon)),- menuShown ? (0, import_react31.createElement)(++ page === "entries" ? (0, import_react32.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to the summary"), onClick: backToSummary }, (0, import_react32.createElement)(ChevronLeftIcon)) : null,++ (0, import_react32.createElement)("h2", null, page === "entries" ? t("All entries") : t("Memory summary")),++ (0, import_react32.createElement)("span", { className: "bt-mem-status" }, page === "summary" ? [owner.name, status].filter(Boolean).join(" · ") : status),++ (0, import_react32.createElement)("span", { className: "bt-mem-head-gap" }),++ (0, import_react32.createElement)("button", { ref: dotsRef, type: "button", className: "bt-icon-btn", "aria-label": t("Memory options"), "aria-haspopup": "menu", "aria-expanded": menu, onClick: () => setMenu((value) => !value) }, (0, import_react32.createElement)(DotsIcon)),++ (0, import_react32.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close memory"), onClick: close }, (0, import_react32.createElement)(CloseIcon)),++ menuShown ? (0, import_react32.createElement)("div",{ ref: menuRef, className: "bt-menu bt-mem-menu", role: "menu", "aria-label": t("Memory options"), "data-leaving": menuLeaving || void 0 },- (0, import_react30.createElement)(- (0, import_react31.createElement)(++ (0, import_react32.createElement)("button",{ type: "button", role: "menuitem", onClick: openEntries },- (0, import_react30.createElement)("span", { className: "bt-menu-label" }, t("All entries")),- (0, import_react30.createElement)("span", { className: "bt-menu-hint" }, String(count))- (0, import_react31.createElement)("span", { className: "bt-menu-label" }, t("All entries")),- (0, import_react31.createElement)("span", { className: "bt-menu-hint" }, String(count))++ (0, import_react32.createElement)("span", { className: "bt-menu-label" }, t("All entries")),++ (0, import_react32.createElement)("span", { className: "bt-menu-hint" }, String(count))),- (0, import_react30.createElement)(- (0, import_react31.createElement)(++ (0, import_react32.createElement)("button",{ type: "button", role: "menuitem", disabled: count === 0 || view?.summarizing, onClick: regenerate },- (0, import_react30.createElement)("span", { className: "bt-menu-label" }, t("Regenerate summary"))- (0, import_react31.createElement)("span", { className: "bt-menu-label" }, t("Regenerate summary"))++ (0, import_react32.createElement)("span", { className: "bt-menu-label" }, t("Regenerate summary")))) : null),- (0, import_react30.createElement)(- (0, import_react31.createElement)(++ (0, import_react32.createElement)("div",{ className: "bt-mem-body" },- error ? (0, import_react30.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, hostText(error)) : null,- view === null ? error ? null : (0, import_react30.createElement)(Skeleton) : page === "entries" ? (0, import_react30.createElement)(Entries, { owner, view, remove }) : (0, import_react30.createElement)(Summary, { owner, view, regenerate })- error ? (0, import_react31.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, hostText(error)) : null,- view === null ? error ? null : (0, import_react31.createElement)(Skeleton) : page === "entries" ? (0, import_react31.createElement)(Entries, { owner, view, remove }) : (0, import_react31.createElement)(Summary, { owner, view, regenerate })++ error ? (0, import_react32.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, hostText(error)) : null,++ view === null ? error ? null : (0, import_react32.createElement)(Skeleton) : page === "entries" ? (0, import_react32.createElement)(Entries, { owner, view, remove }) : (0, import_react32.createElement)(Summary, { owner, view, regenerate })),- (0, import_react30.createElement)(- (0, import_react31.createElement)(++ (0, import_react32.createElement)("div",{ className: "bt-mem-foot" },- answer ? (0, import_react30.createElement)(Reply, { answer, dismiss: () => setAnswer(null) }) : null,- (0, import_react30.createElement)(- answer ? (0, import_react31.createElement)(Reply, { answer, dismiss: () => setAnswer(null) }) : null,- (0, import_react31.createElement)(++ answer ? (0, import_react32.createElement)(Reply, { answer, dismiss: () => setAnswer(null) }) : null,++ (0, import_react32.createElement)("form",{ className: "bt-mem-ask", onSubmit: ask },- (0, import_react30.createElement)("input", {- (0, import_react31.createElement)("input", {++ (0, import_react32.createElement)("input", {ref: inputRef,className: "bt-mem-input",value: text,@@@ -13482,10 -13984,10 +14334,10 @@@"aria-label": t("Ask about or update {name}'s memory", { name: owner.name }),onChange: (event) => setText(event.target.value)}),- (0, import_react30.createElement)(- (0, import_react31.createElement)(++ (0, import_react32.createElement)("button",{ type: "submit", className: "bt-mem-send", disabled: busy || text.trim() === "", "aria-label": t("Send") },- busy ? (0, import_react30.createElement)("span", { className: "bt-mem-spin", "aria-hidden": true }) : (0, import_react30.createElement)(ArrowUpIcon)- busy ? (0, import_react31.createElement)("span", { className: "bt-mem-spin", "aria-hidden": true }) : (0, import_react31.createElement)(ArrowUpIcon)++ busy ? (0, import_react32.createElement)("span", { className: "bt-mem-spin", "aria-hidden": true }) : (0, import_react32.createElement)(ArrowUpIcon))))@@@ -13494,11 -13996,11 +14346,11 @@@}// src/client/bot-settings.js- var import_react31 = require("react");-var import_react32 = require("react");++var import_react33 = require("react");var capitalize = (word) => word[0].toUpperCase() + word.slice(1);function InlineText({ label, value, placeholder, required = false, maxLength, multiline = false, onSave }) {- const [draft, setDraft] = (0, import_react31.useState)(null);- const reverting = (0, import_react31.useRef)(false);- const [draft, setDraft] = (0, import_react32.useState)(null);- const reverting = (0, import_react32.useRef)(false);++ const [draft, setDraft] = (0, import_react33.useState)(null);++ const reverting = (0, import_react33.useRef)(false);const commit = () => {const next = draft?.trim();setDraft(null);@@@ -13509,7 -14011,7 +14361,7 @@@if (next === void 0 || next === (value ?? "") || required && next === "") return;void onSave(next);};- return (0, import_react31.createElement)(multiline ? "textarea" : "input", {- return (0, import_react32.createElement)(multiline ? "textarea" : "input", {++ return (0, import_react33.createElement)(multiline ? "textarea" : "input", {className: multiline ? "bt-bs-input bt-bs-area" : "bt-bs-input",value: draft ?? value ?? "",placeholder,@@@ -13530,29 -14032,29 +14382,29 @@@});}function Row({ label, hint, stack = false, children }) {- return (0, import_react31.createElement)(- return (0, import_react32.createElement)(++ return (0, import_react33.createElement)("label",{ className: stack ? "bt-set-row bt-bs-row bt-bs-stack" : "bt-set-row bt-bs-row" },- (0, import_react31.createElement)("span", { className: "bt-set-copy" }, (0, import_react31.createElement)("span", { className: "bt-bs-label" }, label), hint ? (0, import_react31.createElement)("span", { className: "bt-set-hint" }, hint) : null),- (0, import_react32.createElement)("span", { className: "bt-set-copy" }, (0, import_react32.createElement)("span", { className: "bt-bs-label" }, label), hint ? (0, import_react32.createElement)("span", { className: "bt-set-hint" }, hint) : null),++ (0, import_react33.createElement)("span", { className: "bt-set-copy" }, (0, import_react33.createElement)("span", { className: "bt-bs-label" }, label), hint ? (0, import_react33.createElement)("span", { className: "bt-set-hint" }, hint) : null),children);}function Card2({ title, children }) {- return (0, import_react31.createElement)("section", { className: "bt-set-section" }, title ? (0, import_react31.createElement)("h3", null, title) : null, (0, import_react31.createElement)("div", { className: "bt-set-card" }, children));- return (0, import_react32.createElement)("section", { className: "bt-set-section" }, title ? (0, import_react32.createElement)("h3", null, title) : null, (0, import_react32.createElement)("div", { className: "bt-set-card" }, children));++ return (0, import_react33.createElement)("section", { className: "bt-set-section" }, title ? (0, import_react33.createElement)("h3", null, title) : null, (0, import_react33.createElement)("div", { className: "bt-set-card" }, children));}function Switch({ on, label, disabled, onChange }) {- return (0, import_react31.createElement)(- return (0, import_react32.createElement)(++ return (0, import_react33.createElement)("button",{ type: "button", role: "switch", className: "bt-switch", "aria-checked": on, "aria-label": label, disabled, onClick: () => onChange(!on) },- (0, import_react31.createElement)("span", { className: "bt-switch-knob", "aria-hidden": true })- (0, import_react32.createElement)("span", { className: "bt-switch-knob", "aria-hidden": true })++ (0, import_react33.createElement)("span", { className: "bt-switch-knob", "aria-hidden": true }));}function SwitchRow({ label, hint, on, disabled, onChange }) {- return (0, import_react31.createElement)(- return (0, import_react32.createElement)(++ return (0, import_react33.createElement)("div",{ className: "bt-set-row bt-bs-row" },- (0, import_react31.createElement)("span", { className: "bt-set-copy" }, (0, import_react31.createElement)("span", { className: "bt-bs-label" }, label), hint ? (0, import_react31.createElement)("span", { className: "bt-set-hint" }, hint) : null),- (0, import_react31.createElement)(Switch, { on, label, disabled, onChange })- (0, import_react32.createElement)("span", { className: "bt-set-copy" }, (0, import_react32.createElement)("span", { className: "bt-bs-label" }, label), hint ? (0, import_react32.createElement)("span", { className: "bt-set-hint" }, hint) : null),- (0, import_react32.createElement)(Switch, { on, label, disabled, onChange })++ (0, import_react33.createElement)("span", { className: "bt-set-copy" }, (0, import_react33.createElement)("span", { className: "bt-bs-label" }, label), hint ? (0, import_react33.createElement)("span", { className: "bt-set-hint" }, hint) : null),++ (0, import_react33.createElement)(Switch, { on, label, disabled, onChange }));}function modelHint(bot, roster) {@@@ -13563,22 -14065,22 +14415,22 @@@return t("Applies from the next message.");}function ShapeRing({ shape, size }) {- const maskId = (0, import_react31.useRef)("");- const maskId = (0, import_react32.useRef)("");++ const maskId = (0, import_react33.useRef)("");if (maskId.current === "") maskId.current = `bt-ring-${nextMarkSerial()}`;const def = shapeOf(shape);const unit = def.size / size;const markup = `<defs><mask id="${maskId.current}" ${maskBox(def.size)}>${holes(def, `<g stroke="#000" stroke-width="${6 * unit}" stroke-linejoin="round">${bodyOf(def, "#000", true)}</g>`)}</mask></defs><g mask="url(#${maskId.current})" stroke="currentColor" stroke-width="${8 * unit}" stroke-linejoin="round">${bodyOf(def, "currentColor", true)}</g>`;- return (0, import_react31.createElement)("svg", { className: "bt-ring", viewBox: `0 0 ${def.size} ${def.size}`, "aria-hidden": true, dangerouslySetInnerHTML: { __html: markup } });- return (0, import_react32.createElement)("svg", { className: "bt-ring", viewBox: `0 0 ${def.size} ${def.size}`, "aria-hidden": true, dangerouslySetInnerHTML: { __html: markup } });++ return (0, import_react33.createElement)("svg", { className: "bt-ring", viewBox: `0 0 ${def.size} ${def.size}`, "aria-hidden": true, dangerouslySetInnerHTML: { __html: markup } });}function CharacterGrid({ look, hasPhoto = false, onShape, onColor }) {const shapes = [...PICKER_SHAPES, ...Object.keys(SHAPES).filter((id) => !Object.hasOwn(CHARACTERS, id))];if (!shapes.includes(look.shape)) shapes.push(look.shape);const rows2 = [];for (let index = 0; index < shapes.length; index += PICKER_COLUMNS) rows2.push(shapes.slice(index, index + PICKER_COLUMNS));- return (0, import_react31.createElement)(- import_react31.Fragment,- return (0, import_react32.createElement)(- import_react32.Fragment,++ return (0, import_react33.createElement)(++ import_react33.Fragment,null,- (0, import_react31.createElement)("div", { className: "bt-shapes", role: "group", "aria-label": t("Character shape") }, rows2.map((row, index) => (0, import_react31.createElement)("div", { key: index, className: "bt-shape-row" }, row.map((id) => (0, import_react31.createElement)("button", {- (0, import_react32.createElement)("div", { className: "bt-shapes", role: "group", "aria-label": t("Character shape") }, rows2.map((row, index) => (0, import_react32.createElement)("div", { key: index, className: "bt-shape-row" }, row.map((id) => (0, import_react32.createElement)("button", {++ (0, import_react33.createElement)("div", { className: "bt-shapes", role: "group", "aria-label": t("Character shape") }, rows2.map((row, index) => (0, import_react33.createElement)("div", { key: index, className: "bt-shape-row" }, row.map((id) => (0, import_react33.createElement)("button", {key: id,type: "button",className: "bt-shape",@@@ -13586,8 -14088,8 +14438,8 @@@title: t(shapeOf(id).label),"aria-pressed": !hasPhoto && look.shape === id,onClick: () => onShape(id)- }, (0, import_react31.createElement)(ShapeRing, { shape: id, size: 36 }), (0, import_react31.createElement)(BotMark, { look: { shape: id, color: look.color }, size: 36 })))))),- (0, import_react31.createElement)("div", { className: "bt-colors", role: "group", "aria-label": t("Character color") }, CHARACTER_COLORS.map((color) => (0, import_react31.createElement)("button", {- }, (0, import_react32.createElement)(ShapeRing, { shape: id, size: 36 }), (0, import_react32.createElement)(BotMark, { look: { shape: id, color: look.color }, size: 36 })))))),- (0, import_react32.createElement)("div", { className: "bt-colors", role: "group", "aria-label": t("Character color") }, CHARACTER_COLORS.map((color) => (0, import_react32.createElement)("button", {++ }, (0, import_react33.createElement)(ShapeRing, { shape: id, size: 36 }), (0, import_react33.createElement)(BotMark, { look: { shape: id, color: look.color }, size: 36 })))))),++ (0, import_react33.createElement)("div", { className: "bt-colors", role: "group", "aria-label": t("Character color") }, CHARACTER_COLORS.map((color) => (0, import_react33.createElement)("button", {key: color,type: "button",className: "bt-color",@@@ -13595,19 -14097,19 +14447,19 @@@title: t(capitalize(color)),"aria-pressed": look.color === color,onClick: () => onColor(color)- }, (0, import_react31.createElement)("span", { style: { background: paintCss(color) } }))))- }, (0, import_react32.createElement)("span", { style: { background: paintCss(color) } }))))++ }, (0, import_react33.createElement)("span", { style: { background: paintCss(color) } })))));}function AvatarEditor({ bot, actions, run: run2, onClose }) {const look = lookOf(bot);- const [tab, setTab] = (0, import_react31.useState)(look.image ? "upload" : "bot");- const [over, setOver] = (0, import_react31.useState)(false);- const ref = (0, import_react31.useRef)(null);- const fileRef = (0, import_react31.useRef)(null);- const [tab, setTab] = (0, import_react32.useState)(look.image ? "upload" : "bot");- const [over, setOver] = (0, import_react32.useState)(false);- const ref = (0, import_react32.useRef)(null);- const fileRef = (0, import_react32.useRef)(null);++ const [tab, setTab] = (0, import_react33.useState)(look.image ? "upload" : "bot");++ const [over, setOver] = (0, import_react33.useState)(false);++ const ref = (0, import_react33.useRef)(null);++ const fileRef = (0, import_react33.useRef)(null);const upload = (file) => {if (file) void run2(avatarImage(file).then((image) => actions.updateBot(bot.id, { avatar: { ...bot.avatar ?? {}, image } })));};- (0, import_react31.useEffect)(() => {- (0, import_react32.useEffect)(() => {++ (0, import_react33.useEffect)(() => {const onDown = (event) => {if (!(event.target instanceof Element) || ref.current?.contains(event.target) || event.target.closest(".bt-avatar-trigger")) return;onClose();@@@ -13625,7 -14127,7 +14477,7 @@@window.removeEventListener("keydown", onKey, true);};}, [onClose]);- (0, import_react31.useEffect)(() => {- (0, import_react32.useEffect)(() => {++ (0, import_react33.useEffect)(() => {if (tab !== "upload") return void 0;const onPaste = (event) => {const file = [...event.clipboardData?.files ?? []].find((item) => item.type.startsWith("image/"));@@@ -13639,32 -14141,32 +14491,32 @@@}, [tab, bot]);const hasPhoto = Boolean(look.image);const glide = useGlide(tab);- return (0, import_react31.createElement)(- return (0, import_react32.createElement)(++ return (0, import_react33.createElement)("div",{ ref, className: "bt-avedit", role: "dialog", "aria-label": t("Avatar editor") },- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)("div",{ className: "bt-avedit-top" },- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)("div",{ ref: glide.box, role: "tablist", "aria-label": t("Avatar source"), className: "bt-avedit-tabs" },- (0, import_react31.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),- [["bot", "Bot"], ["upload", "Upload"], ["library", "Library"]].map(([id, label]) => (0, import_react31.createElement)("button", { key: id, type: "button", role: "tab", className: "bt-avedit-tab", "aria-selected": tab === id, onClick: () => setTab(id) }, t(label)))- (0, import_react32.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),- [["bot", "Bot"], ["upload", "Upload"], ["library", "Library"]].map(([id, label]) => (0, import_react32.createElement)("button", { key: id, type: "button", role: "tab", className: "bt-avedit-tab", "aria-selected": tab === id, onClick: () => setTab(id) }, t(label)))++ (0, import_react33.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),++ [["bot", "Bot"], ["upload", "Upload"], ["library", "Library"]].map(([id, label]) => (0, import_react33.createElement)("button", { key: id, type: "button", role: "tab", className: "bt-avedit-tab", "aria-selected": tab === id, onClick: () => setTab(id) }, t(label)))),- (0, import_react31.createElement)("button", {- (0, import_react32.createElement)("button", {++ (0, import_react33.createElement)("button", {type: "button",className: "bt-avedit-tab bt-avedit-reset",title: t("Reset character to default"),onClick: () => run2(actions.updateBot(bot.id, { avatar: null, color: null }))}, t("Reset"))),- tab === "bot" ? (0, import_react31.createElement)(CharacterGrid, {- tab === "bot" ? (0, import_react32.createElement)(CharacterGrid, {++ tab === "bot" ? (0, import_react33.createElement)(CharacterGrid, {look,hasPhoto,onShape: (shape) => run2(actions.updateBot(bot.id, { avatar: { shape } })),onColor: (color) => run2(actions.updateBot(bot.id, { color }))}) : null,- tab === "upload" ? (0, import_react31.createElement)(- tab === "upload" ? (0, import_react32.createElement)(++ tab === "upload" ? (0, import_react33.createElement)("div",{className: "bt-dropzone",@@@ -13680,15 -14182,15 +14532,15 @@@upload(event.dataTransfer.files?.[0]);}},- hasPhoto ? (0, import_react31.createElement)("img", { src: look.image, alt: "" }) : null,- (0, import_react31.createElement)("div", null, t("Drag, drop, or paste an image")),- (0, import_react31.createElement)(- hasPhoto ? (0, import_react32.createElement)("img", { src: look.image, alt: "" }) : null,- (0, import_react32.createElement)("div", null, t("Drag, drop, or paste an image")),- (0, import_react32.createElement)(++ hasPhoto ? (0, import_react33.createElement)("img", { src: look.image, alt: "" }) : null,++ (0, import_react33.createElement)("div", null, t("Drag, drop, or paste an image")),++ (0, import_react33.createElement)("div",{ className: "bt-actions", style: { justifyContent: "center" } },- (0, import_react31.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => fileRef.current?.click() }, hasPhoto ? t("Replace") : t("Browse files")),- hasPhoto ? (0, import_react31.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.updateBot(bot.id, { avatar: hasShape(bot.avatar?.shape) ? { shape: bot.avatar.shape } : null })) }, t("Remove photo")) : null- (0, import_react32.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => fileRef.current?.click() }, hasPhoto ? t("Replace") : t("Browse files")),- hasPhoto ? (0, import_react32.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.updateBot(bot.id, { avatar: hasShape(bot.avatar?.shape) ? { shape: bot.avatar.shape } : null })) }, t("Remove photo")) : null++ (0, import_react33.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => fileRef.current?.click() }, hasPhoto ? t("Replace") : t("Browse files")),++ hasPhoto ? (0, import_react33.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.updateBot(bot.id, { avatar: hasShape(bot.avatar?.shape) ? { shape: bot.avatar.shape } : null })) }, t("Remove photo")) : null),- (0, import_react31.createElement)("input", { ref: fileRef, type: "file", accept: "image/png,image/jpeg,image/webp,image/gif", hidden: true, onChange: (event) => {- (0, import_react32.createElement)("input", { ref: fileRef, type: "file", accept: "image/png,image/jpeg,image/webp,image/gif", hidden: true, onChange: (event) => {++ (0, import_react33.createElement)("input", { ref: fileRef, type: "file", accept: "image/png,image/jpeg,image/webp,image/gif", hidden: true, onChange: (event) => {const file = event.target.files?.[0];event.target.value = "";upload(file);@@@ -13696,7 -14198,7 +14548,7 @@@) : null,// A photo from the library is the same photo the user uploaded before: the Bot// keeps its own copy, and the library keeps its entry.- tab === "library" ? (0, import_react31.createElement)(AvatarLibraryPanel, {- tab === "library" ? (0, import_react32.createElement)(AvatarLibraryPanel, {++ tab === "library" ? (0, import_react33.createElement)(AvatarLibraryPanel, {actions,onPick: (entry) => run2(actions.updateBot(bot.id, { avatar: { ...bot.avatar, image: entry.image } }))}) : null@@@ -13705,22 -14207,22 +14557,22 @@@function MemoryCard({ bot, actions }) {const count = useMemoryCount(bot.id, actions);const label = count === null ? t("Loading…") : count === 0 ? t("Nothing saved yet") : count === 1 ? t("1 entry") : t("{count} entries", { count });- return (0, import_react31.createElement)(- return (0, import_react32.createElement)(++ return (0, import_react33.createElement)(Card2,{ title: t("Memory") },- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)("button",{ type: "button", className: "bt-set-row bt-bs-row", "aria-label": t("Manage {name}'s memory", { name: bot.name }), onClick: () => actions.openMemory(bot.id) },- (0, import_react31.createElement)("span", { className: "bt-set-copy" }, (0, import_react31.createElement)("span", { className: "bt-bs-label" }, label)),- (0, import_react31.createElement)("span", { className: "bt-mem-row-go" }, t("Manage"), (0, import_react31.createElement)(ChevronRightIcon))- (0, import_react32.createElement)("span", { className: "bt-set-copy" }, (0, import_react32.createElement)("span", { className: "bt-bs-label" }, label)),- (0, import_react32.createElement)("span", { className: "bt-mem-row-go" }, t("Manage"), (0, import_react32.createElement)(ChevronRightIcon))++ (0, import_react33.createElement)("span", { className: "bt-set-copy" }, (0, import_react33.createElement)("span", { className: "bt-bs-label" }, label)),++ (0, import_react33.createElement)("span", { className: "bt-mem-row-go" }, t("Manage"), (0, import_react33.createElement)(ChevronRightIcon))));}function BotSettingsForm({ bot, roster, actions, run: run2 }) {- const [editing, setEditing] = (0, import_react31.useState)(false);- const [confirming, setConfirming] = (0, import_react31.useState)(false);- const closeEditor = (0, import_react31.useCallback)(() => setEditing(false), []);- (0, import_react31.useEffect)(() => {- const [editing, setEditing] = (0, import_react32.useState)(false);- const [confirming, setConfirming] = (0, import_react32.useState)(false);- const closeEditor = (0, import_react32.useCallback)(() => setEditing(false), []);- (0, import_react32.useEffect)(() => {++ const [editing, setEditing] = (0, import_react33.useState)(false);++ const [confirming, setConfirming] = (0, import_react33.useState)(false);++ const closeEditor = (0, import_react33.useCallback)(() => setEditing(false), []);++ (0, import_react33.useEffect)(() => {if (!confirming) return void 0;const timer = setTimeout(() => setConfirming(false), 4e3);return () => clearTimeout(timer);@@@ -13737,63 -14239,63 +14589,63 @@@if (confirming) void run2(actions.deleteBot(bot.id));else setConfirming(true);};- (0, import_react31.useEffect)(() => {- (0, import_react32.useEffect)(() => {++ (0, import_react33.useEffect)(() => {void actions.refreshModels?.();}, [bot.id]);- return (0, import_react31.createElement)(- return (0, import_react32.createElement)(++ return (0, import_react33.createElement)("div",{ className: "bt-bs" },- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)("div",{ className: "bt-bs-hero" },- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)("div",{ className: "bt-avatar-anchor" },- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)("button",{ type: "button", className: "bt-avatar-trigger", "aria-label": t("Edit Bot avatar"), "aria-expanded": editing, onClick: () => setEditing((value) => !value) },- (0, import_react31.createElement)(BotMark, { bot, size: 64, live: true }),- (0, import_react31.createElement)("span", { className: "bt-avatar-pencil", "aria-hidden": true }, (0, import_react31.createElement)(PencilIcon))- (0, import_react32.createElement)(BotMark, { bot, size: 64, live: true }),- (0, import_react32.createElement)("span", { className: "bt-avatar-pencil", "aria-hidden": true }, (0, import_react32.createElement)(PencilIcon))++ (0, import_react33.createElement)(BotMark, { bot, size: 64, live: true }),++ (0, import_react33.createElement)("span", { className: "bt-avatar-pencil", "aria-hidden": true }, (0, import_react33.createElement)(PencilIcon))),- editing ? (0, import_react31.createElement)(AvatarEditor, { bot, actions, run: run2, onClose: closeEditor }) : null- editing ? (0, import_react32.createElement)(AvatarEditor, { bot, actions, run: run2, onClose: closeEditor }) : null++ editing ? (0, import_react33.createElement)(AvatarEditor, { bot, actions, run: run2, onClose: closeEditor }) : null),- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)("div",{ className: "bt-bs-who" },- (0, import_react31.createElement)("span", { className: "bt-bs-name" }, bot.name),- (0, import_react31.createElement)("span", { className: "bt-bs-sub" }, [bot.role, isMainBot ? t("Main Bot") : ""].filter(Boolean).join(" · ") || t("Bot"))- (0, import_react32.createElement)("span", { className: "bt-bs-name" }, bot.name),- (0, import_react32.createElement)("span", { className: "bt-bs-sub" }, [bot.role, isMainBot ? t("Main Bot") : ""].filter(Boolean).join(" · ") || t("Bot"))++ (0, import_react33.createElement)("span", { className: "bt-bs-name" }, bot.name),++ (0, import_react33.createElement)("span", { className: "bt-bs-sub" }, [bot.role, isMainBot ? t("Main Bot") : ""].filter(Boolean).join(" · ") || t("Bot")))),- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)(Card2,{ title: t("Profile") },- (0, import_react31.createElement)(Row, { label: t("Name") }, (0, import_react31.createElement)(InlineText, { label: t("Name"), value: bot.name, placeholder: "Bob", required: true, maxLength: 40, onSave: (name) => save({ name }) })),- (0, import_react31.createElement)(Row, { label: t("Label"), hint: t("Optional. Shown under the name.") }, (0, import_react31.createElement)(InlineText, { label: t("Label"), value: bot.role, placeholder: t("Research, admin…"), maxLength: 24, onSave: (role) => save({ role }) }))- (0, import_react32.createElement)(Row, { label: t("Name") }, (0, import_react32.createElement)(InlineText, { label: t("Name"), value: bot.name, placeholder: "Bob", required: true, maxLength: 40, onSave: (name) => save({ name }) })),- (0, import_react32.createElement)(Row, { label: t("Label"), hint: t("Optional. Shown under the name.") }, (0, import_react32.createElement)(InlineText, { label: t("Label"), value: bot.role, placeholder: t("Research, admin…"), maxLength: 24, onSave: (role) => save({ role }) }))++ (0, import_react33.createElement)(Row, { label: t("Name") }, (0, import_react33.createElement)(InlineText, { label: t("Name"), value: bot.name, placeholder: "Bob", required: true, maxLength: 40, onSave: (name) => save({ name }) })),++ (0, import_react33.createElement)(Row, { label: t("Label"), hint: t("Optional. Shown under the name.") }, (0, import_react33.createElement)(InlineText, { label: t("Label"), value: bot.role, placeholder: t("Research, admin…"), maxLength: 24, onSave: (role) => save({ role }) }))),- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)(Card2,{ title: t("Model") },- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)("div",{ className: "bt-set-row bt-bs-row" },- (0, import_react31.createElement)("span", { className: "bt-set-copy" }, (0, import_react31.createElement)("span", { className: "bt-bs-label" }, t("Model")), (0, import_react31.createElement)("span", { className: "bt-set-hint" }, modelHint(bot, roster))),- (0, import_react31.createElement)(ModelMenu, { bot, roster, actions, run: run2 })- (0, import_react32.createElement)("span", { className: "bt-set-copy" }, (0, import_react32.createElement)("span", { className: "bt-bs-label" }, t("Model")), (0, import_react32.createElement)("span", { className: "bt-set-hint" }, modelHint(bot, roster))),- (0, import_react32.createElement)(ModelMenu, { bot, roster, actions, run: run2 })++ (0, import_react33.createElement)("span", { className: "bt-set-copy" }, (0, import_react33.createElement)("span", { className: "bt-bs-label" }, t("Model")), (0, import_react33.createElement)("span", { className: "bt-set-hint" }, modelHint(bot, roster))),++ (0, import_react33.createElement)(ModelMenu, { bot, roster, actions, run: run2 }))),- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)(Card2,{ title: t("Working folder") },- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)("div",{ className: "bt-set-row bt-bs-row" },- (0, import_react31.createElement)("span", { className: "bt-set-copy" }, (0, import_react31.createElement)("span", { className: "bt-bs-label" }, t("Folder"))),- (0, import_react31.createElement)(FolderMenu, { value: bot.workDir, actions, run: run2, onPick: (workDir) => save({ workDir }) })- (0, import_react32.createElement)("span", { className: "bt-set-copy" }, (0, import_react32.createElement)("span", { className: "bt-bs-label" }, t("Folder"))),- (0, import_react32.createElement)(FolderMenu, { value: bot.workDir, actions, run: run2, onPick: (workDir) => save({ workDir }) })++ (0, import_react33.createElement)("span", { className: "bt-set-copy" }, (0, import_react33.createElement)("span", { className: "bt-bs-label" }, t("Folder"))),++ (0, import_react33.createElement)(FolderMenu, { value: bot.workDir, actions, run: run2, onPick: (workDir) => save({ workDir }) }))),- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)(Card2,{ title: t("Privacy") },- (0, import_react31.createElement)(SwitchRow, {- (0, import_react32.createElement)(SwitchRow, {++ (0, import_react33.createElement)(SwitchRow, {label: t("Private"),hint: privacyHint,on: bot.private === true,@@@ -13801,32 -14303,32 +14653,32 @@@onChange: (value) => save({ private: value })})),- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)(Card2,{ title: t("Instructions") },- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)(Row,{ label: t("What this Bot does"), hint: t("Its job on the team. Part of the Bot's system prompt."), stack: true },- (0, import_react31.createElement)(InlineText, { label: t("Instructions"), value: bot.instructions, multiline: true, placeholder: t("What this Bot is responsible for…"), onSave: (instructions) => save({ instructions }) })- (0, import_react32.createElement)(InlineText, { label: t("Instructions"), value: bot.instructions, multiline: true, placeholder: t("What this Bot is responsible for…"), onSave: (instructions) => save({ instructions }) })++ (0, import_react33.createElement)(InlineText, { label: t("Instructions"), value: bot.instructions, multiline: true, placeholder: t("What this Bot is responsible for…"), onSave: (instructions) => save({ instructions }) }))),- (0, import_react31.createElement)(BotCapabilitiesCard, { bot, roster, actions, run: run2, Card: Card2, SwitchRow }),- roster.memory === false ? null : (0, import_react31.createElement)(MemoryCard, { bot, actions }),- (0, import_react31.createElement)(BotSchedules, { bot, roster, actions }),- (0, import_react31.createElement)(- (0, import_react32.createElement)(BotCapabilitiesCard, { bot, roster, actions, run: run2, Card: Card2, SwitchRow }),- roster.memory === false ? null : (0, import_react32.createElement)(MemoryCard, { bot, actions }),- (0, import_react32.createElement)(BotSchedules, { bot, roster, actions }),- (0, import_react32.createElement)(++ (0, import_react33.createElement)(BotCapabilitiesCard, { bot, roster, actions, run: run2, Card: Card2, SwitchRow }),++ roster.memory === false ? null : (0, import_react33.createElement)(MemoryCard, { bot, actions }),++ (0, import_react33.createElement)(BotSchedules, { bot, roster, actions }),++ (0, import_react33.createElement)(Card2,{ title: t("Main Bot") },- onlyMain ? (0, import_react31.createElement)(- onlyMain ? (0, import_react32.createElement)(++ onlyMain ? (0, import_react33.createElement)("div",{ className: "bt-set-row bt-bs-row" },- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)("span",{ className: "bt-set-copy" },- (0, import_react31.createElement)("span", { className: "bt-bs-label" }, t("Main Bot")),- (0, import_react31.createElement)("span", { className: "bt-set-hint" }, t("The only Main Bot. To hand the role to another Bot, use Main Bot on the Bots page."))- (0, import_react32.createElement)("span", { className: "bt-bs-label" }, t("Main Bot")),- (0, import_react32.createElement)("span", { className: "bt-set-hint" }, t("The only Main Bot. To hand the role to another Bot, use Main Bot on the Bots page."))++ (0, import_react33.createElement)("span", { className: "bt-bs-label" }, t("Main Bot")),++ (0, import_react33.createElement)("span", { className: "bt-set-hint" }, t("The only Main Bot. To hand the role to another Bot, use Main Bot on the Bots page."))),- (0, import_react31.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("bots") }, t("Change"))- ) : (0, import_react31.createElement)(SwitchRow, {- (0, import_react32.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("bots") }, t("Change"))- ) : (0, import_react32.createElement)(SwitchRow, {++ (0, import_react33.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("bots") }, t("Change"))++ ) : (0, import_react33.createElement)(SwitchRow, {label: t("Main Bot"),hint: bot.private === true ? t("A private Bot cannot be a Main Bot.") : t("Can create and change Bots, and runs every group chat."),on: isMainBot,@@@ -13835,31 -14337,31 +14687,31 @@@})),// The Main Bot tile is always first and always shown, like in the context menu.- isTile ? null : (0, import_react31.createElement)(- isTile ? null : (0, import_react32.createElement)(++ isTile ? null : (0, import_react33.createElement)(Card2,{ title: t("Sidebar") },- (0, import_react31.createElement)(SwitchRow, { label: t("Pin"), hint: t("Kept above the other chats."), on: bot.pinned === true, onChange: (pinned) => run2(actions.setFlags(bot.id, { pinned })) }),- isMainBot ? null : (0, import_react31.createElement)(SwitchRow, { label: t("Hide from sidebar"), hint: t("Search still finds it."), on: bot.hidden === true, onChange: (hidden) => run2(actions.setFlags(bot.id, { hidden })) })- (0, import_react32.createElement)(SwitchRow, { label: t("Pin"), hint: t("Kept above the other chats."), on: bot.pinned === true, onChange: (pinned) => run2(actions.setFlags(bot.id, { pinned })) }),- isMainBot ? null : (0, import_react32.createElement)(SwitchRow, { label: t("Hide from sidebar"), hint: t("Search still finds it."), on: bot.hidden === true, onChange: (hidden) => run2(actions.setFlags(bot.id, { hidden })) })++ (0, import_react33.createElement)(SwitchRow, { label: t("Pin"), hint: t("Kept above the other chats."), on: bot.pinned === true, onChange: (pinned) => run2(actions.setFlags(bot.id, { pinned })) }),++ isMainBot ? null : (0, import_react33.createElement)(SwitchRow, { label: t("Hide from sidebar"), hint: t("Search still finds it."), on: bot.hidden === true, onChange: (hidden) => run2(actions.setFlags(bot.id, { hidden })) })),- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)(Card2,{ title: t("Manage") },- bot.private === true ? null : (0, import_react31.createElement)(- bot.private === true ? null : (0, import_react32.createElement)(++ bot.private === true ? null : (0, import_react33.createElement)("button",{ type: "button", className: "bt-set-row bt-bs-row", onClick: duplicate },- (0, import_react31.createElement)("span", { className: "bt-set-copy" }, (0, import_react31.createElement)("span", { className: "bt-bs-label" }, t("Duplicate")), (0, import_react31.createElement)("span", { className: "bt-set-hint" }, t("A copy with the same job and model, and fresh memory."))),- (0, import_react31.createElement)("span", { className: "bt-chevron" }, (0, import_react31.createElement)(ChevronRightIcon))- (0, import_react32.createElement)("span", { className: "bt-set-copy" }, (0, import_react32.createElement)("span", { className: "bt-bs-label" }, t("Duplicate")), (0, import_react32.createElement)("span", { className: "bt-set-hint" }, t("A copy with the same job and model, and fresh memory."))),- (0, import_react32.createElement)("span", { className: "bt-chevron" }, (0, import_react32.createElement)(ChevronRightIcon))++ (0, import_react33.createElement)("span", { className: "bt-set-copy" }, (0, import_react33.createElement)("span", { className: "bt-bs-label" }, t("Duplicate")), (0, import_react33.createElement)("span", { className: "bt-set-hint" }, t("A copy with the same job and model, and fresh memory."))),++ (0, import_react33.createElement)("span", { className: "bt-chevron" }, (0, import_react33.createElement)(ChevronRightIcon))),- isMainBot ? null : (0, import_react31.createElement)(- isMainBot ? null : (0, import_react32.createElement)(++ isMainBot ? null : (0, import_react33.createElement)("button",{ type: "button", className: "bt-set-row bt-bs-row bt-bs-danger", "data-confirm": confirming || void 0, onClick: remove },- (0, import_react31.createElement)(- (0, import_react32.createElement)(++ (0, import_react33.createElement)("span",{ className: "bt-set-copy" },- (0, import_react31.createElement)("span", { className: "bt-bs-label" }, confirming ? t("Delete {name}?", { name: bot.name }) : t("Delete Bot")),- (0, import_react31.createElement)("span", { className: "bt-set-hint" }, confirming ? t("Click again to delete. Its chats are archived.") : t("Removes the Bot from the team."))- (0, import_react32.createElement)("span", { className: "bt-bs-label" }, confirming ? t("Delete {name}?", { name: bot.name }) : t("Delete Bot")),- (0, import_react32.createElement)("span", { className: "bt-set-hint" }, confirming ? t("Click again to delete. Its chats are archived.") : t("Removes the Bot from the team."))++ (0, import_react33.createElement)("span", { className: "bt-bs-label" }, confirming ? t("Delete {name}?", { name: bot.name }) : t("Delete Bot")),++ (0, import_react33.createElement)("span", { className: "bt-set-hint" }, confirming ? t("Click again to delete. Its chats are archived.") : t("Removes the Bot from the team."))),- (0, import_react31.createElement)("span", { className: "bt-chevron" }, (0, import_react31.createElement)(ChevronRightIcon))- (0, import_react32.createElement)("span", { className: "bt-chevron" }, (0, import_react32.createElement)(ChevronRightIcon))++ (0, import_react33.createElement)("span", { className: "bt-chevron" }, (0, import_react33.createElement)(ChevronRightIcon)))));@@@ -13908,8 -14409,8 +14759,8 @@@ function freshBotName(roster, base = "Nreturn `${base} ${index}`;}function startModel(roster) {- const usable = (roster.models ?? []).filter((model) => !model.needsKey);- return (usable.find((model) => model.ref === roster.defaultModel) ?? usable[0])?.ref ?? "";- const models = roster.models ?? [];- return (models.find((model) => model.ref === roster.prefs?.defaultBotModel) ?? models.find((model) => model.ref === roster.defaultModel) ?? models[0])?.ref ?? "";++ const usable = (roster.models ?? []).filter((model) => model.needsKey !== true);++ return (usable.find((model) => model.ref === roster.prefs?.defaultBotModel) ?? usable.find((model) => model.ref === roster.defaultModel) ?? usable[0])?.ref ?? "";}function createPayload({ name, look, image, model, effort, brief }) {const payload = { name, color: look.color, avatar: image ? { shape: look.shape, image } : { shape: look.shape } };@@@ -13920,7 -14421,7 +14771,7 @@@}// src/client/create-bot.js- var import_react32 = require("react");-var import_react33 = require("react");++var import_react34 = require("react");var pick = (list) => list[Math.floor(Math.random() * list.length)];var randomLook = (avoid = {}) => {const shapes = DEFAULT_SHAPES.filter((shape) => shape !== avoid.shape);@@@ -13928,18 -14429,18 +14779,18 @@@return { shape: pick(shapes), color: pick(colors) };};function CreateBot({ roster, actions, start, brief = "", onBack, canGoBack, onCreated, inline = false }) {- const [look, setLook] = (0, import_react32.useState)(() => randomLook());- const [image, setImage] = (0, import_react32.useState)(null);- const [library, setLibrary] = (0, import_react32.useState)(false);- const [name, setName] = (0, import_react32.useState)(start?.name ?? "");- const [model, setModel] = (0, import_react32.useState)(() => startModel(roster));- const [effort, setEffort] = (0, import_react32.useState)(void 0);- const [busy, setBusy] = (0, import_react32.useState)(false);- const [error, setError] = (0, import_react32.useState)("");- const fileRef = (0, import_react32.useRef)(null);- const frame = (0, import_react32.useRef)(null);- const [look, setLook] = (0, import_react33.useState)(() => randomLook());- const [image, setImage] = (0, import_react33.useState)(null);- const [library, setLibrary] = (0, import_react33.useState)(false);- const [name, setName] = (0, import_react33.useState)(start?.name ?? "");- const [model, setModel] = (0, import_react33.useState)(() => startModel(roster));- const [effort, setEffort] = (0, import_react33.useState)(void 0);- const [busy, setBusy] = (0, import_react33.useState)(false);- const [error, setError] = (0, import_react33.useState)("");- const fileRef = (0, import_react33.useRef)(null);- const frame = (0, import_react33.useRef)(null);++ const [look, setLook] = (0, import_react34.useState)(() => randomLook());++ const [image, setImage] = (0, import_react34.useState)(null);++ const [library, setLibrary] = (0, import_react34.useState)(false);++ const [name, setName] = (0, import_react34.useState)(start?.name ?? "");++ const [model, setModel] = (0, import_react34.useState)(() => startModel(roster));++ const [effort, setEffort] = (0, import_react34.useState)(void 0);++ const [busy, setBusy] = (0, import_react34.useState)(false);++ const [error, setError] = (0, import_react34.useState)("");++ const fileRef = (0, import_react34.useRef)(null);++ const frame = (0, import_react34.useRef)(null);useEscape(onBack);- (0, import_react32.useEffect)(() => {- (0, import_react33.useEffect)(() => {++ (0, import_react34.useEffect)(() => {if (inline) frame.current?.scrollIntoView({ block: "start", behavior: "smooth" });}, []);const fallbackName = freshBotName(roster, t("New Bot"));@@@ -13964,25 -14465,25 +14815,25 @@@avatarImage(file).then(setImage, (failure) => setError(failure?.message ?? String(failure)));};const previewLook = image ? { ...look, image } : look;- const card = (0, import_react32.createElement)(- const card = (0, import_react33.createElement)(++ const card = (0, import_react34.createElement)("div",{ className: "bt-create-card" },- (0, import_react32.createElement)(- (0, import_react33.createElement)(++ (0, import_react34.createElement)("div",{ className: "bt-create-preview" },// The key remounts the mark, so every new pick plays the pop.- (0, import_react32.createElement)(- (0, import_react33.createElement)(++ (0, import_react34.createElement)("span",{ key: `${look.shape}:${look.color}:${image ? "photo" : ""}`, className: "bt-create-pop" },- (0, import_react32.createElement)(BotMark, { look: previewLook, bot: { id: "new-bot" }, size: 88, live: true, gaze: true, pokeable: true })- (0, import_react33.createElement)(BotMark, { look: previewLook, bot: { id: "new-bot" }, size: 88, live: true, gaze: true, pokeable: true })++ (0, import_react34.createElement)(BotMark, { look: previewLook, bot: { id: "new-bot" }, size: 88, live: true, gaze: true, pokeable: true })),- (0, import_react32.createElement)("span", { className: "bt-create-name" }, finalName)- (0, import_react33.createElement)("span", { className: "bt-create-name" }, finalName)++ (0, import_react34.createElement)("span", { className: "bt-create-name" }, finalName)),- (0, import_react32.createElement)("div", { className: "bt-create-step" }, t("Look")),- (0, import_react32.createElement)(- (0, import_react33.createElement)("div", { className: "bt-create-step" }, t("Look")),- (0, import_react33.createElement)(++ (0, import_react34.createElement)("div", { className: "bt-create-step" }, t("Look")),++ (0, import_react34.createElement)("div",{ className: "bt-create-looks" },- (0, import_react32.createElement)(CharacterGrid, {- (0, import_react33.createElement)(CharacterGrid, {++ (0, import_react34.createElement)(CharacterGrid, {look,hasPhoto: Boolean(image),onShape: (shape) => {@@@ -13994,17 -14495,17 +14845,17 @@@setLook((current) => ({ ...current, color }));}}),- (0, import_react32.createElement)(- (0, import_react33.createElement)(++ (0, import_react34.createElement)("div",{ className: "bt-actions bt-create-lookbar" },- (0, import_react32.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => {- (0, import_react33.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => {++ (0, import_react34.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => {setImage(null);setLook((current) => randomLook(current));} }, t("Shuffle")),- (0, import_react32.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => fileRef.current?.click() }, image ? t("Replace photo") : t("Upload photo")),- (0, import_react32.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", "aria-expanded": library, onClick: () => setLibrary((value) => !value) }, t("Library")),- image ? (0, import_react32.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setImage(null) }, t("Remove photo")) : null,- (0, import_react32.createElement)("input", { ref: fileRef, type: "file", accept: "image/png,image/jpeg,image/webp,image/gif", hidden: true, onChange: (event) => {- (0, import_react33.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => fileRef.current?.click() }, image ? t("Replace photo") : t("Upload photo")),- (0, import_react33.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", "aria-expanded": library, onClick: () => setLibrary((value) => !value) }, t("Library")),- image ? (0, import_react33.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setImage(null) }, t("Remove photo")) : null,- (0, import_react33.createElement)("input", { ref: fileRef, type: "file", accept: "image/png,image/jpeg,image/webp,image/gif", hidden: true, onChange: (event) => {++ (0, import_react34.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => fileRef.current?.click() }, image ? t("Replace photo") : t("Upload photo")),++ (0, import_react34.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", "aria-expanded": library, onClick: () => setLibrary((value) => !value) }, t("Library")),++ image ? (0, import_react34.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setImage(null) }, t("Remove photo")) : null,++ (0, import_react34.createElement)("input", { ref: fileRef, type: "file", accept: "image/png,image/jpeg,image/webp,image/gif", hidden: true, onChange: (event) => {const file = event.target.files?.[0];event.target.value = "";upload(file);@@@ -14012,15 -14513,15 +14863,15 @@@)),// The library is a block of its own under the look, not a part of the button row.- library ? (0, import_react32.createElement)(AvatarLibraryPanel, { actions, onPick: (entry) => {- library ? (0, import_react33.createElement)(AvatarLibraryPanel, { actions, onPick: (entry) => {++ library ? (0, import_react34.createElement)(AvatarLibraryPanel, { actions, onPick: (entry) => {setImage(entry.image);setLibrary(false);} }) : null,- (0, import_react32.createElement)(- (0, import_react33.createElement)(++ (0, import_react34.createElement)("label",{ className: "bt-field" },- (0, import_react32.createElement)("span", { className: "bt-field-label" }, t("Name")),- (0, import_react32.createElement)("input", {- (0, import_react33.createElement)("span", { className: "bt-field-label" }, t("Name")),- (0, import_react33.createElement)("input", {++ (0, import_react34.createElement)("span", { className: "bt-field-label" }, t("Name")),++ (0, import_react34.createElement)("input", {className: "bt-input",autoFocus: !inline,value: name,@@@ -14035,54 -14536,54 +14886,54 @@@}}}),- problem ? (0, import_react32.createElement)("span", { className: "bt-note bt-danger" }, hostText(problem)) : clash ? (0, import_react32.createElement)("span", { className: "bt-note bt-danger" }, t("A Bot named {name} already exists", { name: finalName })) : null- problem ? (0, import_react33.createElement)("span", { className: "bt-note bt-danger" }, hostText(problem)) : clash ? (0, import_react33.createElement)("span", { className: "bt-note bt-danger" }, t("A Bot named {name} already exists", { name: finalName })) : null++ problem ? (0, import_react34.createElement)("span", { className: "bt-note bt-danger" }, hostText(problem)) : clash ? (0, import_react34.createElement)("span", { className: "bt-note bt-danger" }, t("A Bot named {name} already exists", { name: finalName })) : null),- (0, import_react32.createElement)(- (0, import_react33.createElement)(++ (0, import_react34.createElement)("div",{ className: "bt-field" },- (0, import_react32.createElement)("span", { className: "bt-field-label" }, t("Model")),- (0, import_react32.createElement)(ModelMenu, { bot: { id: "new-bot", name: finalName, model: model || void 0, effort }, roster, actions, wide: true, onPick: (ref) => {- (0, import_react33.createElement)("span", { className: "bt-field-label" }, t("Model")),- (0, import_react33.createElement)(ModelMenu, { bot: { id: "new-bot", name: finalName, model: model || void 0, effort }, roster, actions, wide: true, onPick: (ref) => {++ (0, import_react34.createElement)("span", { className: "bt-field-label" }, t("Model")),++ (0, import_react34.createElement)(ModelMenu, { bot: { id: "new-bot", name: finalName, model: model || void 0, effort }, roster, actions, wide: true, onPick: (ref) => {setModel(ref);setEffort(void 0);}, onPickEffort: (picked) => setEffort(picked ?? null) }),- (0, import_react32.createElement)("span", { className: "bt-note" }, model ? t("The Bot runs on this model. You can change it later in its details.") : (roster.models ?? []).length > 0 ? t("Pick a model here, or the Bot asks for one in its chat.") : t("Add a provider and a model in DeepSeek Harness first, or pick one in the Bot's chat later."))- (0, import_react33.createElement)("span", { className: "bt-note" }, (roster.models ?? []).length > 0 ? t("The Bot runs on this model. You can change it later in its details.") : t("Add a provider and a model in DeepSeek Harness first, or pick one in the Bot's chat later."))++ (0, import_react34.createElement)("span", { className: "bt-note" }, model ? t("The Bot runs on this model. You can change it later in its details.") : (roster.models ?? []).length > 0 ? t("Pick a model here, or the Bot asks for one in its chat.") : t("Add a provider and a model in DeepSeek Harness first, or pick one in the Bot's chat later."))),- error ? (0, import_react32.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null,- (0, import_react32.createElement)(- error ? (0, import_react33.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null,- (0, import_react33.createElement)(++ error ? (0, import_react34.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null,++ (0, import_react34.createElement)("div",{ className: "bt-create-foot" },- (0, import_react32.createElement)("button", { type: "button", className: "bt-soft", onClick: onBack }, canGoBack ? t("Back") : t("Cancel")),- (0, import_react32.createElement)("button", { type: "button", className: "bt-send bt-create-go", disabled: busy || clash || Boolean(problem), onClick: () => void create() }, busy ? t("Creating…") : t("Create"))- (0, import_react33.createElement)("button", { type: "button", className: "bt-soft", onClick: onBack }, canGoBack ? t("Back") : t("Cancel")),- (0, import_react33.createElement)("button", { type: "button", className: "bt-send bt-create-go", disabled: busy || clash || Boolean(problem), onClick: () => void create() }, busy ? t("Creating…") : t("Create"))++ (0, import_react34.createElement)("button", { type: "button", className: "bt-soft", onClick: onBack }, canGoBack ? t("Back") : t("Cancel")),++ (0, import_react34.createElement)("button", { type: "button", className: "bt-send bt-create-go", disabled: busy || clash || Boolean(problem), onClick: () => void create() }, busy ? t("Creating…") : t("Create"))));- if (inline) return (0, import_react32.createElement)("div", { ref: frame, className: "bt-create-inline", role: "group", "aria-label": t("Create Bot") }, card);- return (0, import_react32.createElement)(- if (inline) return (0, import_react33.createElement)("div", { ref: frame, className: "bt-create-inline", role: "group", "aria-label": t("Create Bot") }, card);- return (0, import_react33.createElement)(++ if (inline) return (0, import_react34.createElement)("div", { ref: frame, className: "bt-create-inline", role: "group", "aria-label": t("Create Bot") }, card);++ return (0, import_react34.createElement)("div",{ className: "bt-create", role: "dialog", "aria-label": t("Create Bot") },- (0, import_react32.createElement)(- (0, import_react33.createElement)(++ (0, import_react34.createElement)("div",{ className: "bt-create-head" },- canGoBack ? (0, import_react32.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to new chat"), onClick: onBack }, (0, import_react32.createElement)(ChevronLeftIcon)) : (0, import_react32.createElement)("span", { className: "bt-create-gap" }),- (0, import_react32.createElement)("span", { className: "bt-create-title" }, t("Create Bot")),- (0, import_react32.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close"), onClick: () => actions.closeOverlay() }, (0, import_react32.createElement)(CloseIcon))- canGoBack ? (0, import_react33.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to new chat"), onClick: onBack }, (0, import_react33.createElement)(ChevronLeftIcon)) : (0, import_react33.createElement)("span", { className: "bt-create-gap" }),- (0, import_react33.createElement)("span", { className: "bt-create-title" }, t("Create Bot")),- (0, import_react33.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close"), onClick: () => actions.closeOverlay() }, (0, import_react33.createElement)(CloseIcon))++ canGoBack ? (0, import_react34.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to new chat"), onClick: onBack }, (0, import_react34.createElement)(ChevronLeftIcon)) : (0, import_react34.createElement)("span", { className: "bt-create-gap" }),++ (0, import_react34.createElement)("span", { className: "bt-create-title" }, t("Create Bot")),++ (0, import_react34.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close"), onClick: () => actions.closeOverlay() }, (0, import_react34.createElement)(CloseIcon))),- (0, import_react32.createElement)("div", { className: "bt-create-body" }, card)- (0, import_react33.createElement)("div", { className: "bt-create-body" }, card)++ (0, import_react34.createElement)("div", { className: "bt-create-body" }, card));}// src/client/new-chat.js- var import_react33 = require("react");-var import_react34 = require("react");++var import_react35 = require("react");function NewChat({ mode, roster, actions }) {- const [query, setQuery] = (0, import_react33.useState)("");- const [picked, setPicked] = (0, import_react33.useState)([]);- const [group, setGroup] = (0, import_react33.useState)(mode === "group");- const [admin, setAdmin] = (0, import_react33.useState)(null);- const [message, setMessage] = (0, import_react33.useState)("");- const [busy, setBusy] = (0, import_react33.useState)(false);- const [error, setError] = (0, import_react33.useState)("");- const [cursor, setCursor] = (0, import_react33.useState)(0);- const [draft, setDraft] = (0, import_react33.useState)(mode === "create" ? { name: "", fromList: false } : null);- const inputRef = (0, import_react33.useRef)(null);- const [query, setQuery] = (0, import_react34.useState)("");- const [picked, setPicked] = (0, import_react34.useState)([]);- const [group, setGroup] = (0, import_react34.useState)(mode === "group");- const [admin, setAdmin] = (0, import_react34.useState)(null);- const [message, setMessage] = (0, import_react34.useState)("");- const [busy, setBusy] = (0, import_react34.useState)(false);- const [error, setError] = (0, import_react34.useState)("");- const [cursor, setCursor] = (0, import_react34.useState)(0);- const [draft, setDraft] = (0, import_react34.useState)(mode === "create" ? { name: "", fromList: false } : null);- const inputRef = (0, import_react34.useRef)(null);++ const [query, setQuery] = (0, import_react35.useState)("");++ const [picked, setPicked] = (0, import_react35.useState)([]);++ const [group, setGroup] = (0, import_react35.useState)(mode === "group");++ const [admin, setAdmin] = (0, import_react35.useState)(null);++ const [message, setMessage] = (0, import_react35.useState)("");++ const [busy, setBusy] = (0, import_react35.useState)(false);++ const [error, setError] = (0, import_react35.useState)("");++ const [cursor, setCursor] = (0, import_react35.useState)(0);++ const [draft, setDraft] = (0, import_react35.useState)(mode === "create" ? { name: "", fromList: false } : null);++ const inputRef = (0, import_react35.useRef)(null);const close = () => actions.closeOverlay();useEscape(close);const paneLeft = usePaneLeft();@@@ -14168,14 -14669,14 +15019,14 @@@});const options = [];if (!group && picked.length === 0 && mode !== "search" && wanted === "") {- options.push({ key: "new", icon: (0, import_react33.createElement)(PlusIcon), label: t("Create new Bot"), run: createBot });- options.push({ key: "group", icon: (0, import_react33.createElement)(PeopleIcon), label: t("Create group chat"), run: () => {- options.push({ key: "new", icon: (0, import_react34.createElement)(PlusIcon), label: t("Create new Bot"), run: createBot });- options.push({ key: "group", icon: (0, import_react34.createElement)(PeopleIcon), label: t("Create group chat"), run: () => {++ options.push({ key: "new", icon: (0, import_react35.createElement)(PlusIcon), label: t("Create new Bot"), run: createBot });++ options.push({ key: "group", icon: (0, import_react35.createElement)(PeopleIcon), label: t("Create group chat"), run: () => {setGroup(true);setCursor(0);inputRef.current?.focus();} });if ((roster.agents ?? []).length === 0 && actions.addAgent) {- options.push({ key: "agent", icon: (0, import_react33.createElement)(import_dsh_client_ui_primitives.FishLogo, { size: 16 }), label: t("Add DSH Agent"), run: () => run2(async () => {- options.push({ key: "agent", icon: (0, import_react34.createElement)(import_dsh_client_ui_primitives.FishLogo, { size: 16 }), label: t("Add DSH Agent"), run: () => run2(async () => {++ options.push({ key: "agent", icon: (0, import_react35.createElement)(import_dsh_client_ui_primitives.FishLogo, { size: 16 }), label: t("Add DSH Agent"), run: () => run2(async () => {await actions.addAgent();close();}) });@@@ -14184,19 -14685,19 +15035,19 @@@for (const bot of matches) {options.push({ key: bot.id, bot, label: bot.name, hint: choosingAdmin ? t("Make admin") : group || picked.length > 0 ? t("Add to group chat") : void 0, run: () => openBot(bot) });}- if (wanted !== "" && !exact && mode !== "search") options.push({ key: "create", icon: (0, import_react33.createElement)(PlusIcon), label: t("Create new Bot “{name}”", { name: query.trim() }), run: createBot });- if (wanted !== "" && !exact && mode !== "search") options.push({ key: "create", icon: (0, import_react34.createElement)(PlusIcon), label: t("Create new Bot “{name}”", { name: query.trim() }), run: createBot });++ if (wanted !== "" && !exact && mode !== "search") options.push({ key: "create", icon: (0, import_react35.createElement)(PlusIcon), label: t("Create new Bot “{name}”", { name: query.trim() }), run: createBot });const active = Math.min(cursor, Math.max(options.length - 1, 0));const listed = options.map((option) => option.key).join("\n");const glide = useGlide(`${active}${listed}`, { axis: "y", ...QUICK_EDGES });useFlip(glide.box, listed, "[data-flip]");- const drop = (0, import_react33.useRef)(null);- const drop = (0, import_react34.useRef)(null);++ const drop = (0, import_react35.useRef)(null);useMorph(drop, listed);if (draft) {- return (0, import_react33.createElement)(- return (0, import_react34.createElement)(++ return (0, import_react35.createElement)("div",{ className: "bt-pane", style: { left: paneLeft } },- (0, import_react33.createElement)(CreateBot, {- (0, import_react34.createElement)(CreateBot, {++ (0, import_react35.createElement)(CreateBot, {roster,actions,start: draft,@@@ -14217,33 -14718,33 +15068,33 @@@if (picked.length > 0) setPicked((current) => current.slice(0, -1));else if (admin !== null) setAdmin(null);};- return (0, import_react33.createElement)(- return (0, import_react34.createElement)(++ return (0, import_react35.createElement)("div",{ className: "bt-pane", style: { left: paneLeft } },- (0, import_react33.createElement)(- (0, import_react34.createElement)(++ (0, import_react35.createElement)("div",{ className: "bt-newchat", role: "dialog", "aria-label": mode === "search" ? t("Search") : t("New chat") },- (0, import_react33.createElement)(- (0, import_react34.createElement)(++ (0, import_react35.createElement)("div",{ className: "bt-to" },- (0, import_react33.createElement)("span", { className: "bt-to-label" }, t("To:")),- adminBot ? (0, import_react33.createElement)(- (0, import_react34.createElement)("span", { className: "bt-to-label" }, t("To:")),- adminBot ? (0, import_react34.createElement)(++ (0, import_react35.createElement)("span", { className: "bt-to-label" }, t("To:")),++ adminBot ? (0, import_react35.createElement)("span",{ key: adminBot.id, className: "bt-token bt-token-admin", title: t("Admin") },- (0, import_react33.createElement)(BotMark, { bot: adminBot, size: 16 }),- (0, import_react34.createElement)(BotMark, { bot: adminBot, size: 16 }),++ (0, import_react35.createElement)(BotMark, { bot: adminBot, size: 16 }),adminBot.name,- (0, import_react33.createElement)(AdminStar),- (0, import_react33.createElement)("button", { type: "button", "aria-label": t("Remove {name}", { name: adminBot.name }), onClick: () => setAdmin(null) }, "×")- (0, import_react34.createElement)(AdminStar),- (0, import_react34.createElement)("button", { type: "button", "aria-label": t("Remove {name}", { name: adminBot.name }), onClick: () => setAdmin(null) }, "×")++ (0, import_react35.createElement)(AdminStar),++ (0, import_react35.createElement)("button", { type: "button", "aria-label": t("Remove {name}", { name: adminBot.name }), onClick: () => setAdmin(null) }, "×")) : null,- choosingAdmin ? (0, import_react33.createElement)("span", { className: "bt-to-star", "aria-hidden": true }, (0, import_react33.createElement)(AdminStar)) : null,- pickedBots.map((bot) => (0, import_react33.createElement)(- choosingAdmin ? (0, import_react34.createElement)("span", { className: "bt-to-star", "aria-hidden": true }, (0, import_react34.createElement)(AdminStar)) : null,- pickedBots.map((bot) => (0, import_react34.createElement)(++ choosingAdmin ? (0, import_react35.createElement)("span", { className: "bt-to-star", "aria-hidden": true }, (0, import_react35.createElement)(AdminStar)) : null,++ pickedBots.map((bot) => (0, import_react35.createElement)("span",{ key: bot.id, className: "bt-token" },- (0, import_react33.createElement)(BotMark, { bot, size: 16 }),- (0, import_react34.createElement)(BotMark, { bot, size: 16 }),++ (0, import_react35.createElement)(BotMark, { bot, size: 16 }),bot.name,- (0, import_react33.createElement)("button", { type: "button", "aria-label": t("Remove {name}", { name: bot.name }), onClick: () => setPicked((current) => current.filter((id) => id !== bot.id)) }, "×")- (0, import_react34.createElement)("button", { type: "button", "aria-label": t("Remove {name}", { name: bot.name }), onClick: () => setPicked((current) => current.filter((id) => id !== bot.id)) }, "×")++ (0, import_react35.createElement)("button", { type: "button", "aria-label": t("Remove {name}", { name: bot.name }), onClick: () => setPicked((current) => current.filter((id) => id !== bot.id)) }, "×"))),- (0, import_react33.createElement)("input", {- (0, import_react34.createElement)("input", {++ (0, import_react35.createElement)("input", {ref: inputRef,autoFocus: true,value: query,@@@ -14267,20 -14768,20 +15118,20 @@@} else if (event.key === "Backspace" && query === "") unpick();}}),- group && admin !== null ? (0, import_react33.createElement)("button", {- group && admin !== null ? (0, import_react34.createElement)("button", {++ group && admin !== null ? (0, import_react35.createElement)("button", {type: "button",className: "bt-send bt-to-create",disabled: busy || picked.length === 0,title: picked.length === 0 ? t("Add at least one more Bot") : void 0,onClick: createGroup}, t("Create group chat")) : null,- (0, import_react33.createElement)("button", { type: "button", className: "bt-x", "aria-label": t("Close new chat"), onClick: close }, "×")- (0, import_react34.createElement)("button", { type: "button", className: "bt-x", "aria-label": t("Close new chat"), onClick: close }, "×")++ (0, import_react35.createElement)("button", { type: "button", className: "bt-x", "aria-label": t("Close new chat"), onClick: close }, "×")),- (0, import_react33.createElement)("div", { ref: drop, className: "bt-drop" }, (0, import_react33.createElement)(- (0, import_react34.createElement)("div", { ref: drop, className: "bt-drop" }, (0, import_react34.createElement)(++ (0, import_react35.createElement)("div", { ref: drop, className: "bt-drop" }, (0, import_react35.createElement)("div",{ ref: glide.box, role: "listbox", "aria-label": t("Recipients"), className: "bt-drop-list" },- (0, import_react33.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),- options.length === 0 ? (0, import_react33.createElement)("div", { className: "bt-hint" }, mode === "search" ? t("No Bots match") : t("Type a name to create a Bot")) : options.map((option, index) => (0, import_react33.createElement)(- (0, import_react34.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),- options.length === 0 ? (0, import_react34.createElement)("div", { className: "bt-hint" }, mode === "search" ? t("No Bots match") : t("Type a name to create a Bot")) : options.map((option, index) => (0, import_react34.createElement)(++ (0, import_react35.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),++ options.length === 0 ? (0, import_react35.createElement)("div", { className: "bt-hint" }, mode === "search" ? t("No Bots match") : t("Type a name to create a Bot")) : options.map((option, index) => (0, import_react35.createElement)("button",{key: option.key,@@@ -14292,21 -14793,21 +15143,21 @@@onMouseEnter: () => setCursor(index),onClick: option.run},- option.bot ? (0, import_react33.createElement)(BotMark, { bot: option.bot, size: 22 }) : (0, import_react33.createElement)("span", { className: "bt-option-icon" }, option.icon),- (0, import_react33.createElement)("span", { className: "bt-option-label" }, option.label),- option.hint && index === active ? (0, import_react33.createElement)("span", { className: "bt-option-hint" }, option.hint) : null- option.bot ? (0, import_react34.createElement)(BotMark, { bot: option.bot, size: 22 }) : (0, import_react34.createElement)("span", { className: "bt-option-icon" }, option.icon),- (0, import_react34.createElement)("span", { className: "bt-option-label" }, option.label),- option.hint && index === active ? (0, import_react34.createElement)("span", { className: "bt-option-hint" }, option.hint) : null++ option.bot ? (0, import_react35.createElement)(BotMark, { bot: option.bot, size: 22 }) : (0, import_react35.createElement)("span", { className: "bt-option-icon" }, option.icon),++ (0, import_react35.createElement)("span", { className: "bt-option-label" }, option.label),++ option.hint && index === active ? (0, import_react35.createElement)("span", { className: "bt-option-hint" }, option.hint) : null)))),- (0, import_react33.createElement)("div", { className: "bt-nc-spacer" }),- error ? (0, import_react33.createElement)("div", { className: "bt-error" }, error) : null,- (0, import_react33.createElement)(- (0, import_react34.createElement)("div", { className: "bt-nc-spacer" }),- error ? (0, import_react34.createElement)("div", { className: "bt-error" }, error) : null,- (0, import_react34.createElement)(++ (0, import_react35.createElement)("div", { className: "bt-nc-spacer" }),++ error ? (0, import_react35.createElement)("div", { className: "bt-error" }, error) : null,++ (0, import_react35.createElement)("div",{ className: "bt-nc-compose" },- (0, import_react33.createElement)(- (0, import_react34.createElement)(++ (0, import_react35.createElement)("div",{ className: "bt-nc-card" },- (0, import_react33.createElement)("span", { className: "bt-nc-plus", "aria-hidden": true }, (0, import_react33.createElement)(PlusIcon)),- (0, import_react33.createElement)("textarea", {- (0, import_react34.createElement)("span", { className: "bt-nc-plus", "aria-hidden": true }, (0, import_react34.createElement)(PlusIcon)),- (0, import_react34.createElement)("textarea", {++ (0, import_react35.createElement)("span", { className: "bt-nc-plus", "aria-hidden": true }, (0, import_react35.createElement)(PlusIcon)),++ (0, import_react35.createElement)("textarea", {rows: 1,value: message,placeholder,@@@ -14319,7 -14820,7 +15170,7 @@@}}}),- (0, import_react33.createElement)("button", { type: "button", className: "bt-nc-send", "aria-label": t("Send message"), disabled: busy || message.trim() === "" || picked.length === 0, onClick: sendMessage }, (0, import_react33.createElement)(ArrowUpIcon))- (0, import_react34.createElement)("button", { type: "button", className: "bt-nc-send", "aria-label": t("Send message"), disabled: busy || message.trim() === "" || picked.length === 0, onClick: sendMessage }, (0, import_react34.createElement)(ArrowUpIcon))++ (0, import_react35.createElement)("button", { type: "button", className: "bt-nc-send", "aria-label": t("Send message"), disabled: busy || message.trim() === "" || picked.length === 0, onClick: sendMessage }, (0, import_react35.createElement)(ArrowUpIcon)))))@@@ -14327,14 -14828,14 +15178,14 @@@}// src/client/exchange.js- var import_react34 = require("react");-var import_react35 = require("react");++var import_react36 = require("react");var SHEET_EXIT_MS = 220;function ExchangeDialog({ pair, roster, actions }) {- const [entries2, setEntries] = (0, import_react34.useState)(null);- const [leaving, setLeaving] = (0, import_react34.useState)(false);- const log = (0, import_react34.useRef)(null);- const atEnd = (0, import_react34.useRef)(true);- (0, import_react34.useLayoutEffect)(() => {- const [entries2, setEntries] = (0, import_react35.useState)(null);- const [leaving, setLeaving] = (0, import_react35.useState)(false);- const log = (0, import_react35.useRef)(null);- const atEnd = (0, import_react35.useRef)(true);- (0, import_react35.useLayoutEffect)(() => {++ const [entries2, setEntries] = (0, import_react36.useState)(null);++ const [leaving, setLeaving] = (0, import_react36.useState)(false);++ const log = (0, import_react36.useRef)(null);++ const atEnd = (0, import_react36.useRef)(true);++ (0, import_react36.useLayoutEffect)(() => {if (entries2 !== null && atEnd.current && log.current) log.current.scrollTop = log.current.scrollHeight;}, [entries2]);const close = () => {@@@ -14343,7 -14844,7 +15194,7 @@@setTimeout(() => actions.closeOverlay(), SHEET_EXIT_MS);};useEscape(close);- (0, import_react34.useEffect)(() => {- (0, import_react35.useEffect)(() => {++ (0, import_react36.useEffect)(() => {let stop = false;let timer;let seen = null;@@@ -14370,53 -14871,53 +15221,53 @@@const flat = layoutOf(roster.prefs) === "flat";let lastDay = 0;const paneLeft = usePaneLeft();- return (0, import_react34.createElement)(- return (0, import_react35.createElement)(++ return (0, import_react36.createElement)("div",{ className: "bt-pane bt-exchange", style: { left: paneLeft }, "data-leaving": leaving || void 0 },- (0, import_react34.createElement)(- (0, import_react35.createElement)(++ (0, import_react36.createElement)("div",{ className: "bt-dialog", role: "dialog", "aria-label": t("Bot exchange") },- (0, import_react34.createElement)("div", { className: "bt-head" }, (0, import_react34.createElement)(- (0, import_react35.createElement)("div", { className: "bt-head" }, (0, import_react35.createElement)(++ (0, import_react36.createElement)("div", { className: "bt-head" }, (0, import_react36.createElement)("span",{ className: "bt-pill", style: { cursor: "default" } },- left ? (0, import_react34.createElement)(BotMark, { bot: left, size: 22 }) : null,- left ? (0, import_react35.createElement)(BotMark, { bot: left, size: 22 }) : null,++ left ? (0, import_react36.createElement)(BotMark, { bot: left, size: 22 }) : null,left?.name ?? "?",- (0, import_react34.createElement)("span", { className: "bt-swap" }, "⇄"),- right ? (0, import_react34.createElement)(BotMark, { bot: right, size: 22 }) : null,- (0, import_react35.createElement)("span", { className: "bt-swap" }, "⇄"),- right ? (0, import_react35.createElement)(BotMark, { bot: right, size: 22 }) : null,++ (0, import_react36.createElement)("span", { className: "bt-swap" }, "⇄"),++ right ? (0, import_react36.createElement)(BotMark, { bot: right, size: 22 }) : null,right?.name ?? "?")),- (0, import_react34.createElement)(- (0, import_react35.createElement)(++ (0, import_react36.createElement)("div",{ ref: log, className: "bt-dialog-log", role: "log", "aria-label": t("Bot exchange transcript"), onScroll: (event) => {const node = event.currentTarget;atEnd.current = node.scrollHeight - node.scrollTop - node.clientHeight < 2;} },- entries2 === null ? (0, import_react34.createElement)("div", { className: "bt-hint" }, t("Loading…")) : entries2.length === 0 ? (0, import_react34.createElement)("div", { className: "bt-hint" }, t("No messages yet")) : entries2.map((entry) => {- entries2 === null ? (0, import_react35.createElement)("div", { className: "bt-hint" }, t("Loading…")) : entries2.length === 0 ? (0, import_react35.createElement)("div", { className: "bt-hint" }, t("No messages yet")) : entries2.map((entry) => {++ entries2 === null ? (0, import_react36.createElement)("div", { className: "bt-hint" }, t("Loading…")) : entries2.length === 0 ? (0, import_react36.createElement)("div", { className: "bt-hint" }, t("No messages yet")) : entries2.map((entry) => {const bot = roster.byId[entry.from] ?? { id: entry.from, name: t("You"), color: "gray" };const showDay = entry.time - lastDay > 30 * 60 * 1e3;lastDay = entry.time;const whole = entry.length === void 0 ? void 0 : { length: entry.length, load: () => actions.exchangeText(entry.id) };- const lead = (0, import_react34.createElement)("span", { className: "bt-lead" }, (0, import_react34.createElement)(BotMark, { bot, size: 22 }));- return (0, import_react34.createElement)(- import_react34.Fragment,- const lead = (0, import_react35.createElement)("span", { className: "bt-lead" }, (0, import_react35.createElement)(BotMark, { bot, size: 22 }));- return (0, import_react35.createElement)(- import_react35.Fragment,++ const lead = (0, import_react36.createElement)("span", { className: "bt-lead" }, (0, import_react36.createElement)(BotMark, { bot, size: 22 }));++ return (0, import_react36.createElement)(++ import_react36.Fragment,{ key: entry.id },- showDay ? (0, import_react34.createElement)("time", { className: "bt-time" }, dayLabel(entry.time)) : null,- (0, import_react34.createElement)(- showDay ? (0, import_react35.createElement)("time", { className: "bt-time" }, dayLabel(entry.time)) : null,- (0, import_react35.createElement)(++ showDay ? (0, import_react36.createElement)("time", { className: "bt-time" }, dayLabel(entry.time)) : null,++ (0, import_react36.createElement)("div",{ className: "bt-group-msg" },- (0, import_react34.createElement)("span", { className: "bt-group-name", style: flat ? void 0 : { color: inkText(colorOf(bot)) } }, flat ? lead : null, bot.name),- (0, import_react34.createElement)(Bubbles, { texts: [stripLongNote(entry.text)], roster, selfId: bot.id, actions, whole, lead: flat ? null : lead })- (0, import_react35.createElement)("span", { className: "bt-group-name", style: flat ? void 0 : { color: inkText(colorOf(bot)) } }, flat ? lead : null, bot.name),- (0, import_react35.createElement)(Bubbles, { texts: [stripLongNote(entry.text)], roster, selfId: bot.id, actions, whole, lead: flat ? null : lead })++ (0, import_react36.createElement)("span", { className: "bt-group-name", style: flat ? void 0 : { color: inkText(colorOf(bot)) } }, flat ? lead : null, bot.name),++ (0, import_react36.createElement)(Bubbles, { texts: [stripLongNote(entry.text)], roster, selfId: bot.id, actions, whole, lead: flat ? null : lead })));})),- (0, import_react34.createElement)("div", { className: "bt-dialog-foot" }, (0, import_react34.createElement)("button", { type: "button", className: "bt-soft", onClick: close }, t("Close Chat")))- (0, import_react35.createElement)("div", { className: "bt-dialog-foot" }, (0, import_react35.createElement)("button", { type: "button", className: "bt-soft", onClick: close }, t("Close Chat")))++ (0, import_react36.createElement)("div", { className: "bt-dialog-foot" }, (0, import_react36.createElement)("button", { type: "button", className: "bt-soft", onClick: close }, t("Close Chat")))));}// src/client/voice.js- var import_react35 = require("react");-var import_react36 = require("react");++var import_react37 = require("react");var plainSpeech = (text) => stripHeader(text).replace(/```[\s\S]*?```/g, " ").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/[*_`#>|~-]+/g, " ").replace(/\s+/g, " ").trim();var VOICE_LABELS = {listening: "Listening",@@@ -14448,8 -14949,8 +15299,8 @@@ function watchReply(read, watch, consum};}function useMicLevel(enabled) {- const [level, setLevel] = (0, import_react35.useState)(0);- (0, import_react35.useEffect)(() => {- const [level, setLevel] = (0, import_react36.useState)(0);- (0, import_react36.useEffect)(() => {++ const [level, setLevel] = (0, import_react37.useState)(0);++ (0, import_react37.useEffect)(() => {if (!enabled || !navigator.mediaDevices?.getUserMedia) return void 0;let stream = null;let audio = null;@@@ -14499,18 -15000,18 +15350,18 @@@ function VoiceMode({ sessionId, rosterconst entry = Array.isArray(outline) ? outline[outline.length - 1] : void 0;return entry ? `${outline.length}|${entry.turn}` : "0|";});- const [speech] = (0, import_react35.useState)(() => actions.speech());- const [phase, setPhase] = (0, import_react35.useState)(speech ? "starting" : speechApi() ? "listening" : "unsupported");- const [catalog, setCatalog] = (0, import_react35.useState)(null);- const [heard, setHeard] = (0, import_react35.useState)("");- const [said, setSaid] = (0, import_react35.useState)("");- const [note, setNote] = (0, import_react35.useState)("");- const [serviceLevel, setServiceLevel] = (0, import_react35.useState)(0);- const [cycle, setCycle] = (0, import_react35.useState)(0);- const waiting = (0, import_react35.useRef)(null);- const reply = (0, import_react35.useRef)(lastReply);- const [speech] = (0, import_react36.useState)(() => actions.speech());- const [phase, setPhase] = (0, import_react36.useState)(speech ? "starting" : speechApi() ? "listening" : "unsupported");- const [catalog, setCatalog] = (0, import_react36.useState)(null);- const [heard, setHeard] = (0, import_react36.useState)("");- const [said, setSaid] = (0, import_react36.useState)("");- const [note, setNote] = (0, import_react36.useState)("");- const [serviceLevel, setServiceLevel] = (0, import_react36.useState)(0);- const [cycle, setCycle] = (0, import_react36.useState)(0);- const waiting = (0, import_react36.useRef)(null);- const reply = (0, import_react36.useRef)(lastReply);++ const [speech] = (0, import_react37.useState)(() => actions.speech());++ const [phase, setPhase] = (0, import_react37.useState)(speech ? "starting" : speechApi() ? "listening" : "unsupported");++ const [catalog, setCatalog] = (0, import_react37.useState)(null);++ const [heard, setHeard] = (0, import_react37.useState)("");++ const [said, setSaid] = (0, import_react37.useState)("");++ const [note, setNote] = (0, import_react37.useState)("");++ const [serviceLevel, setServiceLevel] = (0, import_react37.useState)(0);++ const [cycle, setCycle] = (0, import_react37.useState)(0);++ const waiting = (0, import_react37.useRef)(null);++ const reply = (0, import_react37.useRef)(lastReply);reply.current = lastReply;- const turn = (0, import_react35.useRef)(0);- const turn = (0, import_react36.useRef)(0);++ const turn = (0, import_react37.useRef)(0);const paneLeft = usePaneLeft();const close = () => {turn.current += 1;@@@ -14530,12 -15031,12 +15381,12 @@@dictation.stop();submit(text);});- (0, import_react35.useEffect)(() => {- (0, import_react36.useEffect)(() => {++ (0, import_react37.useEffect)(() => {if (!note) return void 0;const timer = setTimeout(() => setNote(""), 2600);return () => clearTimeout(timer);}, [note]);- (0, import_react35.useEffect)(() => {- (0, import_react36.useEffect)(() => {++ (0, import_react37.useEffect)(() => {if (!speech) return void 0;let live = true;speechCatalog(speech).then(({ catalog: next, usable }) => {@@@ -14550,16 -15051,16 +15401,16 @@@};}, [speech]);const listen = phase === "listening";- (0, import_react35.useEffect)(() => {- (0, import_react36.useEffect)(() => {++ (0, import_react37.useEffect)(() => {if (speech || !listen || dictation.listening) return void 0;const timer = setTimeout(() => dictation.start({ continuous: false, onEnd: () => {} }), 250);return () => clearTimeout(timer);}, [listen, dictation.listening]);- (0, import_react35.useEffect)(() => {- (0, import_react36.useEffect)(() => {++ (0, import_react37.useEffect)(() => {if (phase !== "listening") dictation.stop();}, [phase]);- (0, import_react35.useEffect)(() => {- (0, import_react36.useEffect)(() => {++ (0, import_react37.useEffect)(() => {if (!speech || !catalog || !listen) return void 0;const own = turn.current;let capture = null;@@@ -14621,7 -15122,7 +15472,7 @@@setServiceLevel(0);};}, [speech, catalog, listen, cycle]);- (0, import_react35.useEffect)(() => {- (0, import_react36.useEffect)(() => {++ (0, import_react37.useEffect)(() => {if (phase !== "thinking" || running || waiting.current === null) return void 0;const count = lastReply.slice(0, lastReply.indexOf("|"));const turn2 = Number(lastReply.slice(lastReply.indexOf("|") + 1));@@@ -14656,7 -15157,7 +15507,7 @@@});}, [phase, running, lastReply]);- (0, import_react35.useEffect)(() => () => window.speechSynthesis?.cancel(), []);- (0, import_react36.useEffect)(() => () => window.speechSynthesis?.cancel(), []);++ (0, import_react37.useEffect)(() => () => window.speechSynthesis?.cancel(), []);const micLevel = useMicLevel(!speech && phase === "listening" && dictation.listening);const level = speech ? serviceLevel : micLevel;const markState = phase === "thinking" || phase === "transcribing" ? "thinking" : phase === "speaking" ? "sending" : "idle";@@@ -14670,7 -15171,7 +15521,7 @@@window.speechSynthesis?.cancel();setPhase("paused");};- (0, import_react35.useEffect)(() => {- (0, import_react36.useEffect)(() => {++ (0, import_react37.useEffect)(() => {if (phase !== "preparing" || !speech) return void 0;let stopped = false;let timer;@@@ -14722,55 -15223,55 +15573,55 @@@};const caption = phase === "speaking" ? said : heard;const shownNote = note || dictation.note;- return (0, import_react35.createElement)(- return (0, import_react36.createElement)(++ return (0, import_react37.createElement)("div",{ className: "bt-pane bt-voice-pane", style: { left: paneLeft } },- (0, import_react35.createElement)(- (0, import_react36.createElement)(++ (0, import_react37.createElement)("div",{ className: "bt-voice-stage", role: "dialog", "aria-label": t("Voice chat with {name}", { name }), "data-phase": phase === "transcribing" ? "thinking" : phase },- (0, import_react35.createElement)(- (0, import_react36.createElement)(++ (0, import_react37.createElement)("div",{ className: "bt-voice-orb", style: { "--bt-level": level } },- (0, import_react35.createElement)("span", { className: "bt-voice-ring", "aria-hidden": true }),- (0, import_react35.createElement)("span", { className: "bt-voice-ring bt-voice-ring-2", "aria-hidden": true }),- bot ? (0, import_react35.createElement)(BotMark, { bot, size: 112, state: markState, live: true, gaze: phase === "listening" }) : room2 ? (0, import_react35.createElement)(RoomAvatar, { room: room2, roster, size: 112 }) : null- (0, import_react36.createElement)("span", { className: "bt-voice-ring", "aria-hidden": true }),- (0, import_react36.createElement)("span", { className: "bt-voice-ring bt-voice-ring-2", "aria-hidden": true }),- bot ? (0, import_react36.createElement)(BotMark, { bot, size: 112, state: markState, live: true, gaze: phase === "listening" }) : room2 ? (0, import_react36.createElement)(RoomAvatar, { room: room2, roster, size: 112 }) : null++ (0, import_react37.createElement)("span", { className: "bt-voice-ring", "aria-hidden": true }),++ (0, import_react37.createElement)("span", { className: "bt-voice-ring bt-voice-ring-2", "aria-hidden": true }),++ bot ? (0, import_react37.createElement)(BotMark, { bot, size: 112, state: markState, live: true, gaze: phase === "listening" }) : room2 ? (0, import_react37.createElement)(RoomAvatar, { room: room2, roster, size: 112 }) : null),- (0, import_react35.createElement)("div", { className: "bt-voice-name" }, name),- (0, import_react35.createElement)(- (0, import_react36.createElement)("div", { className: "bt-voice-name" }, name),- (0, import_react36.createElement)(++ (0, import_react37.createElement)("div", { className: "bt-voice-name" }, name),++ (0, import_react37.createElement)("div",{ className: "bt-voice-status", role: "status" },- phase === "thinking" ? (0, import_react35.createElement)(Shimmer, null, t("Thinking…")) : phase === "transcribing" ? (0, import_react35.createElement)(Shimmer, null, t("Recognizing…")) : VOICE_LABELS[phase] ? t(VOICE_LABELS[phase]) : ""- phase === "thinking" ? (0, import_react36.createElement)(Shimmer, null, t("Thinking…")) : phase === "transcribing" ? (0, import_react36.createElement)(Shimmer, null, t("Recognizing…")) : VOICE_LABELS[phase] ? t(VOICE_LABELS[phase]) : ""++ phase === "thinking" ? (0, import_react37.createElement)(Shimmer, null, t("Thinking…")) : phase === "transcribing" ? (0, import_react37.createElement)(Shimmer, null, t("Recognizing…")) : VOICE_LABELS[phase] ? t(VOICE_LABELS[phase]) : ""),- (0, import_react35.createElement)("div", { className: "bt-voice-caption", key: `${phase}:${caption.slice(0, 12)}` }, caption),- openSetup ? (0, import_react35.createElement)("button", { type: "button", className: "bt-voice-setup", onClick: startSetup }, t("Set up voice input")) : null,- shownNote ? (0, import_react35.createElement)("div", { className: "bt-voice-note" }, shownNote) : null- (0, import_react36.createElement)("div", { className: "bt-voice-caption", key: `${phase}:${caption.slice(0, 12)}` }, caption),- openSetup ? (0, import_react36.createElement)("button", { type: "button", className: "bt-voice-setup", onClick: startSetup }, t("Set up voice input")) : null,- shownNote ? (0, import_react36.createElement)("div", { className: "bt-voice-note" }, shownNote) : null++ (0, import_react37.createElement)("div", { className: "bt-voice-caption", key: `${phase}:${caption.slice(0, 12)}` }, caption),++ openSetup ? (0, import_react37.createElement)("button", { type: "button", className: "bt-voice-setup", onClick: startSetup }, t("Set up voice input")) : null,++ shownNote ? (0, import_react37.createElement)("div", { className: "bt-voice-note" }, shownNote) : null),- (0, import_react35.createElement)(- (0, import_react36.createElement)(++ (0, import_react37.createElement)("div",{ className: "bt-voice-bar" },- (0, import_react35.createElement)("button", {- (0, import_react36.createElement)("button", {++ (0, import_react37.createElement)("button", {type: "button",className: "bt-voice-btn","aria-pressed": phase === "paused",disabled: blocked,"aria-label": phase === "paused" ? t("Resume listening") : t("Pause"),onClick: togglePause- }, (0, import_react35.createElement)(MicIcon, { size: 20 }), phase === "paused" ? (0, import_react35.createElement)("span", { className: "bt-voice-slash", "aria-hidden": true }) : null),- (0, import_react35.createElement)("button", { type: "button", className: "bt-voice-btn bt-voice-end", "aria-label": t("End voice chat"), onClick: close }, (0, import_react35.createElement)(CloseIcon))- }, (0, import_react36.createElement)(MicIcon, { size: 20 }), phase === "paused" ? (0, import_react36.createElement)("span", { className: "bt-voice-slash", "aria-hidden": true }) : null),- (0, import_react36.createElement)("button", { type: "button", className: "bt-voice-btn bt-voice-end", "aria-label": t("End voice chat"), onClick: close }, (0, import_react36.createElement)(CloseIcon))++ }, (0, import_react37.createElement)(MicIcon, { size: 20 }), phase === "paused" ? (0, import_react37.createElement)("span", { className: "bt-voice-slash", "aria-hidden": true }) : null),++ (0, import_react37.createElement)("button", { type: "button", className: "bt-voice-btn bt-voice-end", "aria-label": t("End voice chat"), onClick: close }, (0, import_react37.createElement)(CloseIcon))));}// src/client/permission-picker.js- var import_react36 = require("react");-var import_react37 = require("react");++var import_react38 = require("react");var LABELS = { "read-only": "Read only", "workspace-write": "Workspace", "danger-full-access": "Full access" };var DANGER = /* @__PURE__ */ new Set(["danger-full-access"]);var presetDanger = (value) => DANGER.has(value);var presetName = (value, catalog) => LABELS[value] ? t(LABELS[value]) : catalog?.options?.find((option) => option.value === value)?.name ?? value;function PermissionPicker({ catalog, saved, onPick, repick = false }) {- const [pending, setPending] = (0, import_react36.useState)(null);- const flight = (0, import_react36.useRef)({ value: void 0, latest: void 0 });- (0, import_react36.useEffect)(() => {- const [pending, setPending] = (0, import_react37.useState)(null);- const flight = (0, import_react37.useRef)({ value: void 0, latest: void 0 });- (0, import_react37.useEffect)(() => {++ const [pending, setPending] = (0, import_react38.useState)(null);++ const flight = (0, import_react38.useRef)({ value: void 0, latest: void 0 });++ (0, import_react38.useEffect)(() => {const flying = flight.current.value;if (pending === saved && (flying === void 0 || flying === pending)) setPending(null);}, [pending, saved]);@@@ -14797,10 -15298,10 +15648,10 @@@}send(value);};- return (0, import_react36.createElement)(- return (0, import_react37.createElement)(++ return (0, import_react38.createElement)(Segmented,{ label: t("Permissions"), value: current },- catalog.options.map((option) => (0, import_react36.createElement)("button", {- catalog.options.map((option) => (0, import_react37.createElement)("button", {++ catalog.options.map((option) => (0, import_react38.createElement)("button", {key: option.value,type: "button","aria-pressed": option.value === current,@@@ -14812,7 -15313,7 +15663,7 @@@}// src/client/group-settings.js- var import_react37 = require("react");-var import_react38 = require("react");++var import_react39 = require("react");var ROOM_MODES = [["admin", "Admin leads", "Plain messages go to the admin, who calls others with @Name."],["everyone", "Everyone", "Every member answers in turn, admin first."]@@@ -14825,64 -15326,26 +15676,26 @@@ function roomSubtitle(room2, roster)function GroupPermission({ room: room2, catalog, update }) {if (!catalog?.options?.length) return null;const shared2 = room2.permission !== void 0;- return (0, import_react37.createElement)(- return (0, import_react38.createElement)(++ return (0, import_react39.createElement)(Card2,{ title: t("Permissions") },- (0, import_react37.createElement)(SwitchRow, {- (0, import_react38.createElement)(SwitchRow, {++ (0, import_react39.createElement)(SwitchRow, {label: t("Same for every member"),hint: t("Replaces each member's own permissions in this group."),on: shared2,onChange: (on) => update({ permission: on ? catalog.defaultPreset ?? catalog.options[0].value : null })}),- shared2 ? (0, import_react37.createElement)(- shared2 ? (0, import_react38.createElement)(++ shared2 ? (0, import_react39.createElement)("div",{ className: "bt-set-row bt-bs-row bt-bs-stack bt-gs-perm bt-veil" },- (0, import_react37.createElement)(PermissionPicker, { catalog, saved: room2.permission, onPick: (permission) => update({ permission }) })- (0, import_react38.createElement)(PermissionPicker, { catalog, saved: room2.permission, onPick: (permission) => update({ permission }) })++ (0, import_react39.createElement)(PermissionPicker, { catalog, saved: room2.permission, onPick: (permission) => update({ permission }) })) : null);}function GroupSettingsForm({ room: room2, roster, actions, run: run2, onDeleted }) {- const [adding, setAdding] = (0, import_react37.useState)(false);- const [confirming, setConfirming] = (0, import_react37.useState)(false);- (0, import_react37.useEffect)(() => {- const [adding, setAdding] = (0, import_react38.useState)(false);- const [confirming, setConfirming] = (0, import_react38.useState)(false);- (0, import_react38.useEffect)(() => {++ const [adding, setAdding] = (0, import_react39.useState)(false);++ const [confirming, setConfirming] = (0, import_react39.useState)(false);++ (0, import_react39.useEffect)(() => {if (!confirming) return void 0;const timer = setTimeout(() => setConfirming(false), 4e3);return () => clearTimeout(timer);@@@ -14906,41 -15369,41 +15719,41 @@@if (done) onDeleted?.();});};- return (0, import_react37.createElement)(- return (0, import_react38.createElement)(++ return (0, import_react39.createElement)("div",{ className: "bt-bs" },- (0, import_react37.createElement)(- (0, import_react38.createElement)(++ (0, import_react39.createElement)("div",{ className: "bt-bs-hero" },- (0, import_react37.createElement)(RoomAvatar, { room: room2, roster, size: 64 }),- (0, import_react37.createElement)(- (0, import_react38.createElement)(RoomAvatar, { room: room2, roster, size: 64 }),- (0, import_react38.createElement)(++ (0, import_react39.createElement)(RoomAvatar, { room: room2, roster, size: 64 }),++ (0, import_react39.createElement)("div",{ className: "bt-bs-who" },- (0, import_react37.createElement)("span", { className: "bt-bs-name" }, room2.name),- (0, import_react37.createElement)("span", { className: "bt-bs-sub" }, roomSubtitle(room2, roster))- (0, import_react38.createElement)("span", { className: "bt-bs-name" }, room2.name),- (0, import_react38.createElement)("span", { className: "bt-bs-sub" }, roomSubtitle(room2, roster))++ (0, import_react39.createElement)("span", { className: "bt-bs-name" }, room2.name),++ (0, import_react39.createElement)("span", { className: "bt-bs-sub" }, roomSubtitle(room2, roster)))),- (0, import_react37.createElement)(- (0, import_react38.createElement)(++ (0, import_react39.createElement)(Card2,{ title: t("Profile") },- (0, import_react37.createElement)(- (0, import_react38.createElement)(++ (0, import_react39.createElement)(Row,{ label: t("Name"), hint: t("Leave it empty to name the group after its members.") },- (0, import_react37.createElement)(InlineText, { label: t("Group name"), value: room2.named ? room2.name : "", placeholder: t("Name after members"), maxLength: 60, onSave: (name) => update({ name }) })- (0, import_react38.createElement)(InlineText, { label: t("Group name"), value: room2.named ? room2.name : "", placeholder: t("Name after members"), maxLength: 60, onSave: (name) => update({ name }) })++ (0, import_react39.createElement)(InlineText, { label: t("Group name"), value: room2.named ? room2.name : "", placeholder: t("Name after members"), maxLength: 60, onSave: (name) => update({ name }) })),- (0, import_react37.createElement)(- (0, import_react38.createElement)(++ (0, import_react39.createElement)(Row,{ label: t("Notice"), hint: t("Every member reads it before speaking in this group."), stack: true },- (0, import_react37.createElement)(InlineText, { label: t("Group notice"), value: room2.notice, multiline: true, maxLength: 2e3, placeholder: t("Shared instructions every member reads before speaking…"), onSave: (notice) => update({ notice }) })- (0, import_react38.createElement)(InlineText, { label: t("Group notice"), value: room2.notice, multiline: true, maxLength: 2e3, placeholder: t("Shared instructions every member reads before speaking…"), onSave: (notice) => update({ notice }) })++ (0, import_react39.createElement)(InlineText, { label: t("Group notice"), value: room2.notice, multiline: true, maxLength: 2e3, placeholder: t("Shared instructions every member reads before speaking…"), onSave: (notice) => update({ notice }) }))),- (0, import_react37.createElement)(- (0, import_react38.createElement)(++ (0, import_react39.createElement)(Card2,{ title: t("Who answers") },- (0, import_react37.createElement)(- (0, import_react38.createElement)(++ (0, import_react39.createElement)("div",{ className: "bt-set-row bt-bs-row bt-bs-stack" },- (0, import_react37.createElement)(Segmented, { label: t("Who answers"), value: mode }, ROOM_MODES.map(([id, label]) => (0, import_react37.createElement)("button", {- (0, import_react38.createElement)(Segmented, { label: t("Who answers"), value: mode }, ROOM_MODES.map(([id, label]) => (0, import_react38.createElement)("button", {++ (0, import_react39.createElement)(Segmented, { label: t("Who answers"), value: mode }, ROOM_MODES.map(([id, label]) => (0, import_react39.createElement)("button", {key: id,type: "button","aria-pressed": mode === id,@@@ -14950,88 -15413,87 +15763,87 @@@if (mode !== id) void update({ mode: id });}}, t(label)))),- (0, import_react37.createElement)("span", { key: mode, className: "bt-set-hint bt-veil" }, `${t(modeHint)} ${t("@mentions always pick who answers.")}`)- ),- (0, import_react37.createElement)(RelayLimitRow, { room: room2, update })- (0, import_react38.createElement)("span", { key: mode, className: "bt-set-hint bt-veil" }, `${t(modeHint)} ${t("@mentions always pick who answers.")}`)++ (0, import_react39.createElement)("span", { key: mode, className: "bt-set-hint bt-veil" }, `${t(modeHint)} ${t("@mentions always pick who answers.")}`)+ )),- (0, import_react37.createElement)(- (0, import_react38.createElement)(++ (0, import_react39.createElement)(Card2,{ title: t("Working folder") },- (0, import_react37.createElement)(- (0, import_react38.createElement)(++ (0, import_react39.createElement)("div",{ className: "bt-set-row bt-bs-row" },- (0, import_react37.createElement)("span", { className: "bt-set-copy" }, (0, import_react37.createElement)("span", { className: "bt-bs-label" }, t("Folder"))),- (0, import_react37.createElement)(FolderMenu, { value: room2.workDir, group: true, actions, run: run2, onPick: (workDir) => update({ workDir }) })- (0, import_react38.createElement)("span", { className: "bt-set-copy" }, (0, import_react38.createElement)("span", { className: "bt-bs-label" }, t("Folder"))),- (0, import_react38.createElement)(FolderMenu, { value: room2.workDir, group: true, actions, run: run2, onPick: (workDir) => update({ workDir }) })++ (0, import_react39.createElement)("span", { className: "bt-set-copy" }, (0, import_react39.createElement)("span", { className: "bt-bs-label" }, t("Folder"))),++ (0, import_react39.createElement)(FolderMenu, { value: room2.workDir, group: true, actions, run: run2, onPick: (workDir) => update({ workDir }) }))),- (0, import_react37.createElement)(GroupPermission, { room: room2, catalog: roster.permissions, update }),- (0, import_react37.createElement)(- (0, import_react38.createElement)(GroupPermission, { room: room2, catalog: roster.permissions, update }),- (0, import_react38.createElement)(++ (0, import_react39.createElement)(GroupPermission, { room: room2, catalog: roster.permissions, update }),++ (0, import_react39.createElement)(Card2,{ title: t("Members · {count}", { count: members.length }) },members.map((member) => {const leads = room2.admin === member.id;- return (0, import_react37.createElement)(- return (0, import_react38.createElement)(++ return (0, import_react39.createElement)("div",{ key: member.id, className: "bt-set-row bt-bs-row bt-gs-member" },- (0, import_react37.createElement)(- (0, import_react38.createElement)(++ (0, import_react39.createElement)("button",{ type: "button", className: "bt-gs-who", title: t("Open {name}'s chat", { name: member.name }), onClick: () => openBot(member.id) },- (0, import_react37.createElement)(BotAvatar, { bot: member, size: 26, main: isMainOf(roster, member.id), admin: leads, live: false }),- (0, import_react37.createElement)("span", { className: "bt-row-title" }, member.name),- leads ? (0, import_react37.createElement)("span", { className: "bt-tag" }, t("Admin")) : null- (0, import_react38.createElement)(BotAvatar, { bot: member, size: 26, main: isMainOf(roster, member.id), admin: leads, live: false }),- (0, import_react38.createElement)("span", { className: "bt-row-title" }, member.name),- leads ? (0, import_react38.createElement)("span", { className: "bt-tag" }, t("Admin")) : null++ (0, import_react39.createElement)(BotAvatar, { bot: member, size: 26, main: isMainOf(roster, member.id), admin: leads, live: false }),++ (0, import_react39.createElement)("span", { className: "bt-row-title" }, member.name),++ leads ? (0, import_react39.createElement)("span", { className: "bt-tag" }, t("Admin")) : null),- leads ? (0, import_react37.createElement)("button", { type: "button", className: "bt-mini", title: t("Leave the group without an admin"), onClick: () => update({ admin: null }) }, t("Unset")) : (0, import_react37.createElement)("button", { type: "button", className: "bt-mini", onClick: () => update({ admin: member.id }) }, t("Make admin")),- members.length > 2 ? (0, import_react37.createElement)("button", { type: "button", className: "bt-x", "aria-label": t("Remove {name} from the group", { name: member.name }), title: t("Remove from group"), onClick: () => update({ remove: [member.id] }) }, "×") : null- leads ? (0, import_react38.createElement)("button", { type: "button", className: "bt-mini", title: t("Leave the group without an admin"), onClick: () => update({ admin: null }) }, t("Unset")) : (0, import_react38.createElement)("button", { type: "button", className: "bt-mini", onClick: () => update({ admin: member.id }) }, t("Make admin")),- members.length > 2 ? (0, import_react38.createElement)("button", { type: "button", className: "bt-x", "aria-label": t("Remove {name} from the group", { name: member.name }), title: t("Remove from group"), onClick: () => update({ remove: [member.id] }) }, "×") : null++ leads ? (0, import_react39.createElement)("button", { type: "button", className: "bt-mini", title: t("Leave the group without an admin"), onClick: () => update({ admin: null }) }, t("Unset")) : (0, import_react39.createElement)("button", { type: "button", className: "bt-mini", onClick: () => update({ admin: member.id }) }, t("Make admin")),++ members.length > 2 ? (0, import_react39.createElement)("button", { type: "button", className: "bt-x", "aria-label": t("Remove {name} from the group", { name: member.name }), title: t("Remove from group"), onClick: () => update({ remove: [member.id] }) }, "×") : null);}),adding ? [- ...outside.map((bot) => (0, import_react37.createElement)(- ...outside.map((bot) => (0, import_react38.createElement)(++ ...outside.map((bot) => (0, import_react39.createElement)("button",{ key: bot.id, type: "button", className: "bt-set-row bt-bs-row bt-gs-pick", onClick: () => {setAdding(false);void update({ add: [bot.id] });} },- (0, import_react37.createElement)(BotMark, { bot, size: 22 }),- (0, import_react37.createElement)("span", { className: "bt-set-copy" }, (0, import_react37.createElement)("span", { className: "bt-bs-label" }, bot.name)),- (0, import_react37.createElement)("span", { className: "bt-set-hint" }, t("Add"))- (0, import_react38.createElement)(BotMark, { bot, size: 22 }),- (0, import_react38.createElement)("span", { className: "bt-set-copy" }, (0, import_react38.createElement)("span", { className: "bt-bs-label" }, bot.name)),- (0, import_react38.createElement)("span", { className: "bt-set-hint" }, t("Add"))++ (0, import_react39.createElement)(BotMark, { bot, size: 22 }),++ (0, import_react39.createElement)("span", { className: "bt-set-copy" }, (0, import_react39.createElement)("span", { className: "bt-bs-label" }, bot.name)),++ (0, import_react39.createElement)("span", { className: "bt-set-hint" }, t("Add")))),- (0, import_react37.createElement)("button", { key: "cancel", type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => setAdding(false) }, t("Cancel"))- ] : outside.length > 0 ? (0, import_react37.createElement)("button", { type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => setAdding(true) }, (0, import_react37.createElement)(PlusIcon), t("Add member")) : null,- (0, import_react37.createElement)("div", { className: "bt-set-row bt-gs-note" }, (0, import_react37.createElement)(- (0, import_react38.createElement)("button", { key: "cancel", type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => setAdding(false) }, t("Cancel"))- ] : outside.length > 0 ? (0, import_react38.createElement)("button", { type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => setAdding(true) }, (0, import_react38.createElement)(PlusIcon), t("Add member")) : null,- (0, import_react38.createElement)("div", { className: "bt-set-row bt-gs-note" }, (0, import_react38.createElement)(++ (0, import_react39.createElement)("button", { key: "cancel", type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => setAdding(false) }, t("Cancel"))++ ] : outside.length > 0 ? (0, import_react39.createElement)("button", { type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => setAdding(true) }, (0, import_react39.createElement)(PlusIcon), t("Add member")) : null,++ (0, import_react39.createElement)("div", { className: "bt-set-row bt-gs-note" }, (0, import_react39.createElement)("span",{ className: "bt-set-hint" },// The host checks for two members on every change, even a rename.members.length < 2 ? t("Add a Bot first: a group chat needs at least two.") : admin ? t("{name} leads this group: it can call members with @Name, change the group, and post here.", { name: admin.name }) : t("No admin yet. An admin can call members with @Name, change the group, and post here.")))),- (0, import_react37.createElement)(- (0, import_react38.createElement)(++ (0, import_react39.createElement)(Card2,{ title: t("Sidebar") },- (0, import_react37.createElement)(SwitchRow, { label: t("Pin"), hint: t("Kept above the other chats."), on: room2.pinned === true, onChange: (pinned) => run2(actions.setFlags(room2.id, { pinned })) }),- (0, import_react37.createElement)(SwitchRow, { label: t("Hide from sidebar"), hint: t("Search still finds it."), on: room2.hidden === true, onChange: (hidden) => run2(actions.setFlags(room2.id, { hidden })) })- (0, import_react38.createElement)(SwitchRow, { label: t("Pin"), hint: t("Kept above the other chats."), on: room2.pinned === true, onChange: (pinned) => run2(actions.setFlags(room2.id, { pinned })) }),- (0, import_react38.createElement)(SwitchRow, { label: t("Hide from sidebar"), hint: t("Search still finds it."), on: room2.hidden === true, onChange: (hidden) => run2(actions.setFlags(room2.id, { hidden })) })++ (0, import_react39.createElement)(SwitchRow, { label: t("Pin"), hint: t("Kept above the other chats."), on: room2.pinned === true, onChange: (pinned) => run2(actions.setFlags(room2.id, { pinned })) }),++ (0, import_react39.createElement)(SwitchRow, { label: t("Hide from sidebar"), hint: t("Search still finds it."), on: room2.hidden === true, onChange: (hidden) => run2(actions.setFlags(room2.id, { hidden })) })),- (0, import_react37.createElement)(- (0, import_react38.createElement)(++ (0, import_react39.createElement)(Card2,{ title: t("Manage") },- (0, import_react37.createElement)(- (0, import_react38.createElement)(++ (0, import_react39.createElement)("button",{ type: "button", className: "bt-set-row bt-bs-row bt-bs-danger", "data-confirm": confirming || void 0, onClick: remove },- (0, import_react37.createElement)(- (0, import_react38.createElement)(++ (0, import_react39.createElement)("span",{ className: "bt-set-copy" },- (0, import_react37.createElement)("span", { className: "bt-bs-label" }, confirming ? t("Delete {name}?", { name: room2.name }) : t("Delete group")),- (0, import_react37.createElement)("span", { className: "bt-set-hint" }, confirming ? t("Click again to delete. Its history is archived.") : t("Removes the group chat. Its members stay on the team."))- (0, import_react38.createElement)("span", { className: "bt-bs-label" }, confirming ? t("Delete {name}?", { name: room2.name }) : t("Delete group")),- (0, import_react38.createElement)("span", { className: "bt-set-hint" }, confirming ? t("Click again to delete. Its history is archived.") : t("Removes the group chat. Its members stay on the team."))++ (0, import_react39.createElement)("span", { className: "bt-bs-label" }, confirming ? t("Delete {name}?", { name: room2.name }) : t("Delete group")),++ (0, import_react39.createElement)("span", { className: "bt-set-hint" }, confirming ? t("Click again to delete. Its history is archived.") : t("Removes the group chat. Its members stay on the team."))),- (0, import_react37.createElement)("span", { className: "bt-chevron" }, (0, import_react37.createElement)(ChevronRightIcon))- (0, import_react38.createElement)("span", { className: "bt-chevron" }, (0, import_react38.createElement)(ChevronRightIcon))++ (0, import_react39.createElement)("span", { className: "bt-chevron" }, (0, import_react39.createElement)(ChevronRightIcon)))));}function NewGroupForm({ roster, actions, run: run2, onCreated, onCancel }) {- const [admin, setAdmin] = (0, import_react37.useState)(null);- const [members, setMembers] = (0, import_react37.useState)([]);- const [name, setName] = (0, import_react37.useState)("");- const [busy, setBusy] = (0, import_react37.useState)(false);- const [admin, setAdmin] = (0, import_react38.useState)(null);- const [members, setMembers] = (0, import_react38.useState)([]);- const [name, setName] = (0, import_react38.useState)("");- const [busy, setBusy] = (0, import_react38.useState)(false);++ const [admin, setAdmin] = (0, import_react39.useState)(null);++ const [members, setMembers] = (0, import_react39.useState)([]);++ const [name, setName] = (0, import_react39.useState)("");++ const [busy, setBusy] = (0, import_react39.useState)(false);const toggle = (id) => setMembers((list) => list.includes(id) ? list.filter((item) => item !== id) : [...list, id]);const pickAdmin = (id) => {setAdmin(id);@@@ -15047,48 -15509,48 +15859,48 @@@if (done && room2) onCreated(room2);else setBusy(false);};- const chip = (bot, on, onClick, role) => (0, import_react37.createElement)("button", {- const chip = (bot, on, onClick, role) => (0, import_react38.createElement)("button", {++ const chip = (bot, on, onClick, role) => (0, import_react39.createElement)("button", {key: bot.id,type: "button",role,className: "bt-ng-chip","aria-checked": on,onClick- }, (0, import_react37.createElement)(BotAvatar, { bot, size: 22, badge: false, live: false }), (0, import_react37.createElement)("span", { className: "bt-ng-name" }, bot.name), on && role === "radio" ? (0, import_react37.createElement)(AdminStar) : null);- return (0, import_react37.createElement)(- }, (0, import_react38.createElement)(BotAvatar, { bot, size: 22, badge: false, live: false }), (0, import_react38.createElement)("span", { className: "bt-ng-name" }, bot.name), on && role === "radio" ? (0, import_react38.createElement)(AdminStar) : null);- return (0, import_react38.createElement)(++ }, (0, import_react39.createElement)(BotAvatar, { bot, size: 22, badge: false, live: false }), (0, import_react39.createElement)("span", { className: "bt-ng-name" }, bot.name), on && role === "radio" ? (0, import_react39.createElement)(AdminStar) : null);++ return (0, import_react39.createElement)("div",{ className: "bt-set-card bt-ng" },- (0, import_react37.createElement)(- (0, import_react38.createElement)(++ (0, import_react39.createElement)("div",{ className: "bt-set-row bt-bs-row bt-bs-stack" },- (0, import_react37.createElement)("span", { className: "bt-set-copy" }, (0, import_react37.createElement)("span", { className: "bt-bs-label bt-ng-label" }, (0, import_react37.createElement)(AdminStar), t("Choose the group admin"))),- (0, import_react37.createElement)(- (0, import_react38.createElement)("span", { className: "bt-set-copy" }, (0, import_react38.createElement)("span", { className: "bt-bs-label bt-ng-label" }, (0, import_react38.createElement)(AdminStar), t("Choose the group admin"))),- (0, import_react38.createElement)(++ (0, import_react39.createElement)("span", { className: "bt-set-copy" }, (0, import_react39.createElement)("span", { className: "bt-bs-label bt-ng-label" }, (0, import_react39.createElement)(AdminStar), t("Choose the group admin"))),++ (0, import_react39.createElement)("div",{ className: "bt-ng-picks", role: "radiogroup", "aria-label": t("Group admin") },roster.bots.map((bot) => chip(bot, admin === bot.id, () => pickAdmin(bot.id), "radio")))),- admin === null ? null : (0, import_react37.createElement)(- admin === null ? null : (0, import_react38.createElement)(++ admin === null ? null : (0, import_react39.createElement)("div",{ className: "bt-set-row bt-bs-row bt-bs-stack bt-ng-step" },- (0, import_react37.createElement)("span", { className: "bt-set-copy" }, (0, import_react37.createElement)("span", { className: "bt-bs-label" }, t("Who to chat with…"))),- (0, import_react37.createElement)(- (0, import_react38.createElement)("span", { className: "bt-set-copy" }, (0, import_react38.createElement)("span", { className: "bt-bs-label" }, t("Who to chat with…"))),- (0, import_react38.createElement)(++ (0, import_react39.createElement)("span", { className: "bt-set-copy" }, (0, import_react39.createElement)("span", { className: "bt-bs-label" }, t("Who to chat with…"))),++ (0, import_react39.createElement)("div",{ className: "bt-ng-picks", role: "group", "aria-label": t("Members") },roster.bots.filter((bot) => bot.id !== admin).map((bot) => chip(bot, members.includes(bot.id), () => toggle(bot.id), "checkbox")))),- admin === null || members.length === 0 ? null : (0, import_react37.createElement)(- admin === null || members.length === 0 ? null : (0, import_react38.createElement)(++ admin === null || members.length === 0 ? null : (0, import_react39.createElement)("label",{ className: "bt-set-row bt-bs-row bt-ng-step" },- (0, import_react37.createElement)("span", { className: "bt-set-copy" }, (0, import_react37.createElement)("span", { className: "bt-bs-label" }, t("Name"))),- (0, import_react37.createElement)("input", { className: "bt-bs-input", value: name, maxLength: 60, placeholder: t("Name after members"), onChange: (event) => setName(event.target.value) })- (0, import_react38.createElement)("span", { className: "bt-set-copy" }, (0, import_react38.createElement)("span", { className: "bt-bs-label" }, t("Name"))),- (0, import_react38.createElement)("input", { className: "bt-bs-input", value: name, maxLength: 60, placeholder: t("Name after members"), onChange: (event) => setName(event.target.value) })++ (0, import_react39.createElement)("span", { className: "bt-set-copy" }, (0, import_react39.createElement)("span", { className: "bt-bs-label" }, t("Name"))),++ (0, import_react39.createElement)("input", { className: "bt-bs-input", value: name, maxLength: 60, placeholder: t("Name after members"), onChange: (event) => setName(event.target.value) })),- (0, import_react37.createElement)(- (0, import_react38.createElement)(++ (0, import_react39.createElement)("div",{ className: "bt-set-row bt-task-foot" },- (0, import_react37.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),- (0, import_react37.createElement)("button", { type: "button", className: "bt-send bt-soft-sm", disabled: busy || admin === null || members.length === 0, onClick: () => void create() }, t("Create group chat"))- (0, import_react38.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),- (0, import_react38.createElement)("button", { type: "button", className: "bt-send bt-soft-sm", disabled: busy || admin === null || members.length === 0, onClick: () => void create() }, t("Create group chat"))++ (0, import_react39.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),++ (0, import_react39.createElement)("button", { type: "button", className: "bt-send bt-soft-sm", disabled: busy || admin === null || members.length === 0, onClick: () => void create() }, t("Create group chat"))));}@@@ -15116,11 -15578,11 +15928,11 @@@ var GROUP_SETTINGS_CSS =`;// src/client/kept-private.js- var import_react38 = require("react");-var import_react39 = require("react");++var import_react40 = require("react");function KeptPrivateSection({ roster, actions, run: run2, Section, Row: Row3 }) {const kept = roster.privateArchives ?? [];- const [confirming, setConfirming] = (0, import_react38.useState)(null);- (0, import_react38.useEffect)(() => {- const [confirming, setConfirming] = (0, import_react39.useState)(null);- (0, import_react39.useEffect)(() => {++ const [confirming, setConfirming] = (0, import_react40.useState)(null);++ (0, import_react40.useEffect)(() => {if (confirming === null) return void 0;const timer = setTimeout(() => setConfirming(null), 4e3);return () => clearTimeout(timer);@@@ -15134,14 -15596,14 +15946,14 @@@setConfirming(null);void run2(actions.releasePrivate(entry.id));};- return (0, import_react38.createElement)(- return (0, import_react39.createElement)(++ return (0, import_react40.createElement)(Section,{ title: t("Closed after deletion · {count}", { count: kept.length }) },- kept.map((entry) => (0, import_react38.createElement)(Row3, {- kept.map((entry) => (0, import_react39.createElement)(Row3, {++ kept.map((entry) => (0, import_react40.createElement)(Row3, {key: entry.id,label: entry.name,hint: confirming === entry.id ? t("Click again to remove. Other Bots can then read its folder, memory and chats.") : entry.workDir- }, (0, import_react38.createElement)("button", { type: "button", className: `bt-soft bt-soft-sm${confirming === entry.id ? " bt-danger" : ""}`, onClick: () => release(entry) }, t("Remove protection"))))- }, (0, import_react39.createElement)("button", { type: "button", className: `bt-soft bt-soft-sm${confirming === entry.id ? " bt-danger" : ""}`, onClick: () => release(entry) }, t("Remove protection"))))++ }, (0, import_react40.createElement)("button", { type: "button", className: `bt-soft bt-soft-sm${confirming === entry.id ? " bt-danger" : ""}`, onClick: () => release(entry) }, t("Remove protection")))));}@@@ -15278,7 -15740,7 +16090,7 @@@ function percent2(part, whole)}// src/client/usage-page.js- var import_react39 = require("react");-var import_react40 = require("react");++var import_react41 = require("react");var HEAT_WEEKS = 53;var TOP_SERIES = 7;var RING_R = 42;@@@ -15325,9 -15787,9 +16137,9 @@@ function titleOf2(range, bucket)return dates({ year: "numeric", month: "long" }).format(bucket.start);}function useTween(value) {- const [shown, setShown] = (0, import_react39.useState)(0);- const from = (0, import_react39.useRef)(0);- (0, import_react39.useEffect)(() => {- const [shown, setShown] = (0, import_react40.useState)(0);- const from = (0, import_react40.useRef)(0);- (0, import_react40.useEffect)(() => {++ const [shown, setShown] = (0, import_react41.useState)(0);++ const from = (0, import_react41.useRef)(0);++ (0, import_react41.useEffect)(() => {if (reducedMotion() || typeof requestAnimationFrame !== "function") {from.current = value;setShown(value);@@@ -15347,9 -15809,9 +16159,9 @@@}, [value]);return shown;}- var glyphBox = (size, icon2) => (0, import_react39.createElement)("span", { className: "bt-us-glyph", style: { width: size, height: size } }, (0, import_react39.createElement)(icon2));-var glyphBox = (size, icon2) => (0, import_react40.createElement)("span", { className: "bt-us-glyph", style: { width: size, height: size } }, (0, import_react40.createElement)(icon2));++var glyphBox = (size, icon2) => (0, import_react41.createElement)("span", { className: "bt-us-glyph", style: { width: size, height: size } }, (0, import_react41.createElement)(icon2));function ModelGlyph({ name, paint, size }) {- return (0, import_react39.createElement)("span", {- return (0, import_react40.createElement)("span", {++ return (0, import_react41.createElement)("span", {className: "bt-us-model","aria-hidden": true,style: { width: size, height: size, fontSize: Math.round(size * 0.42), background: `color-mix(in srgb, ${paint} 20%, var(--bt-card))`, color: `color-mix(in srgb, ${paint} 72%, var(--bt-ink))` }@@@ -15366,7 -15828,7 +16178,7 @@@ function ownerFace(owner, roster)sub: owner.deleted ? t("Deleted") : role.toLowerCase() === name.toLowerCase() ? "" : role,paint: paintCss(colorOf(bot)),stops: GRADIENTS[colorOf(bot)],- glyph: (size) => (0, import_react39.createElement)(BotAvatar, { bot, size, badge: false, live: false })- glyph: (size) => (0, import_react40.createElement)(BotAvatar, { bot, size, badge: false, live: false })++ glyph: (size) => (0, import_react41.createElement)(BotAvatar, { bot, size, badge: false, live: false })};}if (owner.kind === "room") {@@@ -15376,7 -15838,7 +16188,7 @@@name: owner.name || t("Deleted group chat"),sub: owner.deleted ? t("Deleted") : t("Group chat"),paint: "var(--bt-us-rest)",- glyph: (size) => room2 ? (0, import_react39.createElement)(RoomAvatar, { room: room2, roster, size }) : glyphBox(size, ChatsIcon)- glyph: (size) => room2 ? (0, import_react40.createElement)(RoomAvatar, { room: room2, roster, size }) : glyphBox(size, ChatsIcon)++ glyph: (size) => room2 ? (0, import_react41.createElement)(RoomAvatar, { room: room2, roster, size }) : glyphBox(size, ChatsIcon)};}if (owner.kind === "agent") {@@@ -15398,30 -15860,30 +16210,30 @@@ function Tabs({ label, value, options,const names = options.map(([, text]) => text).join("\n");const glide = useGlide(`${value}${names}`, { box: boxRef });- return (0, import_react39.createElement)(- return (0, import_react40.createElement)(++ return (0, import_react41.createElement)("div",{ ref: glide.box, className: "bt-us-tabs", role: "group", "aria-label": label },- (0, import_react39.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),- options.map(([id, text, icon2]) => (0, import_react39.createElement)("button", { key: id, type: "button", "aria-pressed": value === id, onClick: () => onChange(id) }, icon2 ? (0, import_react39.createElement)(icon2) : null, text))- (0, import_react40.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),- options.map(([id, text, icon2]) => (0, import_react40.createElement)("button", { key: id, type: "button", "aria-pressed": value === id, onClick: () => onChange(id) }, icon2 ? (0, import_react40.createElement)(icon2) : null, text))++ (0, import_react41.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),++ options.map(([id, text, icon2]) => (0, import_react41.createElement)("button", { key: id, type: "button", "aria-pressed": value === id, onClick: () => onChange(id) }, icon2 ? (0, import_react41.createElement)(icon2) : null, text)));}function Stats({ range, total, previous }) {const shown = useTween(total.total);const change = previous > 0 ? Math.round((total.total - previous) / previous * 100) : null;- const cell = (label, value) => (0, import_react39.createElement)("div", { className: "bt-us-stat" }, (0, import_react39.createElement)("span", { className: "bt-us-stat-label" }, label), (0, import_react39.createElement)("span", { className: "bt-us-stat-value" }, value));- return (0, import_react39.createElement)(- const cell = (label, value) => (0, import_react40.createElement)("div", { className: "bt-us-stat" }, (0, import_react40.createElement)("span", { className: "bt-us-stat-label" }, label), (0, import_react40.createElement)("span", { className: "bt-us-stat-value" }, value));- return (0, import_react40.createElement)(++ const cell = (label, value) => (0, import_react41.createElement)("div", { className: "bt-us-stat" }, (0, import_react41.createElement)("span", { className: "bt-us-stat-label" }, label), (0, import_react41.createElement)("span", { className: "bt-us-stat-value" }, value));++ return (0, import_react41.createElement)("section",{ className: "bt-us-stats", style: { "--i": 0 } },- (0, import_react39.createElement)(- (0, import_react40.createElement)(++ (0, import_react41.createElement)("div",{ className: "bt-us-stat bt-us-stat-main" },- (0, import_react39.createElement)("span", { className: "bt-us-stat-label" }, lastText(range)),- (0, import_react39.createElement)(- (0, import_react40.createElement)("span", { className: "bt-us-stat-label" }, lastText(range)),- (0, import_react40.createElement)(++ (0, import_react41.createElement)("span", { className: "bt-us-stat-label" }, lastText(range)),++ (0, import_react41.createElement)("span",{ className: "bt-us-stat-value" },compact(shown),- (0, import_react39.createElement)("small", null, t("tokens")),- change === null ? null : (0, import_react39.createElement)(- (0, import_react40.createElement)("small", null, t("tokens")),- change === null ? null : (0, import_react40.createElement)(++ (0, import_react41.createElement)("small", null, t("tokens")),++ change === null ? null : (0, import_react41.createElement)("span",{ className: "bt-us-delta", title: compareText(range) },`${change >= 0 ? "↑" : "↓"} ${Math.abs(change)}%`@@@ -15439,83 -15901,83 +16251,83 @@@ function niceTop(max)return [1, 1.5, 2, 2.5, 3, 4, 5, 6, 8, 10].map((scale) => scale * step).find((value) => value >= max);}function Chart({ range, columns: columns2, series, tipSeries, by, onBy, onPick }) {- const [hover, setHover] = (0, import_react39.useState)(null);- const [hover, setHover] = (0, import_react40.useState)(null);++ const [hover, setHover] = (0, import_react41.useState)(null);const top = niceTop(Math.max(0, ...columns2.map((column) => column.total)));const count = columns2.length;const fillOf = new Map(series.map((entry) => [entry.key, entry.fill]));const tipOf = new Map(tipSeries.map((entry) => [entry.key, entry]));const tip = hover === null ? null : columns2[hover];const tipSide = hover !== null && hover >= count / 2 ? { right: `calc(${(count - hover) / count * 100}% + 8px)` } : { left: `calc(${(hover + 1) / count * 100}% + 8px)` };- return (0, import_react39.createElement)(- return (0, import_react40.createElement)(++ return (0, import_react41.createElement)("section",{ className: "bt-us-card bt-us-chart", style: { "--i": 1 } },- (0, import_react39.createElement)(- (0, import_react40.createElement)(++ (0, import_react41.createElement)("div",{ className: "bt-us-card-head" },- (0, import_react39.createElement)("h3", null, t("Tokens over time"), (0, import_react39.createElement)("span", null, unitLabel(range.unit))),- onBy ? (0, import_react39.createElement)(Tabs, { label: t("Group usage by"), value: by, onChange: onBy, options: [["bot", t("By Bot")], ["model", t("By model")]] }) : null- (0, import_react40.createElement)("h3", null, t("Tokens over time"), (0, import_react40.createElement)("span", null, unitLabel(range.unit))),- onBy ? (0, import_react40.createElement)(Tabs, { label: t("Group usage by"), value: by, onChange: onBy, options: [["bot", t("By Bot")], ["model", t("By model")]] }) : null++ (0, import_react41.createElement)("h3", null, t("Tokens over time"), (0, import_react41.createElement)("span", null, unitLabel(range.unit))),++ onBy ? (0, import_react41.createElement)(Tabs, { label: t("Group usage by"), value: by, onChange: onBy, options: [["bot", t("By Bot")], ["model", t("By model")]] }) : null),- (0, import_react39.createElement)(- (0, import_react40.createElement)(++ (0, import_react41.createElement)("div",{ className: "bt-us-chart-body" },- (0, import_react39.createElement)(- (0, import_react40.createElement)(++ (0, import_react41.createElement)("div",{ className: "bt-us-plot", "data-hover": hover === null ? void 0 : "", onMouseLeave: () => setHover(null) },- [1, 0.5].map((level) => (0, import_react39.createElement)("div", { key: level, className: "bt-us-grid", style: { bottom: `${level * 100}%` } }, (0, import_react39.createElement)("span", null, compact(top * level)))),- (0, import_react39.createElement)("div", { className: "bt-us-grid bt-us-base", style: { bottom: 0 } }, (0, import_react39.createElement)("span", null, "0")),- (0, import_react39.createElement)(- [1, 0.5].map((level) => (0, import_react40.createElement)("div", { key: level, className: "bt-us-grid", style: { bottom: `${level * 100}%` } }, (0, import_react40.createElement)("span", null, compact(top * level)))),- (0, import_react40.createElement)("div", { className: "bt-us-grid bt-us-base", style: { bottom: 0 } }, (0, import_react40.createElement)("span", null, "0")),- (0, import_react40.createElement)(++ [1, 0.5].map((level) => (0, import_react41.createElement)("div", { key: level, className: "bt-us-grid", style: { bottom: `${level * 100}%` } }, (0, import_react41.createElement)("span", null, compact(top * level)))),++ (0, import_react41.createElement)("div", { className: "bt-us-grid bt-us-base", style: { bottom: 0 } }, (0, import_react41.createElement)("span", null, "0")),++ (0, import_react41.createElement)("div",{ className: "bt-us-cols" },- columns2.map((column, at) => (0, import_react39.createElement)("div", {- columns2.map((column, at) => (0, import_react40.createElement)("div", {++ columns2.map((column, at) => (0, import_react41.createElement)("div", {key: `${range.from ? `${range.from}~${range.to}` : range.id}:${column.key}`,className: "bt-us-col","data-on": hover === at ? "" : void 0,onMouseEnter: () => setHover(at)- }, column.total > 0 ? (0, import_react39.createElement)(- }, column.total > 0 ? (0, import_react40.createElement)(++ }, column.total > 0 ? (0, import_react41.createElement)("div",{ className: "bt-us-stack", style: { height: `${column.total / top * 100}%`, "--i": at } },- column.parts.map(([key, value]) => value > 0 ? (0, import_react39.createElement)("i", { key, style: { flexGrow: value, background: fillOf.get(key) } }) : null)- ) : (0, import_react39.createElement)("div", { className: "bt-us-stub" })))- column.parts.map(([key, value]) => value > 0 ? (0, import_react40.createElement)("i", { key, style: { flexGrow: value, background: fillOf.get(key) } }) : null)- ) : (0, import_react40.createElement)("div", { className: "bt-us-stub" })))++ column.parts.map(([key, value]) => value > 0 ? (0, import_react41.createElement)("i", { key, style: { flexGrow: value, background: fillOf.get(key) } }) : null)++ ) : (0, import_react41.createElement)("div", { className: "bt-us-stub" })))),- tip ? (0, import_react39.createElement)(- tip ? (0, import_react40.createElement)(++ tip ? (0, import_react41.createElement)("div",{ className: "bt-us-tip", style: tipSide },- (0, import_react39.createElement)("div", { className: "bt-us-tip-title" }, tip.title),- (0, import_react39.createElement)("div", { className: "bt-us-tip-total" }, t("{count} tokens", { count: full(tip.total) })),- tip.tip.filter(([, value]) => value > 0).sort((a, b) => b[1] - a[1]).map(([key, value]) => (0, import_react39.createElement)(- (0, import_react40.createElement)("div", { className: "bt-us-tip-title" }, tip.title),- (0, import_react40.createElement)("div", { className: "bt-us-tip-total" }, t("{count} tokens", { count: full(tip.total) })),- tip.tip.filter(([, value]) => value > 0).sort((a, b) => b[1] - a[1]).map(([key, value]) => (0, import_react40.createElement)(++ (0, import_react41.createElement)("div", { className: "bt-us-tip-title" }, tip.title),++ (0, import_react41.createElement)("div", { className: "bt-us-tip-total" }, t("{count} tokens", { count: full(tip.total) })),++ tip.tip.filter(([, value]) => value > 0).sort((a, b) => b[1] - a[1]).map(([key, value]) => (0, import_react41.createElement)("div",{ key, className: "bt-us-tip-row" },- (0, import_react39.createElement)("i", { className: "bt-us-dot", style: { background: tipOf.get(key)?.fill } }),- (0, import_react39.createElement)("span", null, tipOf.get(key)?.name),- (0, import_react39.createElement)("b", null, compact(value))- (0, import_react40.createElement)("i", { className: "bt-us-dot", style: { background: tipOf.get(key)?.fill } }),- (0, import_react40.createElement)("span", null, tipOf.get(key)?.name),- (0, import_react40.createElement)("b", null, compact(value))++ (0, import_react41.createElement)("i", { className: "bt-us-dot", style: { background: tipOf.get(key)?.fill } }),++ (0, import_react41.createElement)("span", null, tipOf.get(key)?.name),++ (0, import_react41.createElement)("b", null, compact(value))))) : null),- (0, import_react39.createElement)(- (0, import_react40.createElement)(++ (0, import_react41.createElement)("div",{ className: "bt-us-ticks", "aria-hidden": true },// A preset counts its labels back from now; a picked span forward from its first day.- columns2.map((column, at) => (0, import_react39.createElement)(- columns2.map((column, at) => (0, import_react40.createElement)(++ columns2.map((column, at) => (0, import_react41.createElement)("span",{ key: column.key, "data-now": at === count - 1 && range.ends !== false ? "" : void 0 },(range.from ? at : count - 1 - at) % range.stride === 0 ? column.tick : "")))),- series.length > 1 || series[0]?.pick ? (0, import_react39.createElement)(- series.length > 1 || series[0]?.pick ? (0, import_react40.createElement)(++ series.length > 1 || series[0]?.pick ? (0, import_react41.createElement)("div",{ className: "bt-us-legend" },- series.map((entry) => (0, import_react39.createElement)(entry.pick ? "button" : "span", {- series.map((entry) => (0, import_react40.createElement)(entry.pick ? "button" : "span", {++ series.map((entry) => (0, import_react41.createElement)(entry.pick ? "button" : "span", {key: entry.key,className: "bt-us-key",...entry.pick ? { type: "button", onClick: () => onPick(entry.pick) } : {}- }, (0, import_react39.createElement)("i", { className: "bt-us-dot", style: { background: entry.fill } }), entry.name))- }, (0, import_react40.createElement)("i", { className: "bt-us-dot", style: { background: entry.fill } }), entry.name))++ }, (0, import_react41.createElement)("i", { className: "bt-us-dot", style: { background: entry.fill } }), entry.name))) : null);}function Row2({ kind, glyph, name, sub, sum, whole, fill: fill2, index, onClick }) {const width = whole > 0 ? Math.max(sum.total > 0 ? 2 : 0, sum.total / whole * 100) : 0;- return (0, import_react39.createElement)(- return (0, import_react40.createElement)(++ return (0, import_react41.createElement)(onClick ? "button" : "div",{className: "bt-us-row",@@@ -15524,69 -15986,69 +16336,69 @@@title: t("{tokens} tokens · {calls} calls", { tokens: full(sum.total), calls: full(sum.calls) }),...onClick ? { type: "button", onClick } : {}},- glyph ? (0, import_react39.createElement)("span", { className: "bt-us-row-glyph" }, glyph) : null,- (0, import_react39.createElement)(- glyph ? (0, import_react40.createElement)("span", { className: "bt-us-row-glyph" }, glyph) : null,- (0, import_react40.createElement)(++ glyph ? (0, import_react41.createElement)("span", { className: "bt-us-row-glyph" }, glyph) : null,++ (0, import_react41.createElement)("span",{ className: "bt-us-row-body" },- (0, import_react39.createElement)(- (0, import_react40.createElement)(++ (0, import_react41.createElement)("span",{ className: "bt-us-row-line" },- (0, import_react39.createElement)("span", { className: "bt-us-row-name" }, name),- sub ? (0, import_react39.createElement)("span", { className: "bt-us-row-sub" }, sub) : null- (0, import_react40.createElement)("span", { className: "bt-us-row-name" }, name),- sub ? (0, import_react40.createElement)("span", { className: "bt-us-row-sub" }, sub) : null++ (0, import_react41.createElement)("span", { className: "bt-us-row-name" }, name),++ sub ? (0, import_react41.createElement)("span", { className: "bt-us-row-sub" }, sub) : null),- (0, import_react39.createElement)("span", { className: "bt-us-track" }, (0, import_react39.createElement)("span", { style: { width: `${width}%`, background: fill2 } }))- (0, import_react40.createElement)("span", { className: "bt-us-track" }, (0, import_react40.createElement)("span", { style: { width: `${width}%`, background: fill2 } }))++ (0, import_react41.createElement)("span", { className: "bt-us-track" }, (0, import_react41.createElement)("span", { style: { width: `${width}%`, background: fill2 } }))),- (0, import_react39.createElement)("span", { className: "bt-us-row-num" }, (0, import_react39.createElement)("b", null, compact(sum.total)), (0, import_react39.createElement)("small", null, `${percent2(sum.total, whole)}%`))- (0, import_react40.createElement)("span", { className: "bt-us-row-num" }, (0, import_react40.createElement)("b", null, compact(sum.total)), (0, import_react40.createElement)("small", null, `${percent2(sum.total, whole)}%`))++ (0, import_react41.createElement)("span", { className: "bt-us-row-num" }, (0, import_react41.createElement)("b", null, compact(sum.total)), (0, import_react41.createElement)("small", null, `${percent2(sum.total, whole)}%`)));}function ListCard({ title, count, index, children }) {- return (0, import_react39.createElement)(- return (0, import_react40.createElement)(++ return (0, import_react41.createElement)("section",{ className: "bt-us-card", style: { "--i": index } },- (0, import_react39.createElement)("div", { className: "bt-us-card-head" }, (0, import_react39.createElement)("h3", null, title, count === void 0 ? null : (0, import_react39.createElement)("span", null, count))),- (0, import_react39.createElement)("div", { className: "bt-us-rows" }, children)- (0, import_react40.createElement)("div", { className: "bt-us-card-head" }, (0, import_react40.createElement)("h3", null, title, count === void 0 ? null : (0, import_react40.createElement)("span", null, count))),- (0, import_react40.createElement)("div", { className: "bt-us-rows" }, children)++ (0, import_react41.createElement)("div", { className: "bt-us-card-head" }, (0, import_react41.createElement)("h3", null, title, count === void 0 ? null : (0, import_react41.createElement)("span", null, count))),++ (0, import_react41.createElement)("div", { className: "bt-us-rows" }, children));}function Profile({ face, share, range }) {const arc = Math.max(0, Math.min(1, share)) * RING;- return (0, import_react39.createElement)(- return (0, import_react40.createElement)(++ return (0, import_react41.createElement)("section",{ className: "bt-us-profile" },- (0, import_react39.createElement)(- (0, import_react40.createElement)(++ (0, import_react41.createElement)("span",{ className: "bt-us-ring" },- (0, import_react39.createElement)(- (0, import_react40.createElement)(++ (0, import_react41.createElement)("svg",{ viewBox: "0 0 96 96", "aria-hidden": true },- face.stops ? (0, import_react39.createElement)("defs", null, (0, import_react39.createElement)(- face.stops ? (0, import_react40.createElement)("defs", null, (0, import_react40.createElement)(++ face.stops ? (0, import_react41.createElement)("defs", null, (0, import_react41.createElement)("linearGradient",{ id: "bt-us-ring-paint", x1: 0, y1: 1, x2: 1, y2: 0 },- face.stops.map(([offset, color]) => (0, import_react39.createElement)("stop", { key: offset, offset, stopColor: color }))- face.stops.map(([offset, color]) => (0, import_react40.createElement)("stop", { key: offset, offset, stopColor: color }))++ face.stops.map(([offset, color]) => (0, import_react41.createElement)("stop", { key: offset, offset, stopColor: color })))) : null,- (0, import_react39.createElement)("circle", { className: "bt-us-ring-track", cx: 48, cy: 48, r: RING_R }),- arc > 0 ? (0, import_react39.createElement)("circle", { className: "bt-us-ring-arc", cx: 48, cy: 48, r: RING_R, style: { stroke: face.stops ? "url(#bt-us-ring-paint)" : face.paint, strokeDasharray: `${arc} ${RING}` } }) : null- (0, import_react40.createElement)("circle", { className: "bt-us-ring-track", cx: 48, cy: 48, r: RING_R }),- arc > 0 ? (0, import_react40.createElement)("circle", { className: "bt-us-ring-arc", cx: 48, cy: 48, r: RING_R, style: { stroke: face.stops ? "url(#bt-us-ring-paint)" : face.paint, strokeDasharray: `${arc} ${RING}` } }) : null++ (0, import_react41.createElement)("circle", { className: "bt-us-ring-track", cx: 48, cy: 48, r: RING_R }),++ arc > 0 ? (0, import_react41.createElement)("circle", { className: "bt-us-ring-arc", cx: 48, cy: 48, r: RING_R, style: { stroke: face.stops ? "url(#bt-us-ring-paint)" : face.paint, strokeDasharray: `${arc} ${RING}` } }) : null),- (0, import_react39.createElement)("span", { className: "bt-us-ring-face" }, face.glyph(64))- (0, import_react40.createElement)("span", { className: "bt-us-ring-face" }, face.glyph(64))++ (0, import_react41.createElement)("span", { className: "bt-us-ring-face" }, face.glyph(64))),- (0, import_react39.createElement)(- (0, import_react40.createElement)(++ (0, import_react41.createElement)("div",{ className: "bt-us-profile-copy" },- (0, import_react39.createElement)("h3", null, face.name),- face.sub ? (0, import_react39.createElement)("span", { className: "bt-us-profile-sub" }, face.sub) : null,- (0, import_react39.createElement)("span", { className: "bt-us-profile-share" }, range.from ? t("{share}% of all usage from {span}", { share: percent2(share, 1), span: spanText(range.from, range.to) }) : t("{share}% of all usage in the last {range}", { share: percent2(share, 1), range: rangeLabel(range.id) }))- (0, import_react40.createElement)("h3", null, face.name),- face.sub ? (0, import_react40.createElement)("span", { className: "bt-us-profile-sub" }, face.sub) : null,- (0, import_react40.createElement)("span", { className: "bt-us-profile-share" }, range.from ? t("{share}% of all usage from {span}", { share: percent2(share, 1), span: spanText(range.from, range.to) }) : t("{share}% of all usage in the last {range}", { share: percent2(share, 1), range: rangeLabel(range.id) }))++ (0, import_react41.createElement)("h3", null, face.name),++ face.sub ? (0, import_react41.createElement)("span", { className: "bt-us-profile-sub" }, face.sub) : null,++ (0, import_react41.createElement)("span", { className: "bt-us-profile-share" }, range.from ? t("{share}% of all usage from {span}", { share: percent2(share, 1), span: spanText(range.from, range.to) }) : t("{share}% of all usage in the last {range}", { share: percent2(share, 1), range: rangeLabel(range.id) }))));}var monthOf = (ms) => Date.UTC(yearOf(ms), new Date(ms).getUTCMonth(), 1);var addMonths = (ms, count) => Date.UTC(yearOf(ms), new Date(ms).getUTCMonth() + count, 1);function SpanPicker({ span, today, oldest, active, near, onPick, onClose }) {- const box = (0, import_react39.useRef)(null);- const box = (0, import_react40.useRef)(null);++ const box = (0, import_react41.useRef)(null);const todayMs = hourMs(today);const thisMonth = monthOf(todayMs);- const [right, setRight] = (0, import_react39.useState)(() => Math.max(addMonths(oldest, 1), monthOf(hourMs(span?.to ?? today))));- const [anchor, setAnchor] = (0, import_react39.useState)(null);- const [hover, setHover] = (0, import_react39.useState)(null);- (0, import_react39.useEffect)(() => {- const [right, setRight] = (0, import_react40.useState)(() => Math.max(addMonths(oldest, 1), monthOf(hourMs(span?.to ?? today))));- const [anchor, setAnchor] = (0, import_react40.useState)(null);- const [hover, setHover] = (0, import_react40.useState)(null);- (0, import_react40.useEffect)(() => {++ const [right, setRight] = (0, import_react41.useState)(() => Math.max(addMonths(oldest, 1), monthOf(hourMs(span?.to ?? today))));++ const [anchor, setAnchor] = (0, import_react41.useState)(null);++ const [hover, setHover] = (0, import_react41.useState)(null);++ (0, import_react41.useEffect)(() => {const onDown = (event) => {if (![box, near].some((ref) => ref.current?.contains(event.target))) onClose();};@@@ -15612,17 -16074,17 +16424,17 @@@const [from, to] = [anchor, key].sort();onPick(from, to);};- const weekdays = (0, import_react39.useMemo)(() => Array.from({ length: 7 }, (_, at) => dates({ weekday: "narrow" }).format(Date.UTC(2024, 0, 1 + at))), []);- const weekdays = (0, import_react40.useMemo)(() => Array.from({ length: 7 }, (_, at) => dates({ weekday: "narrow" }).format(Date.UTC(2024, 0, 1 + at))), []);++ const weekdays = (0, import_react41.useMemo)(() => Array.from({ length: 7 }, (_, at) => dates({ weekday: "narrow" }).format(Date.UTC(2024, 0, 1 + at))), []);const month = (start, side) => {const length = new Date(addMonths(start, 1) - DAY_MS).getUTCDate();const lead = (new Date(start).getUTCDay() + 6) % 7;- const cells = Array.from({ length: lead }, (_, at) => (0, import_react39.createElement)("span", { key: `b${at}` }));- const cells = Array.from({ length: lead }, (_, at) => (0, import_react40.createElement)("span", { key: `b${at}` }));++ const cells = Array.from({ length: lead }, (_, at) => (0, import_react41.createElement)("span", { key: `b${at}` }));for (let day = 1; day <= length; day += 1) {const ms = start + (day - 1) * DAY_MS;const key = dayKey(ms);const weekday = (lead + day - 1) % 7;const flag = (on) => on ? "" : void 0;- cells.push((0, import_react39.createElement)("button", {- cells.push((0, import_react40.createElement)("button", {++ cells.push((0, import_react41.createElement)("button", {key,type: "button",className: "bt-us-day",@@@ -15638,15 -16100,15 +16450,15 @@@"data-has": flag(active.has(key)),onMouseEnter: () => setHover(key),onClick: () => press(key)- }, (0, import_react39.createElement)("b", null, day)));- }, (0, import_react40.createElement)("b", null, day)));++ }, (0, import_react41.createElement)("b", null, day)));}- const nav = side === "left" ? (0, import_react39.createElement)("button", { type: "button", className: "bt-us-month-nav", "data-side": "left", "aria-label": t("Previous month"), disabled: start <= oldest, onClick: () => setRight(addMonths(right, -1)) }, (0, import_react39.createElement)(ChevronLeftIcon)) : (0, import_react39.createElement)("button", { type: "button", className: "bt-us-month-nav", "data-side": "right", "aria-label": t("Next month"), disabled: start >= thisMonth, onClick: () => setRight(addMonths(right, 1)) }, (0, import_react39.createElement)(ChevronRightIcon));- return (0, import_react39.createElement)(- const nav = side === "left" ? (0, import_react40.createElement)("button", { type: "button", className: "bt-us-month-nav", "data-side": "left", "aria-label": t("Previous month"), disabled: start <= oldest, onClick: () => setRight(addMonths(right, -1)) }, (0, import_react40.createElement)(ChevronLeftIcon)) : (0, import_react40.createElement)("button", { type: "button", className: "bt-us-month-nav", "data-side": "right", "aria-label": t("Next month"), disabled: start >= thisMonth, onClick: () => setRight(addMonths(right, 1)) }, (0, import_react40.createElement)(ChevronRightIcon));- return (0, import_react40.createElement)(++ const nav = side === "left" ? (0, import_react41.createElement)("button", { type: "button", className: "bt-us-month-nav", "data-side": "left", "aria-label": t("Previous month"), disabled: start <= oldest, onClick: () => setRight(addMonths(right, -1)) }, (0, import_react41.createElement)(ChevronLeftIcon)) : (0, import_react41.createElement)("button", { type: "button", className: "bt-us-month-nav", "data-side": "right", "aria-label": t("Next month"), disabled: start >= thisMonth, onClick: () => setRight(addMonths(right, 1)) }, (0, import_react41.createElement)(ChevronRightIcon));++ return (0, import_react41.createElement)("div",{ key: start, className: "bt-us-month" },- (0, import_react39.createElement)("div", { className: "bt-us-month-head" }, nav, (0, import_react39.createElement)("span", null, dates({ year: "numeric", month: "long" }).format(start))),- (0, import_react39.createElement)("div", { className: "bt-us-weekdays", "aria-hidden": true }, weekdays.map((name, at) => (0, import_react39.createElement)("span", { key: at }, name))),- (0, import_react39.createElement)("div", { className: "bt-us-days", onMouseLeave: () => setHover(null) }, cells)- (0, import_react40.createElement)("div", { className: "bt-us-month-head" }, nav, (0, import_react40.createElement)("span", null, dates({ year: "numeric", month: "long" }).format(start))),- (0, import_react40.createElement)("div", { className: "bt-us-weekdays", "aria-hidden": true }, weekdays.map((name, at) => (0, import_react40.createElement)("span", { key: at }, name))),- (0, import_react40.createElement)("div", { className: "bt-us-days", onMouseLeave: () => setHover(null) }, cells)++ (0, import_react41.createElement)("div", { className: "bt-us-month-head" }, nav, (0, import_react41.createElement)("span", null, dates({ year: "numeric", month: "long" }).format(start))),++ (0, import_react41.createElement)("div", { className: "bt-us-weekdays", "aria-hidden": true }, weekdays.map((name, at) => (0, import_react41.createElement)("span", { key: at }, name))),++ (0, import_react41.createElement)("div", { className: "bt-us-days", onMouseLeave: () => setHover(null) }, cells));};const shortcuts = [@@@ -15655,30 -16117,30 +16467,30 @@@["year", t("This year"), `${today.slice(0, 4)}-01-01`, today]];const count = low === null ? 0 : Math.round((hourMs(high) - hourMs(low)) / DAY_MS) + 1;- return (0, import_react39.createElement)(- return (0, import_react40.createElement)(++ return (0, import_react41.createElement)("div",{ ref: box, className: "bt-us-pick", role: "dialog", "aria-label": t("Custom range") },- (0, import_react39.createElement)(- (0, import_react40.createElement)(++ (0, import_react41.createElement)("div",{ className: "bt-us-pick-quick" },- shortcuts.map(([id, label, from, to]) => (0, import_react39.createElement)("button", {- shortcuts.map(([id, label, from, to]) => (0, import_react40.createElement)("button", {++ shortcuts.map(([id, label, from, to]) => (0, import_react41.createElement)("button", {key: id,type: "button","aria-pressed": span?.from === from && span?.to === to,onClick: () => onPick(from, to)}, label))),- (0, import_react39.createElement)("div", { className: "bt-us-pick-months" }, month(addMonths(right, -1), "left"), month(right, "right")),- (0, import_react39.createElement)(- (0, import_react40.createElement)("div", { className: "bt-us-pick-months" }, month(addMonths(right, -1), "left"), month(right, "right")),- (0, import_react40.createElement)(++ (0, import_react41.createElement)("div", { className: "bt-us-pick-months" }, month(addMonths(right, -1), "left"), month(right, "right")),++ (0, import_react41.createElement)("div",{ className: "bt-us-pick-foot", role: "status" },- (0, import_react39.createElement)("span", null, anchor ? t("Pick the last day") : t("Pick the first day")),- low === null ? null : (0, import_react39.createElement)("span", null, (0, import_react39.createElement)("b", null, spanText(low, high)), ` · ${daysText(count)}`)- (0, import_react40.createElement)("span", null, anchor ? t("Pick the last day") : t("Pick the first day")),- low === null ? null : (0, import_react40.createElement)("span", null, (0, import_react40.createElement)("b", null, spanText(low, high)), ` · ${daysText(count)}`)++ (0, import_react41.createElement)("span", null, anchor ? t("Pick the last day") : t("Pick the first day")),++ low === null ? null : (0, import_react41.createElement)("span", null, (0, import_react41.createElement)("b", null, spanText(low, high)), ` · ${daysText(count)}`)));}function Heat({ view, keep, paint, index }) {- const [hover, setHover] = (0, import_react39.useState)(null);- const [hover, setHover] = (0, import_react40.useState)(null);++ const [hover, setHover] = (0, import_react41.useState)(null);const today = hourMs(`${view.now.slice(0, 10)} 00`);const first = mondayOf(today) - (HEAT_WEEKS - 1) * 7 * DAY_MS;const from = dayKey(first);@@@ -15694,13 -16156,13 +16506,13 @@@for (let week = 0; week < HEAT_WEEKS; week += 1) {const monday = first + week * 7 * DAY_MS;if (week > 0 && new Date(monday).getUTCMonth() !== new Date(monday - 7 * DAY_MS).getUTCMonth()) {- months.push((0, import_react39.createElement)("span", { key: week, style: { gridColumn: week + 1 } }, dates({ month: "short" }).format(monday)));- months.push((0, import_react40.createElement)("span", { key: week, style: { gridColumn: week + 1 } }, dates({ month: "short" }).format(monday)));++ months.push((0, import_react41.createElement)("span", { key: week, style: { gridColumn: week + 1 } }, dates({ month: "short" }).format(monday)));}for (let day = 0; day < 7; day += 1) {const ms = monday + day * DAY_MS;const value = daily.get(dayKey(ms)) ?? 0;const level = value > 0 ? Math.max(1, Math.ceil(4 * Math.sqrt(value / most))) : 0;- cells.push((0, import_react39.createElement)("span", {- cells.push((0, import_react40.createElement)("span", {++ cells.push((0, import_react41.createElement)("span", {key: ms,className: "bt-us-cell",style: { "--w": week },@@@ -15708,7 -16170,7 +16520,7 @@@"data-future": ms > today ? "" : void 0,"data-today": ms === today ? "" : void 0,onMouseEnter: ms > today ? void 0 : () => setHover({ ms, week, day })- }, level > 0 ? (0, import_react39.createElement)("i", { style: { background: soften(paint, levels[level - 1]) } }) : null));- }, level > 0 ? (0, import_react40.createElement)("i", { style: { background: soften(paint, levels[level - 1]) } }) : null));++ }, level > 0 ? (0, import_react41.createElement)("i", { style: { background: soften(paint, levels[level - 1]) } }) : null));}}const tipSide = hover ? {@@@ -15717,68 -16179,68 +16529,68 @@@} : null;const active = [...daily.values()].filter((value) => value > 0).length;const summary = active === 1 ? t("Active on 1 day in the last year") : t("Active on {count} days in the last year", { count: active });- return (0, import_react39.createElement)(- return (0, import_react40.createElement)(++ return (0, import_react41.createElement)("section",{ className: "bt-us-card bt-us-heat", style: { "--i": index } },- (0, import_react39.createElement)("div", { className: "bt-us-card-head" }, (0, import_react39.createElement)("h3", null, t("Activity")), (0, import_react39.createElement)("span", { className: "bt-us-head-note" }, summary)),- (0, import_react39.createElement)("div", { className: "bt-us-heat-months", "aria-hidden": true }, months),- (0, import_react39.createElement)(- (0, import_react40.createElement)("div", { className: "bt-us-card-head" }, (0, import_react40.createElement)("h3", null, t("Activity")), (0, import_react40.createElement)("span", { className: "bt-us-head-note" }, summary)),- (0, import_react40.createElement)("div", { className: "bt-us-heat-months", "aria-hidden": true }, months),- (0, import_react40.createElement)(++ (0, import_react41.createElement)("div", { className: "bt-us-card-head" }, (0, import_react41.createElement)("h3", null, t("Activity")), (0, import_react41.createElement)("span", { className: "bt-us-head-note" }, summary)),++ (0, import_react41.createElement)("div", { className: "bt-us-heat-months", "aria-hidden": true }, months),++ (0, import_react41.createElement)("div",{ className: "bt-us-heat-plot", onMouseLeave: () => setHover(null) },- (0, import_react39.createElement)("div", { className: "bt-us-heat-grid", role: "img", "aria-label": summary }, cells),- hover ? (0, import_react39.createElement)(- (0, import_react40.createElement)("div", { className: "bt-us-heat-grid", role: "img", "aria-label": summary }, cells),- hover ? (0, import_react40.createElement)(++ (0, import_react41.createElement)("div", { className: "bt-us-heat-grid", role: "img", "aria-label": summary }, cells),++ hover ? (0, import_react41.createElement)("div",{ className: "bt-us-tip bt-us-heat-tip", style: tipSide },- (0, import_react39.createElement)("div", { className: "bt-us-tip-title" }, dates({ month: "long", day: "numeric", weekday: "short" }).format(hover.ms)),- (0, import_react39.createElement)("div", { className: "bt-us-tip-total" }, t("{count} tokens", { count: full(daily.get(dayKey(hover.ms)) ?? 0) }))- (0, import_react40.createElement)("div", { className: "bt-us-tip-title" }, dates({ month: "long", day: "numeric", weekday: "short" }).format(hover.ms)),- (0, import_react40.createElement)("div", { className: "bt-us-tip-total" }, t("{count} tokens", { count: full(daily.get(dayKey(hover.ms)) ?? 0) }))++ (0, import_react41.createElement)("div", { className: "bt-us-tip-title" }, dates({ month: "long", day: "numeric", weekday: "short" }).format(hover.ms)),++ (0, import_react41.createElement)("div", { className: "bt-us-tip-total" }, t("{count} tokens", { count: full(daily.get(dayKey(hover.ms)) ?? 0) }))) : null),- (0, import_react39.createElement)(- (0, import_react40.createElement)(++ (0, import_react41.createElement)("div",{ className: "bt-us-heat-scale", "aria-hidden": true },t("Light"),- levels.map((level) => (0, import_react39.createElement)("span", { key: level, className: "bt-us-cell" }, (0, import_react39.createElement)("i", { style: { background: soften(paint, level) } }))),- levels.map((level) => (0, import_react40.createElement)("span", { key: level, className: "bt-us-cell" }, (0, import_react40.createElement)("i", { style: { background: soften(paint, level) } }))),++ levels.map((level) => (0, import_react41.createElement)("span", { key: level, className: "bt-us-cell" }, (0, import_react41.createElement)("i", { style: { background: soften(paint, level) } }))),t("Heavy")));}function Skeleton2() {- return (0, import_react39.createElement)(- return (0, import_react40.createElement)(++ return (0, import_react41.createElement)("div",{ className: "bt-us", "aria-busy": true },- (0, import_react39.createElement)("div", { className: "bt-us-skel", style: { height: 32, width: 320, borderRadius: 999 } }),- (0, import_react39.createElement)(- (0, import_react40.createElement)("div", { className: "bt-us-skel", style: { height: 32, width: 320, borderRadius: 999 } }),- (0, import_react40.createElement)(++ (0, import_react41.createElement)("div", { className: "bt-us-skel", style: { height: 32, width: 320, borderRadius: 999 } }),++ (0, import_react41.createElement)("div",{ className: "bt-us-sheet bt-us-skel-sheet" },- (0, import_react39.createElement)("div", { className: "bt-us-skel", style: { height: 94 } }),- (0, import_react39.createElement)("div", { className: "bt-us-skel", style: { height: 318 } }),- (0, import_react39.createElement)(- (0, import_react40.createElement)("div", { className: "bt-us-skel", style: { height: 94 } }),- (0, import_react40.createElement)("div", { className: "bt-us-skel", style: { height: 318 } }),- (0, import_react40.createElement)(++ (0, import_react41.createElement)("div", { className: "bt-us-skel", style: { height: 94 } }),++ (0, import_react41.createElement)("div", { className: "bt-us-skel", style: { height: 318 } }),++ (0, import_react41.createElement)("div",{ className: "bt-us-pair" },- (0, import_react39.createElement)("div", { className: "bt-us-skel", style: { height: 200 } }),- (0, import_react39.createElement)("div", { className: "bt-us-skel", style: { height: 200 } })- (0, import_react40.createElement)("div", { className: "bt-us-skel", style: { height: 200 } }),- (0, import_react40.createElement)("div", { className: "bt-us-skel", style: { height: 200 } })++ (0, import_react41.createElement)("div", { className: "bt-us-skel", style: { height: 200 } }),++ (0, import_react41.createElement)("div", { className: "bt-us-skel", style: { height: 200 } }))));}var focusOf = (id) => typeof id !== "string" ? null : id.startsWith("model:") ? { kind: "model", key: id.slice("model:".length) } : id.startsWith("owner:") ? { kind: "owner", key: id.slice("owner:".length) } : null;function UsagePage({ roster, actions, focusId }) {- const [view, setView] = (0, import_react39.useState)(null);- const [error, setError] = (0, import_react39.useState)("");- const [rangeId, setRangeId] = (0, import_react39.useState)("7d");- const [span, setSpan] = (0, import_react39.useState)(null);- const [picking, setPicking] = (0, import_react39.useState)(false);- const [by, setBy] = (0, import_react39.useState)("bot");- const tabs = (0, import_react39.useRef)(null);- const [view, setView] = (0, import_react40.useState)(null);- const [error, setError] = (0, import_react40.useState)("");- const [rangeId, setRangeId] = (0, import_react40.useState)("7d");- const [span, setSpan] = (0, import_react40.useState)(null);- const [picking, setPicking] = (0, import_react40.useState)(false);- const [by, setBy] = (0, import_react40.useState)("bot");- const tabs = (0, import_react40.useRef)(null);++ const [view, setView] = (0, import_react41.useState)(null);++ const [error, setError] = (0, import_react41.useState)("");++ const [rangeId, setRangeId] = (0, import_react41.useState)("7d");++ const [span, setSpan] = (0, import_react41.useState)(null);++ const [picking, setPicking] = (0, import_react41.useState)(false);++ const [by, setBy] = (0, import_react41.useState)("bot");++ const tabs = (0, import_react41.useRef)(null);const focus = focusOf(focusId);- (0, import_react39.useEffect)(() => {- (0, import_react40.useEffect)(() => {++ (0, import_react41.useEffect)(() => {let stopped = false;let timer;const load = async () => {try {const value = await actions.usage();if (stopped) return;- (0, import_react39.startTransition)(() => setView(value));- (0, import_react40.startTransition)(() => setView(value));++ (0, import_react41.startTransition)(() => setView(value));setError("");timer = setTimeout(load, value.scanning ? 3e3 : 2e4);} catch (failure) {@@@ -15795,7 -16257,7 +16607,7 @@@}, []);const today = view?.now.slice(0, 10);const range = rangeId === "custom" && span ? { ...spanRange(span.from, span.to), ends: span.to >= today } : RANGES.find((item) => item.id === rangeId);- const shaped = (0, import_react39.useMemo)(() => {- const shaped = (0, import_react40.useMemo)(() => {++ const shaped = (0, import_react41.useMemo)(() => {if (!view) return null;const faces2 = view.owners.map((owner) => ownerFace(owner, roster));const lifetime = /* @__PURE__ */ new Map();@@@ -15804,7 -16266,7 +16616,7 @@@const models2 = view.models.map((model, at) => {const name = model.name || model.model || t("Unknown model");const paint = modelPaint.get(at) ?? "var(--bt-us-rest)";- return { kind: "model", name, sub: model.providerName ?? model.provider, paint, glyph: (size) => (0, import_react39.createElement)(ModelGlyph, { name, paint, size }) };- return { kind: "model", name, sub: model.providerName ?? model.provider, paint, glyph: (size) => (0, import_react40.createElement)(ModelGlyph, { name, paint, size }) };++ return { kind: "model", name, sub: model.providerName ?? model.provider, paint, glyph: (size) => (0, import_react41.createElement)(ModelGlyph, { name, paint, size }) };});const ownerAt2 = focus?.kind === "owner" ? view.owners.findIndex((owner) => owner.key === focus.key) : -1;const modelAt = focus?.kind === "model" ? view.models.findIndex((model) => model.key === focus.key) : -1;@@@ -15852,23 -16314,23 +16664,23 @@@});return { faces: faces2, models: models2, ownerAt: ownerAt2, modelAt, face: face2, keep: keep2, all: all2, part: part2, series: series2, tipSeries: tipSeries2, fillOf: fillOf2, columns: columns3, ranked: ranked2, isBot: isBot2, activeDays: activeDays2, oldest: oldest2 };}, [view, rangeId, span, by, focusId, roster]);- const root = (0, import_react39.useRef)(null);- (0, import_react39.useEffect)(() => {- const root = (0, import_react40.useRef)(null);- (0, import_react40.useEffect)(() => {++ const root = (0, import_react41.useRef)(null);++ (0, import_react41.useEffect)(() => {root.current?.closest(".bt-settings-scroll")?.scrollTo?.({ top: 0 });}, [focusId]);if (!view) {- return error ? (0, import_react39.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : (0, import_react39.createElement)(Skeleton2);- return error ? (0, import_react40.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : (0, import_react40.createElement)(Skeleton2);++ return error ? (0, import_react41.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : (0, import_react41.createElement)(Skeleton2);}if (view.rows.length === 0) {- return (0, import_react39.createElement)(- return (0, import_react40.createElement)(++ return (0, import_react41.createElement)("div",{ className: "bt-us" },- (0, import_react39.createElement)(- (0, import_react40.createElement)(++ (0, import_react41.createElement)("div",{ className: "bt-us-empty" },- (0, import_react39.createElement)(BotMark, { look: MAIN_LOOK, size: 56, live: true }),- (0, import_react39.createElement)("b", null, view.scanning ? t("Reading your chats…") : t("No usage yet.")),- (0, import_react39.createElement)("span", null, t("Token usage shows up here after a model is called."))- (0, import_react40.createElement)(BotMark, { look: MAIN_LOOK, size: 56, live: true }),- (0, import_react40.createElement)("b", null, view.scanning ? t("Reading your chats…") : t("No usage yet.")),- (0, import_react40.createElement)("span", null, t("Token usage shows up here after a model is called."))++ (0, import_react41.createElement)(BotMark, { look: MAIN_LOOK, size: 56, live: true }),++ (0, import_react41.createElement)("b", null, view.scanning ? t("Reading your chats…") : t("No usage yet.")),++ (0, import_react41.createElement)("span", null, t("Token usage shows up here after a model is called."))));}@@@ -15893,7 -16355,7 +16705,7 @@@["custom", rangeId === "custom" && span ? spanText(span.from, span.to) : t("Custom"), CalendarIcon]];const whole = part.total.total;- const ownerRow = ([at, sum], index, total = whole) => (0, import_react39.createElement)(Row2, {- const ownerRow = ([at, sum], index, total = whole) => (0, import_react40.createElement)(Row2, {++ const ownerRow = ([at, sum], index, total = whole) => (0, import_react41.createElement)(Row2, {key: `o${at}`,kind: faces[at].kind,glyph: faces[at].glyph(32),@@@ -15905,7 -16367,7 +16717,7 @@@fill: face ? soften(face.paint, 0.8) : fillOf.get(`o${at}`) ?? soften(faces[at].paint),onClick: () => pick2({ kind: "owner", key: view.owners[at].key })});- const modelRow = ([at, sum], index) => (0, import_react39.createElement)(Row2, {- const modelRow = ([at, sum], index) => (0, import_react40.createElement)(Row2, {++ const modelRow = ([at, sum], index) => (0, import_react41.createElement)(Row2, {key: `m${at}`,kind: "model",glyph: models[at].glyph(32),@@@ -15917,30 -16379,30 +16729,30 @@@fill: face ? soften(face.paint, 0.8) : fillOf.get(`m${at}`) ?? soften(models[at].paint),onClick: () => pick2({ kind: "model", key: view.models[at].key })});- const nothing = (0, import_react39.createElement)("div", { className: "bt-us-none" }, t("Nothing in this range."));- const nothing = (0, import_react40.createElement)("div", { className: "bt-us-none" }, t("Nothing in this range."));++ const nothing = (0, import_react41.createElement)("div", { className: "bt-us-none" }, t("Nothing in this range."));let body;if (face) {const kinds = ranked(part.kinds);const usedModels = ranked(part.models);const owners = ranked(part.owners);body = [- (0, import_react39.createElement)(Profile, { key: "profile", face, range, share: all.total.total > 0 ? whole / all.total.total : 0 }),- (0, import_react39.createElement)(- (0, import_react40.createElement)(Profile, { key: "profile", face, range, share: all.total.total > 0 ? whole / all.total.total : 0 }),- (0, import_react40.createElement)(++ (0, import_react41.createElement)(Profile, { key: "profile", face, range, share: all.total.total > 0 ? whole / all.total.total : 0 }),++ (0, import_react41.createElement)("div",{ key: "sheet", className: "bt-us-sheet" },- (0, import_react39.createElement)(Stats, { key: "stats", range, total: part.total, previous: part.previous }),- (0, import_react39.createElement)(Chart, { key: "chart", range, columns: columns2, series, tipSeries, onPick: pick2 }),- (0, import_react39.createElement)(- (0, import_react40.createElement)(Stats, { key: "stats", range, total: part.total, previous: part.previous }),- (0, import_react40.createElement)(Chart, { key: "chart", range, columns: columns2, series, tipSeries, onPick: pick2 }),- (0, import_react40.createElement)(++ (0, import_react41.createElement)(Stats, { key: "stats", range, total: part.total, previous: part.previous }),++ (0, import_react41.createElement)(Chart, { key: "chart", range, columns: columns2, series, tipSeries, onPick: pick2 }),++ (0, import_react41.createElement)("div",{ key: "pair", className: "bt-us-pair" },- ownerAt >= 0 ? (0, import_react39.createElement)(ListCard, { title: t("Models"), count: usedModels.length, index: 2 }, usedModels.length > 0 ? usedModels.map(modelRow) : nothing) : (0, import_react39.createElement)(ListCard, { title: t("Who used it"), count: owners.length, index: 2 }, owners.length > 0 ? owners.map((entry, index) => ownerRow(entry, index)) : nothing),- (0, import_react39.createElement)(- ownerAt >= 0 ? (0, import_react40.createElement)(ListCard, { title: t("Models"), count: usedModels.length, index: 2 }, usedModels.length > 0 ? usedModels.map(modelRow) : nothing) : (0, import_react40.createElement)(ListCard, { title: t("Who used it"), count: owners.length, index: 2 }, owners.length > 0 ? owners.map((entry, index) => ownerRow(entry, index)) : nothing),- (0, import_react40.createElement)(++ ownerAt >= 0 ? (0, import_react41.createElement)(ListCard, { title: t("Models"), count: usedModels.length, index: 2 }, usedModels.length > 0 ? usedModels.map(modelRow) : nothing) : (0, import_react41.createElement)(ListCard, { title: t("Who used it"), count: owners.length, index: 2 }, owners.length > 0 ? owners.map((entry, index) => ownerRow(entry, index)) : nothing),++ (0, import_react41.createElement)(ListCard,{ title: t("What for"), index: 3 },- kinds.length > 0 ? kinds.map(([at, sum], index) => (0, import_react39.createElement)(Row2, { key: at, name: kindLabel(view.kinds[at], ownerAt >= 0 && isBot(ownerAt)), sum, whole, index, fill: soften(face.paint, 0.8) })) : nothing- kinds.length > 0 ? kinds.map(([at, sum], index) => (0, import_react40.createElement)(Row2, { key: at, name: kindLabel(view.kinds[at], ownerAt >= 0 && isBot(ownerAt)), sum, whole, index, fill: soften(face.paint, 0.8) })) : nothing++ kinds.length > 0 ? kinds.map(([at, sum], index) => (0, import_react41.createElement)(Row2, { key: at, name: kindLabel(view.kinds[at], ownerAt >= 0 && isBot(ownerAt)), sum, whole, index, fill: soften(face.paint, 0.8) })) : nothing)),- (0, import_react39.createElement)(Heat, { key: "heat", view, keep, paint: face.paint, index: 4 })- (0, import_react40.createElement)(Heat, { key: "heat", view, keep, paint: face.paint, index: 4 })++ (0, import_react41.createElement)(Heat, { key: "heat", view, keep, paint: face.paint, index: 4 }))];} else {@@@ -15949,39 -16411,39 +16761,39 @@@const rest = owners.filter(([at]) => !isBot(at));const usedModels = ranked(all.models);body = [- (0, import_react39.createElement)(- (0, import_react40.createElement)(++ (0, import_react41.createElement)("div",{ key: "sheet", className: "bt-us-sheet" },- (0, import_react39.createElement)(Stats, { key: "stats", range, total: all.total, previous: all.previous }),- (0, import_react39.createElement)(Chart, { key: "chart", range, columns: columns2, series, tipSeries, by, onBy: setBy, onPick: pick2 }),- (0, import_react39.createElement)(- (0, import_react40.createElement)(Stats, { key: "stats", range, total: all.total, previous: all.previous }),- (0, import_react40.createElement)(Chart, { key: "chart", range, columns: columns2, series, tipSeries, by, onBy: setBy, onPick: pick2 }),- (0, import_react40.createElement)(++ (0, import_react41.createElement)(Stats, { key: "stats", range, total: all.total, previous: all.previous }),++ (0, import_react41.createElement)(Chart, { key: "chart", range, columns: columns2, series, tipSeries, by, onBy: setBy, onPick: pick2 }),++ (0, import_react41.createElement)("div",{ key: "pair", className: "bt-us-pair" },- (0, import_react39.createElement)(- (0, import_react40.createElement)(++ (0, import_react41.createElement)(ListCard,{ title: t("Bots"), count: bots.length, index: 2 },owners.length > 0 ? null : nothing,bots.map((entry, index) => ownerRow(entry, index)),- bots.length > 0 && rest.length > 0 ? (0, import_react39.createElement)("div", { className: "bt-us-split", role: "separator" }) : null,- bots.length > 0 && rest.length > 0 ? (0, import_react40.createElement)("div", { className: "bt-us-split", role: "separator" }) : null,++ bots.length > 0 && rest.length > 0 ? (0, import_react41.createElement)("div", { className: "bt-us-split", role: "separator" }) : null,rest.map((entry, index) => ownerRow(entry, bots.length + index))),- (0, import_react39.createElement)(ListCard, { title: t("Models"), count: usedModels.length, index: 3 }, usedModels.length > 0 ? usedModels.map(modelRow) : nothing)- (0, import_react40.createElement)(ListCard, { title: t("Models"), count: usedModels.length, index: 3 }, usedModels.length > 0 ? usedModels.map(modelRow) : nothing)++ (0, import_react41.createElement)(ListCard, { title: t("Models"), count: usedModels.length, index: 3 }, usedModels.length > 0 ? usedModels.map(modelRow) : nothing)),- (0, import_react39.createElement)(Heat, { key: "heat", view, keep, paint: "var(--bt-accent)", index: 4 })- (0, import_react40.createElement)(Heat, { key: "heat", view, keep, paint: "var(--bt-accent)", index: 4 })++ (0, import_react41.createElement)(Heat, { key: "heat", view, keep, paint: "var(--bt-accent)", index: 4 }))];}- return (0, import_react39.createElement)(- return (0, import_react40.createElement)(++ return (0, import_react41.createElement)("div",{ ref: root, className: "bt-us", key: focusId ?? "all" },- (0, import_react39.createElement)(- (0, import_react40.createElement)(++ (0, import_react41.createElement)("div",{ className: "bt-us-top" },- (0, import_react39.createElement)(Tabs, { label: t("Time range"), value: rangeId, onChange: chooseRange, options: rangeOptions, boxRef: tabs }),- view.scanning ? (0, import_react39.createElement)("span", { className: "bt-us-note", role: "status" }, t("Still reading older chats; totals may grow.")) : null,- picking ? (0, import_react39.createElement)(SpanPicker, { span, today, oldest, active: activeDays, near: tabs, onPick: pickSpan, onClose: () => setPicking(false) }) : null- (0, import_react40.createElement)(Tabs, { label: t("Time range"), value: rangeId, onChange: chooseRange, options: rangeOptions, boxRef: tabs }),- view.scanning ? (0, import_react40.createElement)("span", { className: "bt-us-note", role: "status" }, t("Still reading older chats; totals may grow.")) : null,- picking ? (0, import_react40.createElement)(SpanPicker, { span, today, oldest, active: activeDays, near: tabs, onPick: pickSpan, onClose: () => setPicking(false) }) : null++ (0, import_react41.createElement)(Tabs, { label: t("Time range"), value: rangeId, onChange: chooseRange, options: rangeOptions, boxRef: tabs }),++ view.scanning ? (0, import_react41.createElement)("span", { className: "bt-us-note", role: "status" }, t("Still reading older chats; totals may grow.")) : null,++ picking ? (0, import_react41.createElement)(SpanPicker, { span, today, oldest, active: activeDays, near: tabs, onPick: pickSpan, onClose: () => setPicking(false) }) : null),- error ? (0, import_react39.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null,- error ? (0, import_react40.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null,++ error ? (0, import_react41.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null,body);}@@@ -16152,12 -16614,12 +16964,12 @@@ button.bt-us-row:hover{background:var(-`;// src/client/connectors.js- var import_react40 = require("react");-var import_react41 = require("react");++var import_react42 = require("react");var TOKEN_URL = "https://github.com/settings/personal-access-tokens/new";- var GitHubMark = () => (0, import_react40.createElement)(-var GitHubMark = () => (0, import_react41.createElement)(++var GitHubMark = () => (0, import_react42.createElement)("svg",{ width: 20, height: 20, viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": true },- (0, import_react40.createElement)("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" })- (0, import_react41.createElement)("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" })++ (0, import_react42.createElement)("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" }));var MARKS = { github: GitHubMark };var ABOUT = { github: () => t("Repositories, issues, and pull requests") };@@@ -16168,10 -16630,10 +16980,10 @@@ function statusText2(connector)return ABOUT[connector.id]?.() ?? "";}function ConnectorRow({ connector, actions }) {- const [form, setForm] = (0, import_react40.useState)(false);- const [token, setToken] = (0, import_react40.useState)("");- const [busy, setBusy] = (0, import_react40.useState)(false);- const [error, setError] = (0, import_react40.useState)(null);- const [form, setForm] = (0, import_react41.useState)(false);- const [token, setToken] = (0, import_react41.useState)("");- const [busy, setBusy] = (0, import_react41.useState)(false);- const [error, setError] = (0, import_react41.useState)(null);++ const [form, setForm] = (0, import_react42.useState)(false);++ const [token, setToken] = (0, import_react42.useState)("");++ const [busy, setBusy] = (0, import_react42.useState)(false);++ const [error, setError] = (0, import_react42.useState)(null);const run2 = (task, after) => {setBusy(true);setError(null);@@@ -16188,58 -16650,58 +17000,58 @@@};const on = connector.state !== "off";const Mark = MARKS[connector.id];- const row = (0, import_react40.useRef)(null);- const row = (0, import_react41.useRef)(null);++ const row = (0, import_react42.useRef)(null);useMorph(row, `${form}:${error !== null}:${connector.state}`);- return (0, import_react40.createElement)(- return (0, import_react41.createElement)(++ return (0, import_react42.createElement)("div",{ ref: row, className: "bt-connector", "data-state": connector.state },- (0, import_react40.createElement)(- (0, import_react41.createElement)(++ (0, import_react42.createElement)("div",{ className: "bt-connector-head" },- (0, import_react40.createElement)("span", { className: "bt-connector-mark" }, Mark ? (0, import_react40.createElement)(Mark) : null),- (0, import_react40.createElement)(- (0, import_react41.createElement)("span", { className: "bt-connector-mark" }, Mark ? (0, import_react41.createElement)(Mark) : null),- (0, import_react41.createElement)(++ (0, import_react42.createElement)("span", { className: "bt-connector-mark" }, Mark ? (0, import_react42.createElement)(Mark) : null),++ (0, import_react42.createElement)("span",{ className: "bt-connector-text" },- (0, import_react40.createElement)("span", { className: "bt-connector-name" }, connector.name),- (0, import_react40.createElement)("span", { className: "bt-connector-status" }, statusText2(connector))- (0, import_react41.createElement)("span", { className: "bt-connector-name" }, connector.name),- (0, import_react41.createElement)("span", { className: "bt-connector-status" }, statusText2(connector))++ (0, import_react42.createElement)("span", { className: "bt-connector-name" }, connector.name),++ (0, import_react42.createElement)("span", { className: "bt-connector-status" }, statusText2(connector))),- (0, import_react40.createElement)(- (0, import_react41.createElement)(++ (0, import_react42.createElement)("span",{ className: "bt-connector-actions" },- connector.state === "error" ? (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => void run2(actions.connectorRetry(connector.id)) }, t("Try again")) : null,- on ? (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => void run2(actions.connectorDisconnect(connector.id)) }, t("Disconnect")) : form ? null : (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setForm(true) }, t("Connect"))- connector.state === "error" ? (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => void run2(actions.connectorRetry(connector.id)) }, t("Try again")) : null,- on ? (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => void run2(actions.connectorDisconnect(connector.id)) }, t("Disconnect")) : form ? null : (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setForm(true) }, t("Connect"))++ connector.state === "error" ? (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => void run2(actions.connectorRetry(connector.id)) }, t("Try again")) : null,++ on ? (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => void run2(actions.connectorDisconnect(connector.id)) }, t("Disconnect")) : form ? null : (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setForm(true) }, t("Connect")))),- !on && form ? (0, import_react40.createElement)(- !on && form ? (0, import_react41.createElement)(++ !on && form ? (0, import_react42.createElement)("div",{ className: "bt-connector-form" },- (0, import_react40.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react40.createElement)(MaskedInput, { value: token, onChange: setToken, onEnter: connect, label: t("GitHub token"), autoFocus: true })),- (0, import_react40.createElement)(- (0, import_react41.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react41.createElement)(MaskedInput, { value: token, onChange: setToken, onEnter: connect, label: t("GitHub token"), autoFocus: true })),- (0, import_react41.createElement)(++ (0, import_react42.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react42.createElement)(MaskedInput, { value: token, onChange: setToken, onEnter: connect, label: t("GitHub token"), autoFocus: true })),++ (0, import_react42.createElement)("div",{ className: "bt-connector-form-row" },- (0, import_react40.createElement)("a", { className: "bt-connector-link", href: TOKEN_URL, target: "_blank", rel: "noopener noreferrer" }, t("Create a token on GitHub")),- (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => {- (0, import_react41.createElement)("a", { className: "bt-connector-link", href: TOKEN_URL, target: "_blank", rel: "noopener noreferrer" }, t("Create a token on GitHub")),- (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => {++ (0, import_react42.createElement)("a", { className: "bt-connector-link", href: TOKEN_URL, target: "_blank", rel: "noopener noreferrer" }, t("Create a token on GitHub")),++ (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => {setForm(false);setToken("");setError(null);} }, t("Cancel")),- (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy || token.trim() === "", onClick: connect }, busy ? t("Connecting…") : t("Connect"))- (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy || token.trim() === "", onClick: connect }, busy ? t("Connecting…") : t("Connect"))++ (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy || token.trim() === "", onClick: connect }, busy ? t("Connecting…") : t("Connect")))) : null,- error ? (0, import_react40.createElement)("div", { className: "bt-connector-error", role: "alert" }, error) : null- error ? (0, import_react41.createElement)("div", { className: "bt-connector-error", role: "alert" }, error) : null++ error ? (0, import_react42.createElement)("div", { className: "bt-connector-error", role: "alert" }, error) : null);}function ConnectorsPage({ roster, actions }) {const list = roster?.connectors ?? [];- return (0, import_react40.createElement)(- return (0, import_react41.createElement)(++ return (0, import_react42.createElement)("section",{ className: "bt-set-section" },- (0, import_react40.createElement)("div", { className: "bt-set-card bt-connectors-card" }, list.length === 0 ? (0, import_react40.createElement)("div", { className: "bt-set-row" }, (0, import_react40.createElement)("span", { className: "bt-set-hint" }, t("No connectors"))) : list.map((connector) => (0, import_react40.createElement)(ConnectorRow, { key: connector.id, connector, actions })))- (0, import_react41.createElement)("div", { className: "bt-set-card bt-connectors-card" }, list.length === 0 ? (0, import_react41.createElement)("div", { className: "bt-set-row" }, (0, import_react41.createElement)("span", { className: "bt-set-hint" }, t("No connectors"))) : list.map((connector) => (0, import_react41.createElement)(ConnectorRow, { key: connector.id, connector, actions })))++ (0, import_react42.createElement)("div", { className: "bt-set-card bt-connectors-card" }, list.length === 0 ? (0, import_react42.createElement)("div", { className: "bt-set-row" }, (0, import_react42.createElement)("span", { className: "bt-set-hint" }, t("No connectors"))) : list.map((connector) => (0, import_react42.createElement)(ConnectorRow, { key: connector.id, connector, actions }))));}// src/client/browser-settings.js- var import_react41 = require("react");-var import_react42 = require("react");++var import_react43 = require("react");var ACTIONS = [["post", "Post"], ["upload", "Upload"], ["download", "Download"], ["delete", "Delete"]];var DURATIONS = [["hour", "1 hour"], ["today", "Today"], ["week", "7 days"], ["permanent", "Permanent"]];var expired = (grant) => Number.isFinite(grant.until) && grant.until <= Date.now();@@@ -16258,13 -16720,13 +17070,13 @@@ function grantKinds(grant)}function BrowserPage({ roster, actions, run: run2, Section, Row: Row3 }) {const bots = roster.bots ?? [];- const [botId, setBotId] = (0, import_react41.useState)(bots[0]?.id ?? "");- const [site, setSite] = (0, import_react41.useState)("");- const [kinds, setKinds] = (0, import_react41.useState)(["post"]);- const [duration, setDuration] = (0, import_react41.useState)("hour");- const [busy, setBusy] = (0, import_react41.useState)(false);- const [botId, setBotId] = (0, import_react42.useState)(bots[0]?.id ?? "");- const [site, setSite] = (0, import_react42.useState)("");- const [kinds, setKinds] = (0, import_react42.useState)(["post"]);- const [duration, setDuration] = (0, import_react42.useState)("hour");- const [busy, setBusy] = (0, import_react42.useState)(false);++ const [botId, setBotId] = (0, import_react43.useState)(bots[0]?.id ?? "");++ const [site, setSite] = (0, import_react43.useState)("");++ const [kinds, setKinds] = (0, import_react43.useState)(["post"]);++ const [duration, setDuration] = (0, import_react43.useState)("hour");++ const [busy, setBusy] = (0, import_react43.useState)(false);const selectedBot = bots.find((bot) => bot.id === botId);- (0, import_react41.useEffect)(() => {- (0, import_react42.useEffect)(() => {++ (0, import_react43.useEffect)(() => {if (!bots.some((bot) => bot.id === botId)) setBotId(bots[0]?.id ?? "");}, [bots, botId]);const grants = bots.flatMap((bot) => (bot.browserGrants ?? []).map((grant, index) => ({@@@ -16297,37 -16759,37 +17109,37 @@@const toggleKind = (kind, checked) => {setKinds((current) => checked ? current.includes(kind) ? current : [...current, kind] : current.filter((value) => value !== kind));};- return (0, import_react41.createElement)(- return (0, import_react42.createElement)(++ return (0, import_react43.createElement)("div",{ className: "bt-browser-settings" },- (0, import_react41.createElement)(- (0, import_react42.createElement)(++ (0, import_react43.createElement)(Section,{ title: t("Browser access") },- (0, import_react41.createElement)("p", { className: "bt-browser-note" }, t("Bots browse, click and fill in forms freely. Posting, uploading, downloading and deleting ask you first unless you allow them here. Payments are always yours: the Bot hands the page to you."))- (0, import_react42.createElement)("p", { className: "bt-browser-note" }, t("Bots browse, click and fill in forms freely. Posting, uploading, downloading and deleting ask you first unless you allow them here. Payments are always yours: the Bot hands the page to you."))++ (0, import_react43.createElement)("p", { className: "bt-browser-note" }, t("Bots browse, click and fill in forms freely. Posting, uploading, downloading and deleting ask you first unless you allow them here. Payments are always yours: the Bot hands the page to you."))),- (0, import_react41.createElement)(- (0, import_react42.createElement)(++ (0, import_react43.createElement)(Section,{ title: t("Allowed actions") },- grants.length === 0 ? (0, import_react41.createElement)(Row3, { label: t("Nothing allowed yet.") }) : grants.map(({ bot, grant, index, expired: expired2 }) => (0, import_react41.createElement)(- grants.length === 0 ? (0, import_react42.createElement)(Row3, { label: t("Nothing allowed yet.") }) : grants.map(({ bot, grant, index, expired: expired2 }) => (0, import_react42.createElement)(++ grants.length === 0 ? (0, import_react43.createElement)(Row3, { label: t("Nothing allowed yet.") }) : grants.map(({ bot, grant, index, expired: expired2 }) => (0, import_react43.createElement)("div",{key: `${bot.id}:${index}`,className: `bt-browser-grant${expired2 ? " bt-browser-grant-expired" : ""}`},- (0, import_react41.createElement)(- (0, import_react42.createElement)(++ (0, import_react43.createElement)("div",{ className: "bt-browser-grant-who" },- (0, import_react41.createElement)(BotAvatar, { bot, size: 28 }),- (0, import_react41.createElement)("span", null, bot.name)- (0, import_react42.createElement)(BotAvatar, { bot, size: 28 }),- (0, import_react42.createElement)("span", null, bot.name)++ (0, import_react43.createElement)(BotAvatar, { bot, size: 28 }),++ (0, import_react43.createElement)("span", null, bot.name)),- (0, import_react41.createElement)(- (0, import_react42.createElement)(++ (0, import_react43.createElement)("div",{ className: "bt-browser-grant-meta" },- (0, import_react41.createElement)("span", { className: "bt-browser-grant-site" }, grant.site === "*" ? t("All sites") : grant.site),- (0, import_react41.createElement)("div", { className: "bt-browser-grant-kinds" }, grantKinds(grant).map((label) => (0, import_react41.createElement)("span", { key: label, className: "bt-chip" }, label))),- (0, import_react41.createElement)("span", { className: "bt-set-hint" }, grantTime(grant))- (0, import_react42.createElement)("span", { className: "bt-browser-grant-site" }, grant.site === "*" ? t("All sites") : grant.site),- (0, import_react42.createElement)("div", { className: "bt-browser-grant-kinds" }, grantKinds(grant).map((label) => (0, import_react42.createElement)("span", { key: label, className: "bt-chip" }, label))),- (0, import_react42.createElement)("span", { className: "bt-set-hint" }, grantTime(grant))++ (0, import_react43.createElement)("span", { className: "bt-browser-grant-site" }, grant.site === "*" ? t("All sites") : grant.site),++ (0, import_react43.createElement)("div", { className: "bt-browser-grant-kinds" }, grantKinds(grant).map((label) => (0, import_react43.createElement)("span", { key: label, className: "bt-chip" }, label))),++ (0, import_react43.createElement)("span", { className: "bt-set-hint" }, grantTime(grant))),- (0, import_react41.createElement)("button", {- (0, import_react42.createElement)("button", {++ (0, import_react43.createElement)("button", {type: "button",className: "bt-soft bt-soft-sm",onClick: () => remove(bot, index),@@@ -16335,25 -16797,25 +17147,25 @@@}, t("Remove grant"))))),- (0, import_react41.createElement)(- (0, import_react42.createElement)(++ (0, import_react43.createElement)(Section,{ title: t("Allow an action") },- (0, import_react41.createElement)(- (0, import_react42.createElement)(++ (0, import_react43.createElement)("form",{ className: "bt-browser-form", onSubmit: add },- (0, import_react41.createElement)(- (0, import_react42.createElement)(++ (0, import_react43.createElement)(Row3,{ label: t("Bot") },- (0, import_react41.createElement)(- (0, import_react42.createElement)(++ (0, import_react43.createElement)("select",{ className: "bt-select", value: botId, onChange: (event) => setBotId(event.target.value), disabled: bots.length === 0 },- bots.map((bot) => (0, import_react41.createElement)("option", { key: bot.id, value: bot.id }, bot.name))- bots.map((bot) => (0, import_react42.createElement)("option", { key: bot.id, value: bot.id }, bot.name))++ bots.map((bot) => (0, import_react43.createElement)("option", { key: bot.id, value: bot.id }, bot.name)))),- (0, import_react41.createElement)(- (0, import_react42.createElement)(++ (0, import_react43.createElement)(Row3,{ label: t("Site") },- (0, import_react41.createElement)("input", {- (0, import_react42.createElement)("input", {++ (0, import_react43.createElement)("input", {className: "bt-select bt-browser-site",type: "text",value: site,@@@ -16361,16 -16823,16 +17173,16 @@@onChange: (event) => setSite(event.target.value)})),- (0, import_react41.createElement)(- (0, import_react42.createElement)(++ (0, import_react43.createElement)(Row3,{ label: t("Actions") },- (0, import_react41.createElement)(- (0, import_react42.createElement)(++ (0, import_react43.createElement)("div",{ className: "bt-browser-action-list" },- ACTIONS.map(([kind, label]) => (0, import_react41.createElement)(- ACTIONS.map(([kind, label]) => (0, import_react42.createElement)(++ ACTIONS.map(([kind, label]) => (0, import_react43.createElement)("label",{ key: kind, className: "bt-browser-action-choice" },- (0, import_react41.createElement)("input", {- (0, import_react42.createElement)("input", {++ (0, import_react43.createElement)("input", {type: "checkbox",checked: kinds.includes(kind),onChange: (event) => toggleKind(kind, event.target.checked)@@@ -16379,13 -16841,13 +17191,13 @@@)))),- (0, import_react41.createElement)(- (0, import_react42.createElement)(++ (0, import_react43.createElement)(Row3,{ label: t("Duration") },- (0, import_react41.createElement)(- (0, import_react42.createElement)(++ (0, import_react43.createElement)("div",{ className: "bt-browser-duration", role: "group", "aria-label": t("Duration") },- DURATIONS.map(([key, label]) => (0, import_react41.createElement)("button", {- DURATIONS.map(([key, label]) => (0, import_react42.createElement)("button", {++ DURATIONS.map(([key, label]) => (0, import_react43.createElement)("button", {key,type: "button",className: "bt-browser-duration-choice",@@@ -16394,10 -16856,10 +17206,10 @@@}, t(label))))),- (0, import_react41.createElement)(- (0, import_react42.createElement)(++ (0, import_react43.createElement)("div",{ className: "bt-browser-form-foot" },- (0, import_react41.createElement)("button", {- (0, import_react42.createElement)("button", {++ (0, import_react43.createElement)("button", {type: "submit",className: "bt-soft",disabled: busy || !selectedBot || kinds.length === 0@@@ -16409,12 -16871,12 +17221,12 @@@}// src/client/feedback.js- var import_react42 = require("react");- var FeedbackIcon = () => (0, import_react42.createElement)(-var import_react43 = require("react");-var FeedbackIcon = () => (0, import_react43.createElement)(++var import_react44 = require("react");++var FeedbackIcon = () => (0, import_react44.createElement)("svg",{ width: 15, height: 15, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true },- (0, import_react42.createElement)("path", { d: "M4 4.5h12a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H9l-3.5 3v-3H4a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1z" }),- (0, import_react42.createElement)("path", { d: "M10 7v2.6M10 11.4h.01" })- (0, import_react43.createElement)("path", { d: "M4 4.5h12a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H9l-3.5 3v-3H4a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1z" }),- (0, import_react43.createElement)("path", { d: "M10 7v2.6M10 11.4h.01" })++ (0, import_react44.createElement)("path", { d: "M4 4.5h12a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H9l-3.5 3v-3H4a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1z" }),++ (0, import_react44.createElement)("path", { d: "M10 7v2.6M10 11.4h.01" }));function download(name, text) {const url = URL.createObjectURL(new Blob([text], { type: "text/plain;charset=utf-8" }));@@@ -16452,16 -16914,16 +17264,16 @@@ function issueWindow()};}function FeedbackPage({ actions, run: run2, Section, Row: Row3 }) {- const [what, setWhat] = (0, import_react42.useState)("");- const [report, setReport] = (0, import_react42.useState)(null);- const [preview, setPreview] = (0, import_react42.useState)(false);- const [note, setNote] = (0, import_react42.useState)("");- const [what, setWhat] = (0, import_react43.useState)("");- const [report, setReport] = (0, import_react43.useState)(null);- const [preview, setPreview] = (0, import_react43.useState)(false);- const [note, setNote] = (0, import_react43.useState)("");++ const [what, setWhat] = (0, import_react44.useState)("");++ const [report, setReport] = (0, import_react44.useState)(null);++ const [preview, setPreview] = (0, import_react44.useState)(false);++ const [note, setNote] = (0, import_react44.useState)("");const fetchReport = () => actions.diagnostics({ client: clientFacts(), clientErrors: clientErrors() }).then((next) => {setReport(next);return next;});const load = () => fetchReport().then(() => void 0);- (0, import_react42.useEffect)(() => {- (0, import_react43.useEffect)(() => {++ (0, import_react44.useEffect)(() => {void run2(load());}, []);const copyReport = () => run2(fetchReport().then(async (next) => {@@@ -16469,7 -16931,7 +17281,7 @@@setNote(copied ? t("Copied the diagnostics.") : t("Could not copy. Select the text below and copy it."));if (!copied) setPreview(true);}));- const [issueLink, setIssueLink] = (0, import_react42.useState)(null);- const [issueLink, setIssueLink] = (0, import_react43.useState)(null);++ const [issueLink, setIssueLink] = (0, import_react44.useState)(null);const openIssue = () => {const target = issueWindow();run2(fetchReport().then(async (next) => {@@@ -16495,59 -16957,59 +17307,59 @@@const total = (report?.total ?? 0) + browserErrors.length;const shown = entries2.slice(0, 8);return [- (0, import_react42.createElement)(- (0, import_react43.createElement)(++ (0, import_react44.createElement)(Section,{ key: "report", title: t("Report a problem") },- (0, import_react42.createElement)(- (0, import_react43.createElement)(++ (0, import_react44.createElement)("div",{ className: "bt-set-row bt-set-paste bt-fb-what" },- (0, import_react42.createElement)(- (0, import_react43.createElement)(++ (0, import_react44.createElement)("label",{ className: "bt-set-copy", htmlFor: "bt-fb-what" },- (0, import_react42.createElement)("span", null, t("What happened?")),- (0, import_react42.createElement)("span", { className: "bt-set-hint" }, t("What you did, what you expected, and what happened instead. It goes into the issue."))- (0, import_react43.createElement)("span", null, t("What happened?")),- (0, import_react43.createElement)("span", { className: "bt-set-hint" }, t("What you did, what you expected, and what happened instead. It goes into the issue."))++ (0, import_react44.createElement)("span", null, t("What happened?")),++ (0, import_react44.createElement)("span", { className: "bt-set-hint" }, t("What you did, what you expected, and what happened instead. It goes into the issue."))),- (0, import_react42.createElement)("textarea", { id: "bt-fb-what", className: "bt-input bt-input-area", value: what, maxLength: WHAT_MAX, placeholder: t("For example: I asked Writer in the group chat and it showed an error."), onChange: (event) => setWhat(event.target.value) })- (0, import_react43.createElement)("textarea", { id: "bt-fb-what", className: "bt-input bt-input-area", value: what, maxLength: WHAT_MAX, placeholder: t("For example: I asked Writer in the group chat and it showed an error."), onChange: (event) => setWhat(event.target.value) })++ (0, import_react44.createElement)("textarea", { id: "bt-fb-what", className: "bt-input bt-input-area", value: what, maxLength: WHAT_MAX, placeholder: t("For example: I asked Writer in the group chat and it showed an error."), onChange: (event) => setWhat(event.target.value) })),- (0, import_react42.createElement)(- (0, import_react43.createElement)(++ (0, import_react44.createElement)(Row3,{ label: t("Diagnostics"), hint: t("Versions, system, models, and the latest errors. Saved keys, tokens, and your home folder are hidden.") },- (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setPreview(!preview), "aria-expanded": preview }, preview ? t("Hide") : t("Show")),- (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: copyReport }, t("Copy"))- (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setPreview(!preview), "aria-expanded": preview }, preview ? t("Hide") : t("Show")),- (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: copyReport }, t("Copy"))++ (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setPreview(!preview), "aria-expanded": preview }, preview ? t("Hide") : t("Show")),++ (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: copyReport }, t("Copy"))),- preview ? (0, import_react42.createElement)("div", { className: "bt-set-row bt-fb-preview" }, (0, import_react42.createElement)("pre", { tabIndex: 0, "aria-label": t("Diagnostics") }, report?.markdown || t("Loading…"))) : null,- (0, import_react42.createElement)(- preview ? (0, import_react43.createElement)("div", { className: "bt-set-row bt-fb-preview" }, (0, import_react43.createElement)("pre", { tabIndex: 0, "aria-label": t("Diagnostics") }, report?.markdown || t("Loading…"))) : null,- (0, import_react43.createElement)(++ preview ? (0, import_react44.createElement)("div", { className: "bt-set-row bt-fb-preview" }, (0, import_react44.createElement)("pre", { tabIndex: 0, "aria-label": t("Diagnostics") }, report?.markdown || t("Loading…"))) : null,++ (0, import_react44.createElement)(Row3,{ label: t("GitHub issue"), hint: t("Opens a new issue in the DS Bot repository with all of this filled in. Nothing is sent until you submit it there.") },- (0, import_react42.createElement)("button", { type: "button", className: "bt-fb-primary", onClick: openIssue }, t("Report on GitHub"))- (0, import_react43.createElement)("button", { type: "button", className: "bt-fb-primary", onClick: openIssue }, t("Report on GitHub"))++ (0, import_react44.createElement)("button", { type: "button", className: "bt-fb-primary", onClick: openIssue }, t("Report on GitHub")))),- note ? (0, import_react42.createElement)(- note ? (0, import_react43.createElement)(++ note ? (0, import_react44.createElement)("div",{ key: "note", className: "bt-note bt-fb-note", role: "status" },note,- issueLink ? [" ", (0, import_react42.createElement)("a", { key: "link", href: issueLink, target: "_blank", rel: "noopener noreferrer" }, t("Open the issue"))] : null- issueLink ? [" ", (0, import_react43.createElement)("a", { key: "link", href: issueLink, target: "_blank", rel: "noopener noreferrer" }, t("Open the issue"))] : null++ issueLink ? [" ", (0, import_react44.createElement)("a", { key: "link", href: issueLink, target: "_blank", rel: "noopener noreferrer" }, t("Open the issue"))] : null) : null,- (0, import_react42.createElement)(- (0, import_react43.createElement)(++ (0, import_react44.createElement)(Section,{ key: "errors", title: report ? t("Recent errors · {count}", { count: total }) : t("Recent errors") },- shown.length === 0 ? (0, import_react42.createElement)(Row3, { label: t("No errors recorded."), hint: t("Failed model calls and DS Bot problems show here, newest first.") }) : shown.map((entry, index) => (0, import_react42.createElement)(- shown.length === 0 ? (0, import_react43.createElement)(Row3, { label: t("No errors recorded."), hint: t("Failed model calls and DS Bot problems show here, newest first.") }) : shown.map((entry, index) => (0, import_react43.createElement)(++ shown.length === 0 ? (0, import_react44.createElement)(Row3, { label: t("No errors recorded."), hint: t("Failed model calls and DS Bot problems show here, newest first.") }) : shown.map((entry, index) => (0, import_react44.createElement)("div",{ key: `${entry.time}-${index}`, className: "bt-set-row bt-fb-entry", title: entry.text },- (0, import_react42.createElement)("span", { className: "bt-fb-dot", "data-level": entry.level, "aria-hidden": true }),- (0, import_react42.createElement)(- (0, import_react43.createElement)("span", { className: "bt-fb-dot", "data-level": entry.level, "aria-hidden": true }),- (0, import_react43.createElement)(++ (0, import_react44.createElement)("span", { className: "bt-fb-dot", "data-level": entry.level, "aria-hidden": true }),++ (0, import_react44.createElement)("div",{ className: "bt-set-copy" },- (0, import_react42.createElement)("span", { className: "bt-fb-text" }, entrySummary(entry)),- (0, import_react42.createElement)("span", { className: "bt-set-hint" }, [whenText(entry.time), entry.bot, entry.where, t(SOURCES[entry.source] ?? "DS Bot")].filter(Boolean).join(" · "))- (0, import_react43.createElement)("span", { className: "bt-fb-text" }, entrySummary(entry)),- (0, import_react43.createElement)("span", { className: "bt-set-hint" }, [whenText(entry.time), entry.bot, entry.where, t(SOURCES[entry.source] ?? "DS Bot")].filter(Boolean).join(" · "))++ (0, import_react44.createElement)("span", { className: "bt-fb-text" }, entrySummary(entry)),++ (0, import_react44.createElement)("span", { className: "bt-set-hint" }, [whenText(entry.time), entry.bot, entry.where, t(SOURCES[entry.source] ?? "DS Bot")].filter(Boolean).join(" · "))),- entry.code ? (0, import_react42.createElement)("span", { className: "bt-tag bt-fb-code" }, entry.status ? `${entry.code} ${entry.status}` : entry.code) : null- entry.code ? (0, import_react43.createElement)("span", { className: "bt-tag bt-fb-code" }, entry.status ? `${entry.code} ${entry.status}` : entry.code) : null++ entry.code ? (0, import_react44.createElement)("span", { className: "bt-tag bt-fb-code" }, entry.status ? `${entry.code} ${entry.status}` : entry.code) : null)),- (0, import_react42.createElement)(- (0, import_react43.createElement)(++ (0, import_react44.createElement)(Row3,{ label: t("Error log"), hint: t("Kept on this computer across restarts, up to about 1 MB.") },- (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: downloadLog }, t("Download")),- (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: clearLog, disabled: !report || total === 0 }, t("Clear"))- (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: downloadLog }, t("Download")),- (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: clearLog, disabled: !report || total === 0 }, t("Clear"))++ (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: downloadLog }, t("Download")),++ (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: clearLog, disabled: !report || total === 0 }, t("Clear"))))];@@@ -16555,8 -17017,8 +17367,8 @@@var TOAST_MS = 6e3;function ErrorToast({ useUi, actions }) {const toast = useUi((state) => state.toast);- const [leaving, setLeaving] = (0, import_react42.useState)(false);- (0, import_react42.useEffect)(() => {- const [leaving, setLeaving] = (0, import_react43.useState)(false);- (0, import_react43.useEffect)(() => {++ const [leaving, setLeaving] = (0, import_react44.useState)(false);++ (0, import_react44.useEffect)(() => {if (!toast) return void 0;setLeaving(false);const fade = setTimeout(() => setLeaving(true), TOAST_MS);@@@ -16567,15 -17029,15 +17379,15 @@@};}, [toast?.token]);if (!toast) return null;- return (0, import_react42.createElement)(- return (0, import_react43.createElement)(++ return (0, import_react44.createElement)("div",{ className: "bt-toast", role: "alert", "data-leaving": leaving || void 0 },- (0, import_react42.createElement)("span", { className: "bt-toast-text" }, toast.text),- (0, import_react42.createElement)("button", { type: "button", className: "bt-toast-link", onClick: () => {- (0, import_react43.createElement)("span", { className: "bt-toast-text" }, toast.text),- (0, import_react43.createElement)("button", { type: "button", className: "bt-toast-link", onClick: () => {++ (0, import_react44.createElement)("span", { className: "bt-toast-text" }, toast.text),++ (0, import_react44.createElement)("button", { type: "button", className: "bt-toast-link", onClick: () => {actions.dismissToast(toast.token);actions.openSettings("feedback");} }, t("Details")),- (0, import_react42.createElement)("button", { type: "button", className: "bt-icon-btn bt-toast-close", "aria-label": t("Dismiss"), onClick: () => actions.dismissToast(toast.token) }, (0, import_react42.createElement)(CloseIcon))- (0, import_react43.createElement)("button", { type: "button", className: "bt-icon-btn bt-toast-close", "aria-label": t("Dismiss"), onClick: () => actions.dismissToast(toast.token) }, (0, import_react43.createElement)(CloseIcon))++ (0, import_react44.createElement)("button", { type: "button", className: "bt-icon-btn bt-toast-close", "aria-label": t("Dismiss"), onClick: () => actions.dismissToast(toast.token) }, (0, import_react44.createElement)(CloseIcon)));}var FEEDBACK_CSS = `@@@ -16607,7 -17069,7 +17419,7 @@@`;// src/client/about.js- var import_react43 = require("react");-var import_react44 = require("react");++var import_react45 = require("react");var CHEER_MS = 1800;var starCount = (count) => new Intl.NumberFormat(dateLocale(), { notation: "compact", maximumFractionDigits: 1 }).format(count);function botHint(update) {@@@ -16655,9 -17117,9 +17467,9 @@@ function dshHint(dsh, shown)var linkProps = (href) => ({ className: "bt-soft bt-soft-sm bt-about-link", href, target: "_blank", rel: "noopener noreferrer" });function AboutPage({ useUpdate, actions, run: run2, Section, Row: Row3 }) {const update = useUpdate((value) => value) ?? {};- const [checking, setChecking] = (0, import_react43.useState)(false);- const [stars, setStars] = (0, import_react43.useState)(null);- (0, import_react43.useEffect)(() => {- const [checking, setChecking] = (0, import_react44.useState)(false);- const [stars, setStars] = (0, import_react44.useState)(null);- (0, import_react44.useEffect)(() => {++ const [checking, setChecking] = (0, import_react45.useState)(false);++ const [stars, setStars] = (0, import_react45.useState)(null);++ (0, import_react45.useEffect)(() => {let live = true;actions.repoStars().then((count) => {if (live && Number.isInteger(count)) setStars(count);@@@ -16667,8 -17129,8 +17479,8 @@@live = false;};}, []);- const [cheer, setCheer] = (0, import_react43.useState)(true);- (0, import_react43.useEffect)(() => {- const [cheer, setCheer] = (0, import_react44.useState)(true);- (0, import_react44.useEffect)(() => {++ const [cheer, setCheer] = (0, import_react45.useState)(true);++ (0, import_react45.useEffect)(() => {if (!cheer) return void 0;const timer = setTimeout(() => setCheer(false), CHEER_MS);return () => clearTimeout(timer);@@@ -16683,37 -17145,37 +17495,37 @@@const phase = update.phase ?? "idle";const dsh = update.dsh;const dshPhase = dsh?.phase ?? "idle";- (0, import_react43.useEffect)(() => {- (0, import_react44.useEffect)(() => {++ (0, import_react45.useEffect)(() => {if (phase === "installed" || phase === "updated" || dshPhase === "installed") setCheer(true);}, [phase, dshPhase]);const markState = checking ? "searching" : phase === "installing" || dshPhase === "installing" ? "working" : cheer ? "done" : "idle";const dshNew = showsDshRow(dsh, update.app);const dshShown = dshNew && dsh.available;const ownRow = update.source === "app" ? ownAppRow(update.ownApp) : null;- const ownControl = ownRow?.button === "restart" ? (0, import_react43.createElement)("button", { type: "button", className: "bt-fb-primary", onClick: () => run2(actions.installOwnApp()) }, t("Restart to update")) : ownRow?.button === "check" ? (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.checkOwnApp()) }, t("Check for updates")) : ownRow?.button === "open" ? (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.openOwnApp()) }, t("Download")) : null;- const botControl = ownRow !== null ? ownControl : phase === "installed" || phase === "updated" || update.source === "app" ? null : update.available || phase === "installing" ? (0, import_react43.createElement)(- const ownControl = ownRow?.button === "restart" ? (0, import_react44.createElement)("button", { type: "button", className: "bt-fb-primary", onClick: () => run2(actions.installOwnApp()) }, t("Restart to update")) : ownRow?.button === "check" ? (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.checkOwnApp()) }, t("Check for updates")) : ownRow?.button === "open" ? (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.openOwnApp()) }, t("Download")) : null;- const botControl = ownRow !== null ? ownControl : phase === "installed" || phase === "updated" || update.source === "app" ? null : update.available || phase === "installing" ? (0, import_react44.createElement)(++ const ownControl = ownRow?.button === "restart" ? (0, import_react45.createElement)("button", { type: "button", className: "bt-fb-primary", onClick: () => run2(actions.installOwnApp()) }, t("Restart to update")) : ownRow?.button === "check" ? (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.checkOwnApp()) }, t("Check for updates")) : ownRow?.button === "open" ? (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.openOwnApp()) }, t("Download")) : null;++ const botControl = ownRow !== null ? ownControl : phase === "installed" || phase === "updated" || update.source === "app" ? null : update.available || phase === "installing" ? (0, import_react45.createElement)("button",{ type: "button", className: "bt-fb-primary", disabled: phase === "installing", onClick: () => run2(actions.installUpdate()) },phase === "installing" ? t("Updating…") : phase === "failed" ? t("Try again") : t("Update")- ) : (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: checking || update.enabled === false, onClick: check }, checking ? t("Checking…") : t("Check for updates"));- const dshControl = !dshNew || dshPhase === "installed" ? null : dsh.kind === "app" ? dsh.available ? (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.openAppUpdates(dsh.verified)) }, t("Open updates")) : null : dsh.available || dshPhase !== "idle" ? (0, import_react43.createElement)(- ) : (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: checking || update.enabled === false, onClick: check }, checking ? t("Checking…") : t("Check for updates"));- const dshControl = !dshNew || dshPhase === "installed" ? null : dsh.kind === "app" ? dsh.available ? (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.openAppUpdates(dsh.verified)) }, t("Open updates")) : null : dsh.available || dshPhase !== "idle" ? (0, import_react44.createElement)(++ ) : (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: checking || update.enabled === false, onClick: check }, checking ? t("Checking…") : t("Check for updates"));++ const dshControl = !dshNew || dshPhase === "installed" ? null : dsh.kind === "app" ? dsh.available ? (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.openAppUpdates(dsh.verified)) }, t("Open updates")) : null : dsh.available || dshPhase !== "idle" ? (0, import_react45.createElement)("button",{ type: "button", className: "bt-fb-primary", disabled: dshPhase === "installing", onClick: () => run2(actions.installDshUpdate()) },dshPhase === "installing" ? t("Updating…") : dshPhase === "failed" ? t("Try again") : t("Update")) : null;const repo = update.repoUrl;return [- (0, import_react43.createElement)(- (0, import_react44.createElement)(++ (0, import_react45.createElement)("div",{ key: "hero", className: "bt-about-hero" },- (0, import_react43.createElement)("span", { className: "bt-about-mark" }, (0, import_react43.createElement)(BotMark, { look: MAIN_LOOK, bot: { id: "about" }, size: 52, state: markState, live: true, gaze: true, pokeable: true })),- (0, import_react43.createElement)(- (0, import_react44.createElement)("span", { className: "bt-about-mark" }, (0, import_react44.createElement)(BotMark, { look: MAIN_LOOK, bot: { id: "about" }, size: 52, state: markState, live: true, gaze: true, pokeable: true })),- (0, import_react44.createElement)(++ (0, import_react45.createElement)("span", { className: "bt-about-mark" }, (0, import_react45.createElement)(BotMark, { look: MAIN_LOOK, bot: { id: "about" }, size: 52, state: markState, live: true, gaze: true, pokeable: true })),++ (0, import_react45.createElement)("div",{ className: "bt-about-copy" },- (0, import_react43.createElement)("span", { className: "bt-about-name" }, "DS Bot"),- update.current ? (0, import_react43.createElement)("span", { className: "bt-about-version" }, t("Version {version}", { version: update.current })) : null- (0, import_react44.createElement)("span", { className: "bt-about-name" }, "DS Bot"),- update.current ? (0, import_react44.createElement)("span", { className: "bt-about-version" }, t("Version {version}", { version: update.current })) : null++ (0, import_react45.createElement)("span", { className: "bt-about-name" }, "DS Bot"),++ update.current ? (0, import_react45.createElement)("span", { className: "bt-about-version" }, t("Version {version}", { version: update.current })) : null),- repo ? (0, import_react43.createElement)(- repo ? (0, import_react44.createElement)(++ repo ? (0, import_react45.createElement)("a",{className: "bt-star",@@@ -16723,23 -17185,23 +17535,23 @@@title: t("Star DS Bot on GitHub"),"aria-label": stars === null ? t("Star DS Bot on GitHub") : `${t("Star DS Bot on GitHub")} · ${t("{count} stars", { count: stars })}`},- (0, import_react43.createElement)("span", { className: "bt-star-main" }, (0, import_react43.createElement)("span", { className: "bt-star-icon" }, (0, import_react43.createElement)(StarLineIcon)), "Star"),- stars === null ? null : (0, import_react43.createElement)("span", { className: "bt-star-count" }, starCount(stars))- (0, import_react44.createElement)("span", { className: "bt-star-main" }, (0, import_react44.createElement)("span", { className: "bt-star-icon" }, (0, import_react44.createElement)(StarLineIcon)), "Star"),- stars === null ? null : (0, import_react44.createElement)("span", { className: "bt-star-count" }, starCount(stars))++ (0, import_react45.createElement)("span", { className: "bt-star-main" }, (0, import_react45.createElement)("span", { className: "bt-star-icon" }, (0, import_react45.createElement)(StarLineIcon)), "Star"),++ stars === null ? null : (0, import_react45.createElement)("span", { className: "bt-star-count" }, starCount(stars))) : null),- repo ? (0, import_react43.createElement)("p", { key: "ask", className: "bt-about-ask" }, t("If DS Bot helps you, a star on GitHub helps more people find it.")) : null,- (0, import_react43.createElement)(- repo ? (0, import_react44.createElement)("p", { key: "ask", className: "bt-about-ask" }, t("If DS Bot helps you, a star on GitHub helps more people find it.")) : null,- (0, import_react44.createElement)(++ repo ? (0, import_react45.createElement)("p", { key: "ask", className: "bt-about-ask" }, t("If DS Bot helps you, a star on GitHub helps more people find it.")) : null,++ (0, import_react45.createElement)(Section,{ key: "updates", title: t("Updates") },- (0, import_react43.createElement)(Row3, { label: "DS Bot", hint: ownRow?.hint ?? botHint(update) }, botControl, update.available && update.notesUrl ? (0, import_react43.createElement)("a", linkProps(update.notesUrl), t("What's new")) : null),- dsh?.current ? (0, import_react43.createElement)(Row3, { label: "DeepSeek Harness", hint: dshHint(dsh, dshShown) }, dshControl) : null- (0, import_react44.createElement)(Row3, { label: "DS Bot", hint: ownRow?.hint ?? botHint(update) }, botControl, update.available && update.notesUrl ? (0, import_react44.createElement)("a", linkProps(update.notesUrl), t("What's new")) : null),- dsh?.current ? (0, import_react44.createElement)(Row3, { label: "DeepSeek Harness", hint: dshHint(dsh, dshShown) }, dshControl) : null++ (0, import_react45.createElement)(Row3, { label: "DS Bot", hint: ownRow?.hint ?? botHint(update) }, botControl, update.available && update.notesUrl ? (0, import_react45.createElement)("a", linkProps(update.notesUrl), t("What's new")) : null),++ dsh?.current ? (0, import_react45.createElement)(Row3, { label: "DeepSeek Harness", hint: dshHint(dsh, dshShown) }, dshControl) : null),- (0, import_react43.createElement)(- (0, import_react44.createElement)(++ (0, import_react45.createElement)(Section,{ key: "links", title: t("Links") },- repo ? (0, import_react43.createElement)(Row3, { label: t("Source code"), hint: repo.replace(/^https:\/\//, "") }, (0, import_react43.createElement)("a", linkProps(repo), (0, import_react43.createElement)(GitHubMark), t("Open"))) : null,- update.notesUrl ? (0, import_react43.createElement)(Row3, { label: t("Release notes") }, (0, import_react43.createElement)("a", linkProps(update.notesUrl), t("Open"))) : null,- (0, import_react43.createElement)(Row3, { label: t("Report a problem") }, (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("feedback") }, t("Open")))- repo ? (0, import_react44.createElement)(Row3, { label: t("Source code"), hint: repo.replace(/^https:\/\//, "") }, (0, import_react44.createElement)("a", linkProps(repo), (0, import_react44.createElement)(GitHubMark), t("Open"))) : null,- update.notesUrl ? (0, import_react44.createElement)(Row3, { label: t("Release notes") }, (0, import_react44.createElement)("a", linkProps(update.notesUrl), t("Open"))) : null,- (0, import_react44.createElement)(Row3, { label: t("Report a problem") }, (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("feedback") }, t("Open")))++ repo ? (0, import_react45.createElement)(Row3, { label: t("Source code"), hint: repo.replace(/^https:\/\//, "") }, (0, import_react45.createElement)("a", linkProps(repo), (0, import_react45.createElement)(GitHubMark), t("Open"))) : null,++ update.notesUrl ? (0, import_react45.createElement)(Row3, { label: t("Release notes") }, (0, import_react45.createElement)("a", linkProps(update.notesUrl), t("Open"))) : null,++ (0, import_react45.createElement)(Row3, { label: t("Report a problem") }, (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("feedback") }, t("Open"))))];}@@@ -16772,7 -17234,7 +17584,7 @@@ body:not([data-bt-motion=quiet]) .bt-ab`;// src/client/providers-page.js- var import_react44 = require("react");-var import_react45 = require("react");++var import_react46 = require("react");var PROTOCOL_NAMES = { "openai-completions": "OpenAI Chat Completions", "openai-responses": "OpenAI Responses", "anthropic-messages": "Anthropic Messages" };var ENDPOINT_HINTS = { "anthropic-messages": "https://gateway.example" };var SHOWN_MODELS = 8;@@@ -16780,22 -17242,22 +17592,22 @@@ var translated = (promise) => Promise.rthrow new Error(hostText(failure?.message ?? String(failure)));});function ProvidersPage({ actions, run: run2, Section }) {- const [view, setView] = (0, import_react44.useState)(null);- const [open, setOpen] = (0, import_react44.useState)(null);- const [adding, setAdding] = (0, import_react44.useState)(false);- const [view, setView] = (0, import_react45.useState)(null);- const [open, setOpen] = (0, import_react45.useState)(null);- const [adding, setAdding] = (0, import_react45.useState)(false);++ const [view, setView] = (0, import_react46.useState)(null);++ const [open, setOpen] = (0, import_react46.useState)(null);++ const [adding, setAdding] = (0, import_react46.useState)(false);const apply2 = (promise) => run2(translated(promise).then((next) => {if (next?.providers) setView(next);}));- (0, import_react44.useEffect)(() => {- (0, import_react45.useEffect)(() => {++ (0, import_react46.useEffect)(() => {void apply2(actions.providers());}, []);if (view === null) return null;- if (!view.available) return (0, import_react44.createElement)("p", { className: "bt-set-hint" }, t("This DSH cannot set up model providers."));- if (!view.available) return (0, import_react45.createElement)("p", { className: "bt-set-hint" }, t("This DSH cannot set up model providers."));++ if (!view.available) return (0, import_react46.createElement)("p", { className: "bt-set-hint" }, t("This DSH cannot set up model providers."));return [- (0, import_react44.createElement)(- (0, import_react45.createElement)(++ (0, import_react46.createElement)(Section,{ key: "list", title: t("Model providers · {count}", { count: view.providers.length }) },- view.providers.map((provider) => (0, import_react44.createElement)(ProviderRow, {- view.providers.map((provider) => (0, import_react45.createElement)(ProviderRow, {++ view.providers.map((provider) => (0, import_react46.createElement)(ProviderRow, {key: provider.id,provider,apply: apply2,@@@ -16803,9 -17265,9 +17615,9 @@@open: open === provider.id,onToggle: () => setOpen(open === provider.id ? null : provider.id)})),- adding ? (0, import_react44.createElement)(AddProvider, { key: "add", view, apply: apply2, actions, onDone: () => setAdding(false) }) : null- adding ? (0, import_react45.createElement)(AddProvider, { key: "add", view, apply: apply2, actions, onDone: () => setAdding(false) }) : null++ adding ? (0, import_react46.createElement)(AddProvider, { key: "add", view, apply: apply2, actions, onDone: () => setAdding(false) }) : null),- adding ? null : (0, import_react44.createElement)("div", { key: "add", className: "bt-actions" }, (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setAdding(true) }, t("Add a provider")))- adding ? null : (0, import_react45.createElement)("div", { key: "add", className: "bt-actions" }, (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setAdding(true) }, t("Add a provider")))++ adding ? null : (0, import_react46.createElement)("div", { key: "add", className: "bt-actions" }, (0, import_react46.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setAdding(true) }, t("Add a provider")))];}function keyState(key) {@@@ -16814,58 -17276,58 +17626,58 @@@return key.writable ? ["set", t("Key set")] : ["outside", t("Key set outside DS Bot")];}function ProviderRow({ provider, apply: apply2, actions, open, onToggle }) {- const [confirm, setConfirm] = (0, import_react44.useState)(false);- (0, import_react44.useEffect)(() => {- const [confirm, setConfirm] = (0, import_react45.useState)(false);- (0, import_react45.useEffect)(() => {++ const [confirm, setConfirm] = (0, import_react46.useState)(false);++ (0, import_react46.useEffect)(() => {if (!open) setConfirm(false);}, [open]);const state = keyState(provider.key);const shown = provider.models.slice(0, SHOWN_MODELS);const hint = provider.error ?? (provider.models.length === 0 ? t("No models") : t("{count} models", { count: provider.models.length }));- return (0, import_react44.createElement)(- return (0, import_react45.createElement)(++ return (0, import_react46.createElement)("div",{ className: "bt-secret-item bt-provider", "data-open": open ? "" : void 0 },- (0, import_react44.createElement)(- (0, import_react45.createElement)(++ (0, import_react46.createElement)("button",{ type: "button", className: "bt-set-row bt-secret-summary", "aria-expanded": open, onClick: onToggle },- (0, import_react44.createElement)(- (0, import_react45.createElement)(++ (0, import_react46.createElement)("span",{ className: "bt-set-copy" },- (0, import_react44.createElement)("span", { className: "bt-secret-title" }, provider.name, provider.name !== provider.id ? (0, import_react44.createElement)("span", { className: "bt-provider-id" }, provider.id) : null),- (0, import_react44.createElement)("span", { className: "bt-set-hint", "data-error": provider.error ? "" : void 0 }, hint)- (0, import_react45.createElement)("span", { className: "bt-secret-title" }, provider.name, provider.name !== provider.id ? (0, import_react45.createElement)("span", { className: "bt-provider-id" }, provider.id) : null),- (0, import_react45.createElement)("span", { className: "bt-set-hint", "data-error": provider.error ? "" : void 0 }, hint)++ (0, import_react46.createElement)("span", { className: "bt-secret-title" }, provider.name, provider.name !== provider.id ? (0, import_react46.createElement)("span", { className: "bt-provider-id" }, provider.id) : null),++ (0, import_react46.createElement)("span", { className: "bt-set-hint", "data-error": provider.error ? "" : void 0 }, hint)),- state ? (0, import_react44.createElement)("span", { className: "bt-set-control" }, (0, import_react44.createElement)("span", { className: "bt-provider-state", "data-state": state[0] }, state[1])) : null- state ? (0, import_react45.createElement)("span", { className: "bt-set-control" }, (0, import_react45.createElement)("span", { className: "bt-provider-state", "data-state": state[0] }, state[1])) : null++ state ? (0, import_react46.createElement)("span", { className: "bt-set-control" }, (0, import_react46.createElement)("span", { className: "bt-provider-state", "data-state": state[0] }, state[1])) : null),- open ? (0, import_react44.createElement)(- open ? (0, import_react45.createElement)(++ open ? (0, import_react46.createElement)("div",{ className: "bt-secret-edit" },- provider.key?.writable ? (0, import_react44.createElement)(KeyEditor, { provider, apply: apply2, actions }) : null,- provider.key && !provider.key.writable ? (0, import_react44.createElement)("div", { className: "bt-set-hint" }, t("This key comes from outside DS Bot, such as an environment variable, and cannot be changed here.")) : null,- provider.models.length > 0 ? (0, import_react44.createElement)(- provider.key?.writable ? (0, import_react45.createElement)(KeyEditor, { provider, apply: apply2, actions }) : null,- provider.key && !provider.key.writable ? (0, import_react45.createElement)("div", { className: "bt-set-hint" }, t("This key comes from outside DS Bot, such as an environment variable, and cannot be changed here.")) : null,- provider.models.length > 0 ? (0, import_react45.createElement)(++ provider.key?.writable ? (0, import_react46.createElement)(KeyEditor, { provider, apply: apply2, actions }) : null,++ provider.key && !provider.key.writable ? (0, import_react46.createElement)("div", { className: "bt-set-hint" }, t("This key comes from outside DS Bot, such as an environment variable, and cannot be changed here.")) : null,++ provider.models.length > 0 ? (0, import_react46.createElement)("div",{ className: "bt-secret-edit-block" },- (0, import_react44.createElement)("div", { className: "bt-secret-edit-label" }, t("Models")),- (0, import_react44.createElement)(- (0, import_react45.createElement)("div", { className: "bt-secret-edit-label" }, t("Models")),- (0, import_react45.createElement)(++ (0, import_react46.createElement)("div", { className: "bt-secret-edit-label" }, t("Models")),++ (0, import_react46.createElement)("div",{ className: "bt-provider-models" },- shown.map((model) => (0, import_react44.createElement)("span", { key: model.ref, className: "bt-tag", title: model.ref }, model.name)),- provider.models.length > shown.length ? (0, import_react44.createElement)("span", { className: "bt-set-hint" }, t("and {count} more", { count: provider.models.length - shown.length })) : null- shown.map((model) => (0, import_react45.createElement)("span", { key: model.ref, className: "bt-tag", title: model.ref }, model.name)),- provider.models.length > shown.length ? (0, import_react45.createElement)("span", { className: "bt-set-hint" }, t("and {count} more", { count: provider.models.length - shown.length })) : null++ shown.map((model) => (0, import_react46.createElement)("span", { key: model.ref, className: "bt-tag", title: model.ref }, model.name)),++ provider.models.length > shown.length ? (0, import_react46.createElement)("span", { className: "bt-set-hint" }, t("and {count} more", { count: provider.models.length - shown.length })) : null)) : null,- provider.removable ? (0, import_react44.createElement)(- provider.removable ? (0, import_react45.createElement)(++ provider.removable ? (0, import_react46.createElement)("div",{ className: "bt-secret-row-actions" },confirm ? [- (0, import_react44.createElement)("span", { key: "q", className: "bt-set-hint" }, t("Remove {name}? Bots on its models need another model.", { name: provider.name })),- (0, import_react44.createElement)("button", { key: "no", type: "button", className: "bt-soft bt-soft-sm", onClick: () => setConfirm(false) }, t("Keep")),- (0, import_react44.createElement)("button", { key: "yes", type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => apply2(actions.removeProvider(provider.id)) }, t("Remove"))- ] : (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => setConfirm(true) }, (0, import_react44.createElement)(TrashIcon), t("Remove provider"))- (0, import_react45.createElement)("span", { key: "q", className: "bt-set-hint" }, t("Remove {name}? Bots on its models need another model.", { name: provider.name })),- (0, import_react45.createElement)("button", { key: "no", type: "button", className: "bt-soft bt-soft-sm", onClick: () => setConfirm(false) }, t("Keep")),- (0, import_react45.createElement)("button", { key: "yes", type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => apply2(actions.removeProvider(provider.id)) }, t("Remove"))- ] : (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => setConfirm(true) }, (0, import_react45.createElement)(TrashIcon), t("Remove provider"))++ (0, import_react46.createElement)("span", { key: "q", className: "bt-set-hint" }, t("Remove {name}? Bots on its models need another model.", { name: provider.name })),++ (0, import_react46.createElement)("button", { key: "no", type: "button", className: "bt-soft bt-soft-sm", onClick: () => setConfirm(false) }, t("Keep")),++ (0, import_react46.createElement)("button", { key: "yes", type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => apply2(actions.removeProvider(provider.id)) }, t("Remove"))++ ] : (0, import_react46.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => setConfirm(true) }, (0, import_react46.createElement)(TrashIcon), t("Remove provider"))) : null) : null);}function KeyEditor({ provider, apply: apply2, actions }) {- const [value, setValue] = (0, import_react44.useState)("");- const [saved, setSaved] = (0, import_react44.useState)(false);- const [value, setValue] = (0, import_react45.useState)("");- const [saved, setSaved] = (0, import_react45.useState)(false);++ const [value, setValue] = (0, import_react46.useState)("");++ const [saved, setSaved] = (0, import_react46.useState)(false);const ready = value.trim() !== "";const save = () => {if (!ready) return;@@@ -16881,29 -17343,29 +17693,29 @@@setSaved(false);};const label = t("{provider} API key", { provider: provider.name });- return (0, import_react44.createElement)(- return (0, import_react45.createElement)(++ return (0, import_react46.createElement)("div",{ className: "bt-secret-edit-block" },- (0, import_react44.createElement)("div", { className: "bt-secret-edit-label" }, provider.key.configured ? t("Replace the API key") : t("API key")),- (0, import_react44.createElement)(- (0, import_react45.createElement)("div", { className: "bt-secret-edit-label" }, provider.key.configured ? t("Replace the API key") : t("API key")),- (0, import_react45.createElement)(++ (0, import_react46.createElement)("div", { className: "bt-secret-edit-label" }, provider.key.configured ? t("Replace the API key") : t("API key")),++ (0, import_react46.createElement)("div",{ className: "bt-secret-inline" },- (0, import_react44.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react44.createElement)(KeyIcon), (0, import_react44.createElement)(MaskedInput, { value, onChange: edit, onEnter: save, label })),- (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: save }, t("Save")),- provider.key.configured ? (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => apply2(actions.setProviderKey(provider.id, null)) }, t("Remove key")) : null- (0, import_react45.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react45.createElement)(KeyIcon), (0, import_react45.createElement)(MaskedInput, { value, onChange: edit, onEnter: save, label })),- (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: save }, t("Save")),- provider.key.configured ? (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => apply2(actions.setProviderKey(provider.id, null)) }, t("Remove key")) : null++ (0, import_react46.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react46.createElement)(KeyIcon), (0, import_react46.createElement)(MaskedInput, { value, onChange: edit, onEnter: save, label })),++ (0, import_react46.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: save }, t("Save")),++ provider.key.configured ? (0, import_react46.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => apply2(actions.setProviderKey(provider.id, null)) }, t("Remove key")) : null),- saved ? (0, import_react44.createElement)("div", { className: "bt-set-hint bt-secret-ok", role: "status" }, (0, import_react44.createElement)(CheckIcon), t("Saved.")) : null- saved ? (0, import_react45.createElement)("div", { className: "bt-set-hint bt-secret-ok", role: "status" }, (0, import_react45.createElement)(CheckIcon), t("Saved.")) : null++ saved ? (0, import_react46.createElement)("div", { className: "bt-set-hint bt-secret-ok", role: "status" }, (0, import_react46.createElement)(CheckIcon), t("Saved.")) : null);}function AddProvider({ view, apply: apply2, actions, onDone }) {- const [mode, setMode] = (0, import_react44.useState)(view.addable.length > 0 ? "known" : "custom");- return (0, import_react44.createElement)(- const [mode, setMode] = (0, import_react45.useState)(view.addable.length > 0 ? "known" : "custom");- return (0, import_react45.createElement)(++ const [mode, setMode] = (0, import_react46.useState)(view.addable.length > 0 ? "known" : "custom");++ return (0, import_react46.createElement)("div",{ className: "bt-set-row bt-set-paste bt-provider-add" },- (0, import_react44.createElement)(- (0, import_react45.createElement)(++ (0, import_react46.createElement)(Segmented,{ label: t("Kind of provider"), value: mode },- [["known", t("Known provider")], ["custom", t("Custom API")]].map(([id, label]) => (0, import_react44.createElement)("button", {- [["known", t("Known provider")], ["custom", t("Custom API")]].map(([id, label]) => (0, import_react45.createElement)("button", {++ [["known", t("Known provider")], ["custom", t("Custom API")]].map(([id, label]) => (0, import_react46.createElement)("button", {key: id,type: "button","aria-pressed": mode === id,@@@ -16912,13 -17374,13 +17724,13 @@@}, label))),// Both forms stay mounted, so switching keeps what is typed in the other.- (0, import_react44.createElement)("div", { hidden: mode !== "known" }, (0, import_react44.createElement)(KnownForm, { view, apply: apply2, actions, onDone })),- (0, import_react44.createElement)("div", { hidden: mode !== "custom" }, (0, import_react44.createElement)(CustomForm, { view, apply: apply2, actions, onDone }))- (0, import_react45.createElement)("div", { hidden: mode !== "known" }, (0, import_react45.createElement)(KnownForm, { view, apply: apply2, actions, onDone })),- (0, import_react45.createElement)("div", { hidden: mode !== "custom" }, (0, import_react45.createElement)(CustomForm, { view, apply: apply2, actions, onDone }))++ (0, import_react46.createElement)("div", { hidden: mode !== "known" }, (0, import_react46.createElement)(KnownForm, { view, apply: apply2, actions, onDone })),++ (0, import_react46.createElement)("div", { hidden: mode !== "custom" }, (0, import_react46.createElement)(CustomForm, { view, apply: apply2, actions, onDone })));}function KnownForm({ view, apply: apply2, actions, onDone }) {- const [provider, setProvider] = (0, import_react44.useState)("");- const [key, setKey] = (0, import_react44.useState)("");- const [provider, setProvider] = (0, import_react45.useState)("");- const [key, setKey] = (0, import_react45.useState)("");++ const [provider, setProvider] = (0, import_react46.useState)("");++ const [key, setKey] = (0, import_react46.useState)("");const options = [...view.addable].sort((a, b) => a.name.localeCompare(b.name));const add = () => {if (provider === "") return;@@@ -16926,24 -17388,24 +17738,24 @@@if (ok) onDone();});};- return (0, import_react44.createElement)(- return (0, import_react45.createElement)(++ return (0, import_react46.createElement)("div",{ className: "bt-provider-form" },- (0, import_react44.createElement)(- (0, import_react45.createElement)(++ (0, import_react46.createElement)("select",{ className: "bt-select", "aria-label": t("Provider"), value: provider, onChange: (event) => setProvider(event.target.value) },- (0, import_react44.createElement)("option", { value: "", disabled: true }, t("Choose a provider")),- options.map((option) => (0, import_react44.createElement)("option", { key: option.id, value: option.id }, option.name))- (0, import_react45.createElement)("option", { value: "", disabled: true }, t("Choose a provider")),- options.map((option) => (0, import_react45.createElement)("option", { key: option.id, value: option.id }, option.name))++ (0, import_react46.createElement)("option", { value: "", disabled: true }, t("Choose a provider")),++ options.map((option) => (0, import_react46.createElement)("option", { key: option.id, value: option.id }, option.name))),- (0, import_react44.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react44.createElement)(KeyIcon), (0, import_react44.createElement)(MaskedInput, { value: key, onChange: setKey, onEnter: add, label: t("API key") })),- (0, import_react44.createElement)(FormActions, { onCancel: onDone, onAdd: add, ready: provider !== "" })- (0, import_react45.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react45.createElement)(KeyIcon), (0, import_react45.createElement)(MaskedInput, { value: key, onChange: setKey, onEnter: add, label: t("API key") })),- (0, import_react45.createElement)(FormActions, { onCancel: onDone, onAdd: add, ready: provider !== "" })++ (0, import_react46.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react46.createElement)(KeyIcon), (0, import_react46.createElement)(MaskedInput, { value: key, onChange: setKey, onEnter: add, label: t("API key") })),++ (0, import_react46.createElement)(FormActions, { onCancel: onDone, onAdd: add, ready: provider !== "" }));}function CustomForm({ view, apply: apply2, actions, onDone }) {- const [draft, setDraft] = (0, import_react44.useState)({ provider: "", name: "", baseURL: "", api: view.protocols[0], key: "", typed: "" });- const [found, setFound] = (0, import_react44.useState)(null);- const [picked, setPicked] = (0, import_react44.useState)([]);- const [asking, setAsking] = (0, import_react44.useState)(false);- const [draft, setDraft] = (0, import_react45.useState)({ provider: "", name: "", baseURL: "", api: view.protocols[0], key: "", typed: "" });- const [found, setFound] = (0, import_react45.useState)(null);- const [picked, setPicked] = (0, import_react45.useState)([]);- const [asking, setAsking] = (0, import_react45.useState)(false);++ const [draft, setDraft] = (0, import_react46.useState)({ provider: "", name: "", baseURL: "", api: view.protocols[0], key: "", typed: "" });++ const [found, setFound] = (0, import_react46.useState)(null);++ const [picked, setPicked] = (0, import_react46.useState)([]);++ const [asking, setAsking] = (0, import_react46.useState)(false);const set = (field, value) => setDraft((current) => ({ ...current, [field]: value }));const typed = draft.typed.split(/[\s,]+/).map((id) => id.trim()).filter(Boolean);const models = [...(found ?? []).filter((model) => picked.includes(model.id)), ...typed.filter((id) => !picked.includes(id)).map((id) => ({ id }))];@@@ -16962,7 -17424,7 +17774,7 @@@if (ok) onDone();});};- const input = (field, label, placeholder) => (0, import_react44.createElement)("input", {- const input = (field, label, placeholder) => (0, import_react45.createElement)("input", {++ const input = (field, label, placeholder) => (0, import_react46.createElement)("input", {className: "bt-input","aria-label": label,placeholder,@@@ -16971,55 -17433,55 +17783,55 @@@autoComplete: "off",onChange: (event) => set(field, event.target.value)});- return (0, import_react44.createElement)(- return (0, import_react45.createElement)(++ return (0, import_react46.createElement)("div",{ className: "bt-provider-form" },- (0, import_react44.createElement)(- (0, import_react45.createElement)(++ (0, import_react46.createElement)("div",{ className: "bt-provider-pair" },input("provider", t("Provider ID"), t("Provider ID, e.g. my-gateway")),input("name", t("Name"), t("Name (optional)"))),- (0, import_react44.createElement)(- (0, import_react45.createElement)(++ (0, import_react46.createElement)("div",{ className: "bt-provider-pair" },input("baseURL", t("Endpoint"), ENDPOINT_HINTS[draft.api] ?? "https://gateway.example/v1"),- (0, import_react44.createElement)(- (0, import_react45.createElement)(++ (0, import_react46.createElement)("select",{ className: "bt-select", "aria-label": t("Protocol"), value: draft.api, onChange: (event) => set("api", event.target.value) },- view.protocols.map((api) => (0, import_react44.createElement)("option", { key: api, value: api }, PROTOCOL_NAMES[api] ?? api))- view.protocols.map((api) => (0, import_react45.createElement)("option", { key: api, value: api }, PROTOCOL_NAMES[api] ?? api))++ view.protocols.map((api) => (0, import_react46.createElement)("option", { key: api, value: api }, PROTOCOL_NAMES[api] ?? api)))),- (0, import_react44.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react44.createElement)(KeyIcon), (0, import_react44.createElement)(MaskedInput, { value: draft.key, onChange: (value) => set("key", value), label: t("API key") })),- (0, import_react44.createElement)(- (0, import_react45.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react45.createElement)(KeyIcon), (0, import_react45.createElement)(MaskedInput, { value: draft.key, onChange: (value) => set("key", value), label: t("API key") })),- (0, import_react45.createElement)(++ (0, import_react46.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react46.createElement)(KeyIcon), (0, import_react46.createElement)(MaskedInput, { value: draft.key, onChange: (value) => set("key", value), label: t("API key") })),++ (0, import_react46.createElement)("div",{ className: "bt-secret-edit-block" },- (0, import_react44.createElement)(- (0, import_react45.createElement)(++ (0, import_react46.createElement)("div",{ className: "bt-provider-models-head" },- (0, import_react44.createElement)("span", { className: "bt-secret-edit-label" }, t("Models")),- (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: asking || draft.baseURL.trim() === "", onClick: fetchModels }, asking ? t("Asking…") : t("Fetch models"))- (0, import_react45.createElement)("span", { className: "bt-secret-edit-label" }, t("Models")),- (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: asking || draft.baseURL.trim() === "", onClick: fetchModels }, asking ? t("Asking…") : t("Fetch models"))++ (0, import_react46.createElement)("span", { className: "bt-secret-edit-label" }, t("Models")),++ (0, import_react46.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: asking || draft.baseURL.trim() === "", onClick: fetchModels }, asking ? t("Asking…") : t("Fetch models"))),- found !== null && found.length === 0 ? (0, import_react44.createElement)("div", { className: "bt-set-hint" }, t("The endpoint lists no models. Enter their ids below.")) : null,- found !== null && found.length > 0 ? (0, import_react44.createElement)("div", { className: "bt-secret-bots bt-provider-found" }, found.map((model) => (0, import_react44.createElement)("button", {- found !== null && found.length === 0 ? (0, import_react45.createElement)("div", { className: "bt-set-hint" }, t("The endpoint lists no models. Enter their ids below.")) : null,- found !== null && found.length > 0 ? (0, import_react45.createElement)("div", { className: "bt-secret-bots bt-provider-found" }, found.map((model) => (0, import_react45.createElement)("button", {++ found !== null && found.length === 0 ? (0, import_react46.createElement)("div", { className: "bt-set-hint" }, t("The endpoint lists no models. Enter their ids below.")) : null,++ found !== null && found.length > 0 ? (0, import_react46.createElement)("div", { className: "bt-secret-bots bt-provider-found" }, found.map((model) => (0, import_react46.createElement)("button", {key: model.id,type: "button",className: "bt-secret-bot","aria-pressed": picked.includes(model.id),title: model.name && model.name !== model.id ? model.name : void 0,onClick: () => toggle(model.id)- }, (0, import_react44.createElement)("code", null, model.id), picked.includes(model.id) ? (0, import_react44.createElement)(CheckIcon) : null))) : null,- }, (0, import_react45.createElement)("code", null, model.id), picked.includes(model.id) ? (0, import_react45.createElement)(CheckIcon) : null))) : null,++ }, (0, import_react46.createElement)("code", null, model.id), picked.includes(model.id) ? (0, import_react46.createElement)(CheckIcon) : null))) : null,input("typed", t("Model ids"), t("Model ids, separated by commas"))),- (0, import_react44.createElement)(FormActions, { onCancel: onDone, onAdd: add, ready })- (0, import_react45.createElement)(FormActions, { onCancel: onDone, onAdd: add, ready })++ (0, import_react46.createElement)(FormActions, { onCancel: onDone, onAdd: add, ready }));}function FormActions({ onCancel, onAdd, ready }) {- return (0, import_react44.createElement)(- return (0, import_react45.createElement)(++ return (0, import_react46.createElement)("div",{ className: "bt-secret-row-actions" },- (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),- (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: onAdd }, t("Add"))- (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),- (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: onAdd }, t("Add"))++ (0, import_react46.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),++ (0, import_react46.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: onAdd }, t("Add")));}var PROVIDERS_CSS = `@@@ -17049,24 -17511,24 +17861,24 @@@`;// src/client/settings.js- var import_react45 = require("react");-var import_react46 = require("react");++var import_react47 = require("react");var capitalize2 = (word) => word[0].toUpperCase() + word.slice(1);var SETTINGS_PAGES = [["general", "General"], ["models", "Models"], ["bots", "Bots"], ["groups", "Group chats"], ["connectors", "Connectors"], ["capabilities", "Capabilities"], ["browser", "Browser"], ["schedules", "Scheduled tasks"], ["usage", "Usage"], ["secrets", "Secrets"], ["feedback", "Feedback"], ["about", "About DS Bot"]];var PAGE_ICONS = { ...SETTINGS_ICONS, models: SlidersIcon, connectors: ConnectorIcon, capabilities: PlugIcon, browser: ConnectorIcon, schedules: ClockIcon, secrets: KeyIcon, feedback: FeedbackIcon, about: InfoIcon };function SetSection({ title, className = "", children }) {- return (0, import_react45.createElement)("section", { className: `bt-set-section ${className}`.trim() }, (0, import_react45.createElement)("h3", null, title), (0, import_react45.createElement)("div", { className: "bt-set-card" }, children));- return (0, import_react46.createElement)("section", { className: `bt-set-section ${className}`.trim() }, (0, import_react46.createElement)("h3", null, title), (0, import_react46.createElement)("div", { className: "bt-set-card" }, children));++ return (0, import_react47.createElement)("section", { className: `bt-set-section ${className}`.trim() }, (0, import_react47.createElement)("h3", null, title), (0, import_react47.createElement)("div", { className: "bt-set-card" }, children));}function SetRow({ label, hint, children, className = "" }) {- return (0, import_react45.createElement)(- return (0, import_react46.createElement)(++ return (0, import_react47.createElement)("div",{ className: `bt-set-row ${className}`.trim() },- (0, import_react45.createElement)("div", { className: "bt-set-copy" }, (0, import_react45.createElement)("span", null, label), hint ? (0, import_react45.createElement)("span", { className: "bt-set-hint" }, hint) : null),- children ? (0, import_react45.createElement)("div", { className: "bt-set-control" }, children) : null- (0, import_react46.createElement)("div", { className: "bt-set-copy" }, (0, import_react46.createElement)("span", null, label), hint ? (0, import_react46.createElement)("span", { className: "bt-set-hint" }, hint) : null),- children ? (0, import_react46.createElement)("div", { className: "bt-set-control" }, children) : null++ (0, import_react47.createElement)("div", { className: "bt-set-copy" }, (0, import_react47.createElement)("span", null, label), hint ? (0, import_react47.createElement)("span", { className: "bt-set-hint" }, hint) : null),++ children ? (0, import_react47.createElement)("div", { className: "bt-set-control" }, children) : null);}var LAYOUTS = [["bubble", "Bubble"], ["flat", "Flat"]];function Choice({ label, value, options, pick: pick2 }) {- return (0, import_react45.createElement)(Segmented, { label, value, className: "bt-look-seg" }, options.map(([id, text]) => (0, import_react45.createElement)("button", {- return (0, import_react46.createElement)(Segmented, { label, value, className: "bt-look-seg" }, options.map(([id, text]) => (0, import_react46.createElement)("button", {++ return (0, import_react47.createElement)(Segmented, { label, value, className: "bt-look-seg" }, options.map(([id, text]) => (0, import_react47.createElement)("button", {key: id,type: "button","aria-pressed": value === id,@@@ -17076,12 -17538,12 +17888,12 @@@}, t(text))));}function WidthSlider({ label, value, save }) {- const [width, setWidth] = (0, import_react45.useState)(value);- const pending = (0, import_react45.useRef)(null);- const timer = (0, import_react45.useRef)(0);- const saveRef = (0, import_react45.useRef)(save);- const [width, setWidth] = (0, import_react46.useState)(value);- const pending = (0, import_react46.useRef)(null);- const timer = (0, import_react46.useRef)(0);- const saveRef = (0, import_react46.useRef)(save);++ const [width, setWidth] = (0, import_react47.useState)(value);++ const pending = (0, import_react47.useRef)(null);++ const timer = (0, import_react47.useRef)(0);++ const saveRef = (0, import_react47.useRef)(save);saveRef.current = save;- (0, import_react45.useEffect)(() => {- (0, import_react46.useEffect)(() => {++ (0, import_react47.useEffect)(() => {if (pending.current === null) setWidth(value);}, [value]);const flush = () => {@@@ -17089,7 -17551,7 +17901,7 @@@pending.current = null;if (next !== null) saveRef.current(next);};- (0, import_react45.useEffect)(() => () => {- (0, import_react46.useEffect)(() => () => {++ (0, import_react47.useEffect)(() => () => {clearTimeout(timer.current);flush();}, []);@@@ -17100,46 -17562,46 +17912,46 @@@timer.current = setTimeout(flush, 350);};const { min, max, step } = MESSAGE_WIDTH;- return (0, import_react45.createElement)(- return (0, import_react46.createElement)(++ return (0, import_react47.createElement)("div",{ className: "bt-range", style: { "--bt-fill": `${(width - min) / (max - min) * 100}%` } },- (0, import_react45.createElement)("input", { type: "range", min, max, step, value: width, "aria-label": label, "aria-valuetext": `${width}%`, onChange: (event) => pick2(Number(event.target.value)) }),- (0, import_react45.createElement)("output", null, `${width}%`)- (0, import_react46.createElement)("input", { type: "range", min, max, step, value: width, "aria-label": label, "aria-valuetext": `${width}%`, onChange: (event) => pick2(Number(event.target.value)) }),- (0, import_react46.createElement)("output", null, `${width}%`)++ (0, import_react47.createElement)("input", { type: "range", min, max, step, value: width, "aria-label": label, "aria-valuetext": `${width}%`, onChange: (event) => pick2(Number(event.target.value)) }),++ (0, import_react47.createElement)("output", null, `${width}%`));}function GeneralPage({ roster, actions, run: run2 }) {const prefs = roster.prefs ?? {};const themes = allThemes();const current = themes[prefs.theme] ? prefs.theme : "deepseek";- const [custom, setCustom] = (0, import_react45.useState)(prefs.accent ?? "#4d6bfe");- const timer = (0, import_react45.useRef)(0);- (0, import_react45.useEffect)(() => () => clearTimeout(timer.current), []);- const [custom, setCustom] = (0, import_react46.useState)(prefs.accent ?? "#4d6bfe");- const timer = (0, import_react46.useRef)(0);- (0, import_react46.useEffect)(() => () => clearTimeout(timer.current), []);++ const [custom, setCustom] = (0, import_react47.useState)(prefs.accent ?? "#4d6bfe");++ const timer = (0, import_react47.useRef)(0);++ (0, import_react47.useEffect)(() => () => clearTimeout(timer.current), []);const pickCustom = (value) => {setCustom(value);clearTimeout(timer.current);timer.current = setTimeout(() => run2(actions.setPrefs({ accent: value })), 350);};return [- (0, import_react45.createElement)(- (0, import_react46.createElement)(++ (0, import_react47.createElement)(SetSection,{ key: "look", title: t("Appearance") },- (0, import_react45.createElement)(- (0, import_react46.createElement)(++ (0, import_react47.createElement)(SetRow,{ label: t("Theme"), hint: t("Colors for the whole team, on every device.") },- (0, import_react45.createElement)(- (0, import_react46.createElement)(++ (0, import_react47.createElement)("select",{ className: "bt-select", "aria-label": t("Theme"), value: current, onChange: (event) => run2(actions.setPrefs({ theme: event.target.value })) },- Object.entries(themes).map(([id, theme]) => (0, import_react45.createElement)("option", { key: id, value: id }, t(theme.label)))- Object.entries(themes).map(([id, theme]) => (0, import_react46.createElement)("option", { key: id, value: id }, t(theme.label)))++ Object.entries(themes).map(([id, theme]) => (0, import_react47.createElement)("option", { key: id, value: id }, t(theme.label))))),- (0, import_react45.createElement)(- (0, import_react46.createElement)(++ (0, import_react47.createElement)(SetRow,{ label: t("Accent"), hint: t("Unread marks, badges, and the brand mark.") },- (0, import_react45.createElement)(- (0, import_react46.createElement)(++ (0, import_react47.createElement)("div",{ className: "bt-swatches" },- (0, import_react45.createElement)("button", { type: "button", className: "bt-swatch bt-swatch-default", title: t("Theme accent"), "aria-label": t("Theme accent"), "aria-pressed": !prefs.accent, onClick: () => run2(actions.setPrefs({ accent: null })) }),- ACCENT_INKS.map((ink) => (0, import_react45.createElement)("button", {- (0, import_react46.createElement)("button", { type: "button", className: "bt-swatch bt-swatch-default", title: t("Theme accent"), "aria-label": t("Theme accent"), "aria-pressed": !prefs.accent, onClick: () => run2(actions.setPrefs({ accent: null })) }),- ACCENT_INKS.map((ink) => (0, import_react46.createElement)("button", {++ (0, import_react47.createElement)("button", { type: "button", className: "bt-swatch bt-swatch-default", title: t("Theme accent"), "aria-label": t("Theme accent"), "aria-pressed": !prefs.accent, onClick: () => run2(actions.setPrefs({ accent: null })) }),++ ACCENT_INKS.map((ink) => (0, import_react47.createElement)("button", {key: ink,type: "button",className: "bt-swatch",@@@ -17149,38 -17611,65 +17961,65 @@@style: { background: INKS[ink][0] },onClick: () => run2(actions.setPrefs({ accent: INKS[ink][0] }))})),- (0, import_react45.createElement)(- (0, import_react46.createElement)(++ (0, import_react47.createElement)("label",{ className: "bt-swatch bt-swatch-custom", title: t("Custom accent"), "data-on": Boolean(prefs.accent) && !ACCENT_INKS.some((ink) => INKS[ink][0] === prefs.accent) },- (0, import_react45.createElement)("input", { type: "color", value: custom, "aria-label": t("Custom accent"), onChange: (event) => pickCustom(event.target.value) })- (0, import_react46.createElement)("input", { type: "color", value: custom, "aria-label": t("Custom accent"), onChange: (event) => pickCustom(event.target.value) })++ (0, import_react47.createElement)("input", { type: "color", value: custom, "aria-label": t("Custom accent"), onChange: (event) => pickCustom(event.target.value) })))),- (0, import_react45.createElement)(SetRow, { label: t("Message layout") }, (0, import_react45.createElement)(Choice, { label: t("Message layout"), value: layoutOf(prefs), options: LAYOUTS, pick: (id) => run2(actions.setPrefs({ layout: id })) })),- (0, import_react46.createElement)(SetRow, { label: t("Message layout") }, (0, import_react46.createElement)(Choice, { label: t("Message layout"), value: layoutOf(prefs), options: LAYOUTS, pick: (id) => run2(actions.setPrefs({ layout: id })) })),++ (0, import_react47.createElement)(SetRow, { label: t("Message layout") }, (0, import_react47.createElement)(Choice, { label: t("Message layout"), value: layoutOf(prefs), options: LAYOUTS, pick: (id) => run2(actions.setPrefs({ layout: id })) })),// The flat layout's text has a width of its own; the bubble width stays for the user's messages.- layoutOf(prefs) === "flat" ? (0, import_react45.createElement)(SetRow, { label: t("Text width") }, (0, import_react45.createElement)(WidthSlider, { label: t("Text width"), value: flatWidthOf(prefs), save: (flatWidth) => run2(actions.setPrefs({ flatWidth })) })) : null,- (0, import_react45.createElement)(SetRow, { label: t("Bubble width") }, (0, import_react45.createElement)(WidthSlider, { label: t("Bubble width"), value: widthOf(prefs), save: (width) => run2(actions.setPrefs({ width })) })),- (0, import_react45.createElement)(SetRow, { label: t("Show thinking") }, (0, import_react45.createElement)(Switch, { label: t("Show thinking"), on: thinkingShown(prefs), onChange: (thinking) => run2(actions.setPrefs({ thinking })) }))- layoutOf(prefs) === "flat" ? (0, import_react46.createElement)(SetRow, { label: t("Text width") }, (0, import_react46.createElement)(WidthSlider, { label: t("Text width"), value: flatWidthOf(prefs), save: (flatWidth) => run2(actions.setPrefs({ flatWidth })) })) : null,- (0, import_react46.createElement)(SetRow, { label: t("Bubble width") }, (0, import_react46.createElement)(WidthSlider, { label: t("Bubble width"), value: widthOf(prefs), save: (width) => run2(actions.setPrefs({ width })) })),- (0, import_react46.createElement)(SetRow, { label: t("Show thinking") }, (0, import_react46.createElement)(Switch, { label: t("Show thinking"), on: thinkingShown(prefs), onChange: (thinking) => run2(actions.setPrefs({ thinking })) }))++ layoutOf(prefs) === "flat" ? (0, import_react47.createElement)(SetRow, { label: t("Text width") }, (0, import_react47.createElement)(WidthSlider, { label: t("Text width"), value: flatWidthOf(prefs), save: (flatWidth) => run2(actions.setPrefs({ flatWidth })) })) : null,++ (0, import_react47.createElement)(SetRow, { label: t("Bubble width") }, (0, import_react47.createElement)(WidthSlider, { label: t("Bubble width"), value: widthOf(prefs), save: (width) => run2(actions.setPrefs({ width })) })),++ (0, import_react47.createElement)(SetRow, { label: t("Show thinking") }, (0, import_react47.createElement)(Switch, { label: t("Show thinking"), on: thinkingShown(prefs), onChange: (thinking) => run2(actions.setPrefs({ thinking })) }))+ ),- (0, import_react46.createElement)(++ (0, import_react47.createElement)(+ SetSection,+ { key: "new", title: t("New Bots") },- (0, import_react46.createElement)(++ (0, import_react47.createElement)(+ SetRow,+ { label: t("Default model") },- (0, import_react46.createElement)(ModelMenu, {++ (0, import_react47.createElement)(ModelMenu, {+ bot: { id: "new-bots", name: t("New Bots"), model: prefs.defaultBotModel },+ roster,+ actions,+ run: run2,+ wide: true,+ withEfforts: false,+ onPick: (ref) => run2(actions.setPrefs({ defaultBotModel: ref }))+ }),- prefs.defaultBotModel ? (0, import_react46.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.setPrefs({ defaultBotModel: null })) }, t("Reset")) : null++ prefs.defaultBotModel ? (0, import_react47.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.setPrefs({ defaultBotModel: null })) }, t("Reset")) : null+ )+ ),- (0, import_react46.createElement)(++ (0, import_react47.createElement)(+ SetSection,+ { key: "input", title: t("Input") },- (0, import_react46.createElement)(++ (0, import_react47.createElement)(+ SetRow,+ { label: t("Enter sends message") },- (0, import_react46.createElement)(Switch, { label: t("Enter sends message"), on: prefs.enterToSend !== false, onChange: (enterToSend) => run2(actions.setPrefs({ enterToSend })) })++ (0, import_react47.createElement)(Switch, { label: t("Enter sends message"), on: prefs.enterToSend !== false, onChange: (enterToSend) => run2(actions.setPrefs({ enterToSend })) })+ )),- actions.setSurface ? (0, import_react45.createElement)(- actions.setSurface ? (0, import_react46.createElement)(++ actions.setSurface ? (0, import_react47.createElement)(SetSection,{ key: "mode", title: t("Mode") },- (0, import_react45.createElement)(- (0, import_react46.createElement)(++ (0, import_react47.createElement)(SetRow,{ label: t("Classic Agent mode") },- (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.setSurface("agent") }, t("Switch"))- (0, import_react46.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.setSurface("agent") }, t("Switch"))++ (0, import_react47.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.setSurface("agent") }, t("Switch")))) : null,- (0, import_react45.createElement)(LocationsSection, { key: "places", actions, run: run2 })- (0, import_react46.createElement)(LocationsSection, { key: "places", actions, run: run2 })++ (0, import_react47.createElement)(LocationsSection, { key: "places", actions, run: run2 })];}function LocationsSection({ actions, run: run2 }) {const app = globalThis.dsBotApp;- const [team, setTeam] = (0, import_react45.useState)(null);- const [data, setData] = (0, import_react45.useState)(null);- const [moving, setMoving] = (0, import_react45.useState)(false);- const busy = (0, import_react45.useRef)(false);- (0, import_react45.useEffect)(() => {- const [team, setTeam] = (0, import_react46.useState)(null);- const [data, setData] = (0, import_react46.useState)(null);- const [moving, setMoving] = (0, import_react46.useState)(false);- const busy = (0, import_react46.useRef)(false);- (0, import_react46.useEffect)(() => {++ const [team, setTeam] = (0, import_react47.useState)(null);++ const [data, setData] = (0, import_react47.useState)(null);++ const [moving, setMoving] = (0, import_react47.useState)(false);++ const busy = (0, import_react47.useRef)(false);++ (0, import_react47.useEffect)(() => {void Promise.resolve(actions.folders()).then((info) => setTeam(info?.team ?? null)).catch(() => {});if (app !== void 0) void Promise.resolve(app.dataLocation()).then(setData).catch(() => {@@@ -17198,18 -17687,18 +18037,18 @@@setMoving(false);}));};- return (0, import_react45.createElement)(- return (0, import_react46.createElement)(++ return (0, import_react47.createElement)(SetSection,{ title: t("Locations"), className: "bt-set-places" },- (0, import_react45.createElement)(- (0, import_react46.createElement)(++ (0, import_react47.createElement)(SetRow,{ label: t("Team workspace"), hint: t("Where Bots without a folder of their own work.") },- team === null ? null : (0, import_react45.createElement)(FolderMenu, { value: team, team: true, actions, run: run2, onPick: pickTeam, disabled: moving })- team === null ? null : (0, import_react46.createElement)(FolderMenu, { value: team, team: true, actions, run: run2, onPick: pickTeam, disabled: moving })++ team === null ? null : (0, import_react47.createElement)(FolderMenu, { value: team, team: true, actions, run: run2, onPick: pickTeam, disabled: moving })),- data === null ? null : (0, import_react45.createElement)(- data === null ? null : (0, import_react46.createElement)(++ data === null ? null : (0, import_react47.createElement)(SetRow,{ label: t("Data location"), hint: data.path },- data.fixed ? null : (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: moving, onClick: () => {- data.fixed ? null : (0, import_react46.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: moving, onClick: () => {++ data.fixed ? null : (0, import_react47.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: moving, onClick: () => {if (!busy.current) void run2(app.moveData(team ?? void 0));} }, t("Change…")))@@@ -17219,52 -17708,52 +18058,52 @@@ function MainBotsSection({ roster, acticonst mains = (roster.mainBotIds ?? []).map((id) => roster.byId[id]).filter(Boolean);const [first, ...others] = mains;const candidates = roster.bots.filter((bot) => !isMainOf(roster, bot.id));- return (0, import_react45.createElement)(- return (0, import_react46.createElement)(++ return (0, import_react47.createElement)(SetSection,{ title: t("Main Bot") },- (0, import_react45.createElement)(- (0, import_react46.createElement)(++ (0, import_react47.createElement)(SetRow,{label: t("Main Bot"),hint: first ? t("First in the sidebar. Pick another Bot to hand it the role; {name} then stops being a Main Bot.", { name: first.name }) : void 0},- (0, import_react45.createElement)("select", {- (0, import_react46.createElement)("select", {++ (0, import_react47.createElement)("select", {className: "bt-select","aria-label": t("Main Bot"),value: first?.id ?? "",onChange: (event) => run2(actions.setMain(event.target.value, true, first ? { replace: first.id } : {}))- }, first ? null : (0, import_react45.createElement)("option", { value: "" }, t("Choose a Bot…")), roster.bots.map((bot) => (0, import_react45.createElement)("option", { key: bot.id, value: bot.id }, bot.name)))- }, first ? null : (0, import_react46.createElement)("option", { value: "" }, t("Choose a Bot…")), roster.bots.map((bot) => (0, import_react46.createElement)("option", { key: bot.id, value: bot.id }, bot.name)))++ }, first ? null : (0, import_react47.createElement)("option", { value: "" }, t("Choose a Bot…")), roster.bots.map((bot) => (0, import_react47.createElement)("option", { key: bot.id, value: bot.id }, bot.name)))),- others.map((bot) => (0, import_react45.createElement)(- others.map((bot) => (0, import_react46.createElement)(++ others.map((bot) => (0, import_react47.createElement)(SetRow,{ key: bot.id, label: bot.name, hint: t("Also a Main Bot.") },- (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.setMain(bot.id, true, { primary: true })) }, t("Move to first")),- (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.setMain(bot.id, false)) }, t("Remove Main Bot role"))- (0, import_react46.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.setMain(bot.id, true, { primary: true })) }, t("Move to first")),- (0, import_react46.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.setMain(bot.id, false)) }, t("Remove Main Bot role"))++ (0, import_react47.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.setMain(bot.id, true, { primary: true })) }, t("Move to first")),++ (0, import_react47.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.setMain(bot.id, false)) }, t("Remove Main Bot role")))),- candidates.length > 0 ? (0, import_react45.createElement)(- candidates.length > 0 ? (0, import_react46.createElement)(++ candidates.length > 0 ? (0, import_react47.createElement)(SetRow,{ label: t("Add a Main Bot"), hint: t("Main Bots can create and change Bots, and run every group chat.") },- (0, import_react45.createElement)("select", {- (0, import_react46.createElement)("select", {++ (0, import_react47.createElement)("select", {className: "bt-select","aria-label": t("Add a Main Bot"),value: "",onChange: (event) => {if (event.target.value) void run2(actions.setMain(event.target.value, true));}- }, (0, import_react45.createElement)("option", { value: "" }, t("Choose a Bot…")), candidates.map((bot) => (0, import_react45.createElement)("option", { key: bot.id, value: bot.id }, bot.name)))- }, (0, import_react46.createElement)("option", { value: "" }, t("Choose a Bot…")), candidates.map((bot) => (0, import_react46.createElement)("option", { key: bot.id, value: bot.id }, bot.name)))++ }, (0, import_react47.createElement)("option", { value: "" }, t("Choose a Bot…")), candidates.map((bot) => (0, import_react47.createElement)("option", { key: bot.id, value: bot.id }, bot.name)))) : null);}var MOTIONS = [["quiet", "Quiet"], ["normal", "Normal"], ["lively", "Lively"]];function MotionSection({ roster, actions, run: run2 }) {const motion = roster.prefs?.motion === "quiet" || roster.prefs?.motion === "lively" ? roster.prefs.motion : "normal";- return (0, import_react45.createElement)(- return (0, import_react46.createElement)(++ return (0, import_react47.createElement)(SetSection,{ title: t("Animation") },- (0, import_react45.createElement)(- (0, import_react46.createElement)(++ (0, import_react47.createElement)(SetRow,{ label: t("Bot animation") },- (0, import_react45.createElement)(Segmented, { label: t("Bot animation"), value: motion, className: "bt-motion-seg" }, MOTIONS.map(([id, label]) => (0, import_react45.createElement)("button", {- (0, import_react46.createElement)(Segmented, { label: t("Bot animation"), value: motion, className: "bt-motion-seg" }, MOTIONS.map(([id, label]) => (0, import_react46.createElement)("button", {++ (0, import_react47.createElement)(Segmented, { label: t("Bot animation"), value: motion, className: "bt-motion-seg" }, MOTIONS.map(([id, label]) => (0, import_react47.createElement)("button", {key: id,type: "button","aria-pressed": motion === id,@@@ -17276,70 -17765,70 +18115,70 @@@);}function BotsPage({ roster, actions, run: run2 }) {- const [creating, setCreating] = (0, import_react45.useState)(false);- const [creating, setCreating] = (0, import_react46.useState)(false);++ const [creating, setCreating] = (0, import_react47.useState)(false);return [- (0, import_react45.createElement)(MainBotsSection, { key: "main", roster, actions, run: run2 }),- (0, import_react45.createElement)(MotionSection, { key: "motion", roster, actions, run: run2 }),- creating ? (0, import_react45.createElement)(CreateBot, { key: "create", roster, actions, inline: true, onBack: () => setCreating(false), onCreated: (bot) => actions.openSettings("bots", bot.id) }) : (0, import_react45.createElement)(- (0, import_react46.createElement)(MainBotsSection, { key: "main", roster, actions, run: run2 }),- (0, import_react46.createElement)(MotionSection, { key: "motion", roster, actions, run: run2 }),- creating ? (0, import_react46.createElement)(CreateBot, { key: "create", roster, actions, inline: true, onBack: () => setCreating(false), onCreated: (bot) => actions.openSettings("bots", bot.id) }) : (0, import_react46.createElement)(++ (0, import_react47.createElement)(MainBotsSection, { key: "main", roster, actions, run: run2 }),++ (0, import_react47.createElement)(MotionSection, { key: "motion", roster, actions, run: run2 }),++ creating ? (0, import_react47.createElement)(CreateBot, { key: "create", roster, actions, inline: true, onBack: () => setCreating(false), onCreated: (bot) => actions.openSettings("bots", bot.id) }) : (0, import_react47.createElement)("div",{ key: "new", className: "bt-actions" },- (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", onClick: () => setCreating(true) }, (0, import_react45.createElement)(PlusIcon), t("New Bot"))- (0, import_react46.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", onClick: () => setCreating(true) }, (0, import_react46.createElement)(PlusIcon), t("New Bot"))++ (0, import_react47.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", onClick: () => setCreating(true) }, (0, import_react47.createElement)(PlusIcon), t("New Bot"))),- (0, import_react45.createElement)(- (0, import_react46.createElement)(++ (0, import_react47.createElement)(SetSection,{ key: "bots", title: t("Bots · {count}", { count: roster.bots.length }) },- roster.bots.map((bot) => (0, import_react45.createElement)(- roster.bots.map((bot) => (0, import_react46.createElement)(++ roster.bots.map((bot) => (0, import_react47.createElement)("button",{ key: bot.id, type: "button", className: "bt-set-row", onClick: () => actions.openSettings("bots", bot.id) },- (0, import_react45.createElement)(- (0, import_react46.createElement)(++ (0, import_react47.createElement)("span",{ className: "bt-set-bot" },- (0, import_react45.createElement)(BotAvatar, { bot, size: 28, badge: false, live: false }),- (0, import_react45.createElement)("span", { className: "bt-row-title" }, bot.name),- bot.role ? (0, import_react45.createElement)("span", { className: "bt-tag" }, bot.role) : null,- isMainOf(roster, bot.id) ? (0, import_react45.createElement)("span", { className: "bt-tag" }, t("Main Bot")) : null,- bot.hidden && !isMainOf(roster, bot.id) ? (0, import_react45.createElement)("span", { className: "bt-tag" }, t("Hidden")) : null- (0, import_react46.createElement)(BotAvatar, { bot, size: 28, badge: false, live: false }),- (0, import_react46.createElement)("span", { className: "bt-row-title" }, bot.name),- bot.role ? (0, import_react46.createElement)("span", { className: "bt-tag" }, bot.role) : null,- isMainOf(roster, bot.id) ? (0, import_react46.createElement)("span", { className: "bt-tag" }, t("Main Bot")) : null,- bot.hidden && !isMainOf(roster, bot.id) ? (0, import_react46.createElement)("span", { className: "bt-tag" }, t("Hidden")) : null++ (0, import_react47.createElement)(BotAvatar, { bot, size: 28, badge: false, live: false }),++ (0, import_react47.createElement)("span", { className: "bt-row-title" }, bot.name),++ bot.role ? (0, import_react47.createElement)("span", { className: "bt-tag" }, bot.role) : null,++ isMainOf(roster, bot.id) ? (0, import_react47.createElement)("span", { className: "bt-tag" }, t("Main Bot")) : null,++ bot.hidden && !isMainOf(roster, bot.id) ? (0, import_react47.createElement)("span", { className: "bt-tag" }, t("Hidden")) : null),- (0, import_react45.createElement)("span", { className: "bt-chevron" }, (0, import_react45.createElement)(ChevronRightIcon))- (0, import_react46.createElement)("span", { className: "bt-chevron" }, (0, import_react46.createElement)(ChevronRightIcon))++ (0, import_react47.createElement)("span", { className: "bt-chevron" }, (0, import_react47.createElement)(ChevronRightIcon))))),- (0, import_react45.createElement)(KeptPrivateSection, { key: "kept", roster, actions, run: run2, Section: SetSection, Row: SetRow })- (0, import_react46.createElement)(KeptPrivateSection, { key: "kept", roster, actions, run: run2, Section: SetSection, Row: SetRow })++ (0, import_react47.createElement)(KeptPrivateSection, { key: "kept", roster, actions, run: run2, Section: SetSection, Row: SetRow })];}function GroupsPage({ roster, actions, run: run2 }) {- const [creating, setCreating] = (0, import_react45.useState)(false);- const [creating, setCreating] = (0, import_react46.useState)(false);++ const [creating, setCreating] = (0, import_react47.useState)(false);return [- creating ? (0, import_react45.createElement)(NewGroupForm, { key: "create", roster, actions, run: run2, onCancel: () => setCreating(false), onCreated: (room2) => actions.openSettings("groups", room2.id) }) : (0, import_react45.createElement)(- creating ? (0, import_react46.createElement)(NewGroupForm, { key: "create", roster, actions, run: run2, onCancel: () => setCreating(false), onCreated: (room2) => actions.openSettings("groups", room2.id) }) : (0, import_react46.createElement)(++ creating ? (0, import_react47.createElement)(NewGroupForm, { key: "create", roster, actions, run: run2, onCancel: () => setCreating(false), onCreated: (room2) => actions.openSettings("groups", room2.id) }) : (0, import_react47.createElement)("div",{ key: "new", className: "bt-actions" },- (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", disabled: roster.bots.length < 2, title: roster.bots.length < 2 ? t("A group chat needs at least two Bots") : void 0, onClick: () => setCreating(true) }, (0, import_react45.createElement)(PlusIcon), t("Create group chat"))- (0, import_react46.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", disabled: roster.bots.length < 2, title: roster.bots.length < 2 ? t("A group chat needs at least two Bots") : void 0, onClick: () => setCreating(true) }, (0, import_react46.createElement)(PlusIcon), t("Create group chat"))++ (0, import_react47.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", disabled: roster.bots.length < 2, title: roster.bots.length < 2 ? t("A group chat needs at least two Bots") : void 0, onClick: () => setCreating(true) }, (0, import_react47.createElement)(PlusIcon), t("Create group chat"))),- (0, import_react45.createElement)(- (0, import_react46.createElement)(++ (0, import_react47.createElement)(SetSection,{ key: "groups", title: t("Group chats · {count}", { count: roster.rooms.length }) },- roster.rooms.length === 0 ? (0, import_react45.createElement)(SetRow, { label: t("No group chats yet."), hint: t("A group chat lets several Bots work on one thing with you.") }) : roster.rooms.map((room2) => {- roster.rooms.length === 0 ? (0, import_react46.createElement)(SetRow, { label: t("No group chats yet."), hint: t("A group chat lets several Bots work on one thing with you.") }) : roster.rooms.map((room2) => {++ roster.rooms.length === 0 ? (0, import_react47.createElement)(SetRow, { label: t("No group chats yet."), hint: t("A group chat lets several Bots work on one thing with you.") }) : roster.rooms.map((room2) => {const admin = roster.byId[room2.admin];- return (0, import_react45.createElement)(- return (0, import_react46.createElement)(++ return (0, import_react47.createElement)("button",{ key: room2.id, type: "button", className: "bt-set-row", onClick: () => actions.openSettings("groups", room2.id) },- (0, import_react45.createElement)(- (0, import_react46.createElement)(++ (0, import_react47.createElement)("span",{ className: "bt-set-bot" },- (0, import_react45.createElement)(RoomAvatar, { room: room2, roster, size: 28 }),- (0, import_react45.createElement)("span", { className: "bt-row-title" }, room2.name),- (0, import_react45.createElement)("span", { className: "bt-tag" }, t("{count} members", { count: room2.members.length })),- admin ? (0, import_react45.createElement)("span", { className: "bt-tag bt-tag-admin" }, (0, import_react45.createElement)(AdminStar), admin.name) : null,- room2.hidden ? (0, import_react45.createElement)("span", { className: "bt-tag" }, t("Hidden")) : null- (0, import_react46.createElement)(RoomAvatar, { room: room2, roster, size: 28 }),- (0, import_react46.createElement)("span", { className: "bt-row-title" }, room2.name),- (0, import_react46.createElement)("span", { className: "bt-tag" }, t("{count} members", { count: room2.members.length })),- admin ? (0, import_react46.createElement)("span", { className: "bt-tag bt-tag-admin" }, (0, import_react46.createElement)(AdminStar), admin.name) : null,- room2.hidden ? (0, import_react46.createElement)("span", { className: "bt-tag" }, t("Hidden")) : null++ (0, import_react47.createElement)(RoomAvatar, { room: room2, roster, size: 28 }),++ (0, import_react47.createElement)("span", { className: "bt-row-title" }, room2.name),++ (0, import_react47.createElement)("span", { className: "bt-tag" }, t("{count} members", { count: room2.members.length })),++ admin ? (0, import_react47.createElement)("span", { className: "bt-tag bt-tag-admin" }, (0, import_react47.createElement)(AdminStar), admin.name) : null,++ room2.hidden ? (0, import_react47.createElement)("span", { className: "bt-tag" }, t("Hidden")) : null),- (0, import_react45.createElement)("span", { className: "bt-chevron" }, (0, import_react45.createElement)(ChevronRightIcon))- (0, import_react46.createElement)("span", { className: "bt-chevron" }, (0, import_react46.createElement)(ChevronRightIcon))++ (0, import_react47.createElement)("span", { className: "bt-chevron" }, (0, import_react47.createElement)(ChevronRightIcon)));}))];}function SettingsDialog({ page, id, roster, actions, useUpdate, leaving = false }) {- const [error, setError] = (0, import_react45.useState)("");- const close = (0, import_react45.useCallback)(() => actions.closeSettings(), []);- const [error, setError] = (0, import_react46.useState)("");- const close = (0, import_react46.useCallback)(() => actions.closeSettings(), []);++ const [error, setError] = (0, import_react47.useState)("");++ const close = (0, import_react47.useCallback)(() => actions.closeSettings(), []);useEscape(close);const run2 = (promise) => Promise.resolve(promise).then(() => {setError("");@@@ -17358,100 -17847,100 +18197,100 @@@const nav = useGlide(shown, { axis: "y" });const pageKey = `${shown}:${bot?.id ?? room2?.id ?? ""}`;const depth = bot || room2 ? 1 : 0;- const last = (0, import_react45.useRef)({ key: pageKey, depth, move: "up" });- const last = (0, import_react46.useRef)({ key: pageKey, depth, move: "up" });++ const last = (0, import_react47.useRef)({ key: pageKey, depth, move: "up" });if (last.current.key !== pageKey) {last.current = { key: pageKey, depth, move: depth > last.current.depth ? "in" : depth < last.current.depth ? "out" : "up" };}- const [usageOpened, setUsageOpened] = (0, import_react45.useState)(shown === "usage");- const [usageOpened, setUsageOpened] = (0, import_react46.useState)(shown === "usage");++ const [usageOpened, setUsageOpened] = (0, import_react47.useState)(shown === "usage");if (shown === "usage" && !usageOpened) setUsageOpened(true);- const errorLine = error ? (0, import_react45.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null;- return (0, import_react45.createElement)(- const errorLine = error ? (0, import_react46.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null;- return (0, import_react46.createElement)(++ const errorLine = error ? (0, import_react47.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null;++ return (0, import_react47.createElement)("div",{ className: "bt-settings-layer", "data-leaving": leaving || void 0 },- (0, import_react45.createElement)("div", { className: "bt-scrim", onMouseDown: close }),- (0, import_react45.createElement)(- (0, import_react46.createElement)("div", { className: "bt-scrim", onMouseDown: close }),- (0, import_react46.createElement)(++ (0, import_react47.createElement)("div", { className: "bt-scrim", onMouseDown: close }),++ (0, import_react47.createElement)("div",{ className: "bt-settings", role: "dialog", "aria-modal": true, "aria-label": t("DS Bot settings") },- (0, import_react45.createElement)(- (0, import_react46.createElement)(++ (0, import_react47.createElement)("nav",{ ref: nav.box, className: "bt-settings-nav", "aria-label": t("Settings pages") },- (0, import_react45.createElement)("span", { ref: nav.thumb, className: "bt-thumb", "aria-hidden": true }),- pages.map(([key, text]) => (0, import_react45.createElement)("button", {- (0, import_react46.createElement)("span", { ref: nav.thumb, className: "bt-thumb", "aria-hidden": true }),- pages.map(([key, text]) => (0, import_react46.createElement)("button", {++ (0, import_react47.createElement)("span", { ref: nav.thumb, className: "bt-thumb", "aria-hidden": true }),++ pages.map(([key, text]) => (0, import_react47.createElement)("button", {key,type: "button",className: "bt-settings-item","aria-current": shown === key ? "page" : void 0,onClick: () => actions.openSettings(key)- }, (0, import_react45.createElement)(PAGE_ICONS[key]), t(text))),- actions.openHarnessSettings ? (0, import_react45.createElement)("button", {- }, (0, import_react46.createElement)(PAGE_ICONS[key]), t(text))),- actions.openHarnessSettings ? (0, import_react46.createElement)("button", {++ }, (0, import_react47.createElement)(PAGE_ICONS[key]), t(text))),++ actions.openHarnessSettings ? (0, import_react47.createElement)("button", {type: "button",className: "bt-settings-item bt-settings-shell",title: t("Models, providers, and the rest of DeepSeek Harness"),onClick: () => {close();- (actions.openHarnessModels ?? actions.openHarnessSettings)();+ actions.openHarnessSettings();}- }, (0, import_react45.createElement)(SlidersIcon), t("Advanced settings (DeepSeek Harness)")) : null- }, (0, import_react46.createElement)(SlidersIcon), t("Harness settings")) : null++ }, (0, import_react47.createElement)(SlidersIcon), t("Harness settings")) : null),- (0, import_react45.createElement)(- (0, import_react46.createElement)(++ (0, import_react47.createElement)("div",{ className: "bt-settings-main" },- (0, import_react45.createElement)(- (0, import_react46.createElement)(++ (0, import_react47.createElement)("div",{ className: "bt-settings-head" },- back ? (0, import_react45.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": back, title: back, onClick: () => actions.openSettings(shown) }, (0, import_react45.createElement)(ChevronLeftIcon)) : null,- (0, import_react45.createElement)("h2", { key: bot?.id ?? room2?.id ?? shown }, bot?.name ?? room2?.name ?? label)- back ? (0, import_react46.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": back, title: back, onClick: () => actions.openSettings(shown) }, (0, import_react46.createElement)(ChevronLeftIcon)) : null,- (0, import_react46.createElement)("h2", { key: bot?.id ?? room2?.id ?? shown }, bot?.name ?? room2?.name ?? label)++ back ? (0, import_react47.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": back, title: back, onClick: () => actions.openSettings(shown) }, (0, import_react47.createElement)(ChevronLeftIcon)) : null,++ (0, import_react47.createElement)("h2", { key: bot?.id ?? room2?.id ?? shown }, bot?.name ?? room2?.name ?? label)),- shown === "usage" ? null : (0, import_react45.createElement)(- shown === "usage" ? null : (0, import_react46.createElement)(++ shown === "usage" ? null : (0, import_react47.createElement)("div",{ key: pageKey, className: "bt-settings-scroll bt-settings-page", "data-move": last.current.move },errorLine,- shown === "general" ? (0, import_react45.createElement)(GeneralPage, { roster, actions, run: run2 }) : null,- shown === "models" ? (0, import_react45.createElement)(ProvidersPage, { actions, run: run2, Section: SetSection }) : null,- bot ? (0, import_react45.createElement)("div", { className: "bt-settings-form" }, (0, import_react45.createElement)(BotSettingsForm, { key: bot.id, bot, roster, actions, run: run2 })) : null,- shown === "bots" && !bot ? (0, import_react45.createElement)(BotsPage, { roster, actions, run: run2 }) : null,- room2 ? (0, import_react45.createElement)("div", { className: "bt-settings-form" }, (0, import_react45.createElement)(GroupSettingsForm, { key: room2.id, room: room2, roster, actions, run: run2 })) : null,- shown === "groups" && !room2 ? (0, import_react45.createElement)(GroupsPage, { roster, actions, run: run2 }) : null,- shown === "connectors" ? (0, import_react45.createElement)(ConnectorsPage, { roster, actions }) : null,- shown === "capabilities" ? (0, import_react45.createElement)(CapabilitiesPage, { roster, actions, run: run2 }) : null,- shown === "browser" ? (0, import_react45.createElement)(BrowserPage, { roster, actions, run: run2, Section: SetSection, Row: SetRow }) : null,- shown === "schedules" ? (0, import_react45.createElement)(SchedulesPage, { roster, actions, start: id ?? void 0 }) : null,- shown === "secrets" ? (0, import_react45.createElement)(SecretsPage, { roster, actions, run: run2, Section: SetSection }) : null,- shown === "feedback" ? (0, import_react45.createElement)(FeedbackPage, { actions, run: run2, Section: SetSection, Row: SetRow }) : null,- shown === "about" ? (0, import_react45.createElement)(AboutPage, { useUpdate, actions, run: run2, Section: SetSection, Row: SetRow }) : null- shown === "general" ? (0, import_react46.createElement)(GeneralPage, { roster, actions, run: run2 }) : null,- shown === "models" ? (0, import_react46.createElement)(ProvidersPage, { actions, run: run2, Section: SetSection }) : null,- bot ? (0, import_react46.createElement)("div", { className: "bt-settings-form" }, (0, import_react46.createElement)(BotSettingsForm, { key: bot.id, bot, roster, actions, run: run2 })) : null,- shown === "bots" && !bot ? (0, import_react46.createElement)(BotsPage, { roster, actions, run: run2 }) : null,- room2 ? (0, import_react46.createElement)("div", { className: "bt-settings-form" }, (0, import_react46.createElement)(GroupSettingsForm, { key: room2.id, room: room2, roster, actions, run: run2 })) : null,- shown === "groups" && !room2 ? (0, import_react46.createElement)(GroupsPage, { roster, actions, run: run2 }) : null,- shown === "connectors" ? (0, import_react46.createElement)(ConnectorsPage, { roster, actions }) : null,- shown === "capabilities" ? (0, import_react46.createElement)(CapabilitiesPage, { roster, actions, run: run2 }) : null,- shown === "browser" ? (0, import_react46.createElement)(BrowserPage, { roster, actions, run: run2, Section: SetSection, Row: SetRow }) : null,- shown === "schedules" ? (0, import_react46.createElement)(SchedulesPage, { roster, actions, start: id ?? void 0 }) : null,- shown === "secrets" ? (0, import_react46.createElement)(SecretsPage, { roster, actions, run: run2, Section: SetSection }) : null,- shown === "feedback" ? (0, import_react46.createElement)(FeedbackPage, { actions, run: run2, Section: SetSection, Row: SetRow }) : null,- shown === "about" ? (0, import_react46.createElement)(AboutPage, { useUpdate, actions, run: run2, Section: SetSection, Row: SetRow }) : null++ shown === "general" ? (0, import_react47.createElement)(GeneralPage, { roster, actions, run: run2 }) : null,++ shown === "models" ? (0, import_react47.createElement)(ProvidersPage, { actions, run: run2, Section: SetSection }) : null,++ bot ? (0, import_react47.createElement)("div", { className: "bt-settings-form" }, (0, import_react47.createElement)(BotSettingsForm, { key: bot.id, bot, roster, actions, run: run2 })) : null,++ shown === "bots" && !bot ? (0, import_react47.createElement)(BotsPage, { roster, actions, run: run2 }) : null,++ room2 ? (0, import_react47.createElement)("div", { className: "bt-settings-form" }, (0, import_react47.createElement)(GroupSettingsForm, { key: room2.id, room: room2, roster, actions, run: run2 })) : null,++ shown === "groups" && !room2 ? (0, import_react47.createElement)(GroupsPage, { roster, actions, run: run2 }) : null,++ shown === "connectors" ? (0, import_react47.createElement)(ConnectorsPage, { roster, actions }) : null,++ shown === "capabilities" ? (0, import_react47.createElement)(CapabilitiesPage, { roster, actions, run: run2 }) : null,++ shown === "browser" ? (0, import_react47.createElement)(BrowserPage, { roster, actions, run: run2, Section: SetSection, Row: SetRow }) : null,++ shown === "schedules" ? (0, import_react47.createElement)(SchedulesPage, { roster, actions, start: id ?? void 0 }) : null,++ shown === "secrets" ? (0, import_react47.createElement)(SecretsPage, { roster, actions, run: run2, Section: SetSection }) : null,++ shown === "feedback" ? (0, import_react47.createElement)(FeedbackPage, { actions, run: run2, Section: SetSection, Row: SetRow }) : null,++ shown === "about" ? (0, import_react47.createElement)(AboutPage, { useUpdate, actions, run: run2, Section: SetSection, Row: SetRow }) : null),- usageOpened ? (0, import_react45.createElement)(- usageOpened ? (0, import_react46.createElement)(++ usageOpened ? (0, import_react47.createElement)("div",{ key: "usage", className: "bt-settings-scroll bt-settings-usage", "data-off": shown === "usage" ? void 0 : "", "aria-hidden": shown === "usage" ? void 0 : true },shown === "usage" ? errorLine : null,- (0, import_react45.createElement)(UsagePage, { roster, actions, focusId: usageFocus })- (0, import_react46.createElement)(UsagePage, { roster, actions, focusId: usageFocus })++ (0, import_react47.createElement)(UsagePage, { roster, actions, focusId: usageFocus })) : null),- (0, import_react45.createElement)("button", { type: "button", className: "bt-settings-close", "aria-label": t("Close settings"), onClick: close }, (0, import_react45.createElement)(CloseIcon))- (0, import_react46.createElement)("button", { type: "button", className: "bt-settings-close", "aria-label": t("Close settings"), onClick: close }, (0, import_react46.createElement)(CloseIcon))++ (0, import_react47.createElement)("button", { type: "button", className: "bt-settings-close", "aria-label": t("Close settings"), onClick: close }, (0, import_react47.createElement)(CloseIcon))));}// src/client/context-menu.js- var import_react46 = require("react");-var import_react47 = require("react");++var import_react48 = require("react");function ContextMenu({ menu, roster, actions, leaving = false }) {useEscape(() => actions.closeMenu());- (0, import_react46.useEffect)(() => {- (0, import_react47.useEffect)(() => {++ (0, import_react48.useEffect)(() => {const onDown = (event) => {if (!(event.target instanceof Element) || !event.target.closest(".bt-menu")) actions.closeMenu();};window.addEventListener("mousedown", onDown);return () => window.removeEventListener("mousedown", onDown);}, []);- const ref = (0, import_react46.useRef)(null);- const [place, setPlace] = (0, import_react46.useState)({ left: menu.x, top: menu.y });- const ref = (0, import_react47.useRef)(null);- const [place, setPlace] = (0, import_react47.useState)({ left: menu.x, top: menu.y });++ const ref = (0, import_react48.useRef)(null);++ const [place, setPlace] = (0, import_react48.useState)({ left: menu.x, top: menu.y });const tick = useViewport();- (0, import_react46.useLayoutEffect)(() => {- (0, import_react47.useLayoutEffect)(() => {++ (0, import_react48.useLayoutEffect)(() => {const box = ref.current?.getBoundingClientRect();if (!box) return;setPlace({ left: Math.max(8, Math.min(menu.x, window.innerWidth - box.width - 8)), top: Math.max(8, Math.min(menu.y, viewBottom() - box.height - 8)) });}, [menu.x, menu.y, tick]);- if (menu.kind === "agent" || menu.kind === "agent-session") return (0, import_react46.createElement)(AgentMenu, { menu, roster, actions, leaving });- if (menu.kind === "agent" || menu.kind === "agent-session") return (0, import_react47.createElement)(AgentMenu, { menu, roster, actions, leaving });++ if (menu.kind === "agent" || menu.kind === "agent-session") return (0, import_react48.createElement)(AgentMenu, { menu, roster, actions, leaving });const bot = roster.byId[menu.id];const room2 = roster.roomsById[menu.id];const entry = bot ?? room2;@@@ -17482,14 -17971,14 +18321,14 @@@isMainBot ? null : [room2 ? t("Delete group") : t("Delete"), TrashIcon, () => bot ? actions.deleteBot(bot.id) : actions.deleteRoom(menu.id), true]]].map((group) => group.filter(Boolean)).filter((group) => group.length > 0);- return (0, import_react46.createElement)(- return (0, import_react47.createElement)(++ return (0, import_react48.createElement)("div",{ ref, className: "bt-menu", role: "menu", "aria-label": t("{name} actions", { name: bot?.name ?? room2.name }), style: place, "data-leaving": leaving || void 0 },- groups.map((group, index) => (0, import_react46.createElement)(- import_react46.Fragment,- groups.map((group, index) => (0, import_react47.createElement)(- import_react47.Fragment,++ groups.map((group, index) => (0, import_react48.createElement)(++ import_react48.Fragment,{ key: index },- index > 0 ? (0, import_react46.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,- group.map(([label, Icon, run2, danger]) => (0, import_react46.createElement)("button", {- index > 0 ? (0, import_react47.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,- group.map(([label, Icon, run2, danger]) => (0, import_react47.createElement)("button", {++ index > 0 ? (0, import_react48.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,++ group.map(([label, Icon, run2, danger]) => (0, import_react48.createElement)("button", {key: label,type: "button",role: "menuitem",@@@ -17498,15 -17987,15 +18337,15 @@@actions.closeMenu();void Promise.resolve(run2()).catch((error) => actions.reportError(error, "menu"));}- }, (0, import_react46.createElement)(Icon), label))- }, (0, import_react47.createElement)(Icon), label))++ }, (0, import_react48.createElement)(Icon), label)))));}function AgentMenu({ menu, roster, actions, leaving }) {- const ref = (0, import_react46.useRef)(null);- const [place, setPlace] = (0, import_react46.useState)({ left: menu.x, top: menu.y });- const ref = (0, import_react47.useRef)(null);- const [place, setPlace] = (0, import_react47.useState)({ left: menu.x, top: menu.y });++ const ref = (0, import_react48.useRef)(null);++ const [place, setPlace] = (0, import_react48.useState)({ left: menu.x, top: menu.y });const tick = useViewport();- (0, import_react46.useLayoutEffect)(() => {- (0, import_react47.useLayoutEffect)(() => {++ (0, import_react48.useLayoutEffect)(() => {const box = ref.current?.getBoundingClientRect();if (!box) return;setPlace({ left: Math.max(8, Math.min(menu.x, window.innerWidth - box.width - 8)), top: Math.max(8, Math.min(menu.y, viewBottom() - box.height - 8)) });@@@ -17528,14 -18017,14 +18367,14 @@@[t("Archive"), TrashIcon, () => actions.archiveAgentSession(agent.id, menu.id), true]]];- return (0, import_react46.createElement)(- return (0, import_react47.createElement)(++ return (0, import_react48.createElement)("div",{ ref, className: "bt-menu", role: "menu", "aria-label": menu.kind === "agent" ? "DSH Agent" : t("Session actions"), style: place, "data-leaving": leaving || void 0 },- groups.map((group, index) => (0, import_react46.createElement)(- import_react46.Fragment,- groups.map((group, index) => (0, import_react47.createElement)(- import_react47.Fragment,++ groups.map((group, index) => (0, import_react48.createElement)(++ import_react48.Fragment,{ key: index },- index > 0 ? (0, import_react46.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,- group.map(([label, Icon, run2, danger]) => (0, import_react46.createElement)("button", {- index > 0 ? (0, import_react47.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,- group.map(([label, Icon, run2, danger]) => (0, import_react47.createElement)("button", {++ index > 0 ? (0, import_react48.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,++ group.map(([label, Icon, run2, danger]) => (0, import_react48.createElement)("button", {key: label,type: "button",role: "menuitem",@@@ -17544,15 -18033,15 +18383,15 @@@actions.closeMenu();void Promise.resolve(run2()).catch((error) => console.warn("[ds-bot]", error));}- }, (0, import_react46.createElement)(Icon), label))- }, (0, import_react47.createElement)(Icon), label))++ }, (0, import_react48.createElement)(Icon), label)))));}// src/client/member-status.js- var import_react47 = require("react");-var import_react48 = require("react");++var import_react49 = require("react");var NO_WORK = { bots: {}, rooms: {}, approvals: [] };- var FACES_MAX = 3;+ var FACES_MAX2 = 3;var DOCK_EXIT_MS = 160;function memberWork(room2, work = NO_WORK) {const here = work.rooms?.[room2.id] ?? [];@@@ -17611,15 -18100,15 +18450,15 @@@ function dockModel(sessionId, roster, w};}function Face({ bot, ask, state }) {- return (0, import_react47.createElement)(- return (0, import_react48.createElement)(++ return (0, import_react49.createElement)("span",{ className: "bt-mw-face", "data-ask": ask || void 0 },- (0, import_react47.createElement)(BotMark, { bot, size: 20, state: ask ? "alert" : state })- (0, import_react48.createElement)(BotMark, { bot, size: 20, state: ask ? "alert" : state })++ (0, import_react49.createElement)(BotMark, { bot, size: 20, state: ask ? "alert" : state }));}function useFitWidth(inner, key) {- const [width, setWidth] = (0, import_react47.useState)(null);- (0, import_react47.useLayoutEffect)(() => {- const [width, setWidth] = (0, import_react48.useState)(null);- (0, import_react48.useLayoutEffect)(() => {++ const [width, setWidth] = (0, import_react49.useState)(null);++ (0, import_react49.useLayoutEffect)(() => {setWidth(key && inner.current ? inner.current.offsetWidth : null);}, [key]);return width;@@@ -17630,92 -18119,91 +18469,91 @@@ function MemberDock({ sessionId, useRosconst live = dockModel(sessionId, roster, work);const [kept, leaving] = useLinger(live ? JSON.stringify(live) : null, DOCK_EXIT_MS);const model = kept ? JSON.parse(kept) : null;- const inner = (0, import_react47.useRef)(null);- const inner = (0, import_react48.useRef)(null);++ const inner = (0, import_react49.useRef)(null);const width = useFitWidth(inner, kept);if (!model) return null;const faces = model.faces.map((face) => ({ ...face, bot: roster.byId[face.id] })).filter((face) => face.bot);const label = [model.waiting, model.doing].filter(Boolean).join(" · ");const open = () => model.open.details ? actions.showDetails(model.open.details) : actions.openSession(model.open.session);- return (0, import_react47.createElement)(- return (0, import_react48.createElement)(++ return (0, import_react49.createElement)("div",{ className: "bt-mw-dock", "data-leaving": leaving || void 0 },- (0, import_react47.createElement)(- (0, import_react48.createElement)(++ (0, import_react49.createElement)("button",{ type: "button", className: "bt-mw-pill", "aria-label": label, onClick: open, disabled: leaving, style: width ? { width } : void 0 },- (0, import_react47.createElement)(- (0, import_react48.createElement)(++ (0, import_react49.createElement)("span",{ ref: inner, className: "bt-mw-pill-in" },- (0, import_react47.createElement)("span", { className: "bt-mw-faces", "aria-hidden": true }, faces.map((face) => (0, import_react47.createElement)(Face, { key: face.id, ...face }))),- (0, import_react47.createElement)(- (0, import_react48.createElement)("span", { className: "bt-mw-faces", "aria-hidden": true }, faces.map((face) => (0, import_react48.createElement)(Face, { key: face.id, ...face }))),- (0, import_react48.createElement)(++ (0, import_react49.createElement)("span", { className: "bt-mw-faces", "aria-hidden": true }, faces.map((face) => (0, import_react49.createElement)(Face, { key: face.id, ...face }))),++ (0, import_react49.createElement)("span",{ key: label, className: "bt-mw-label", "aria-hidden": true },- model.waiting ? (0, import_react47.createElement)("span", { className: "bt-mw-ask" }, model.waiting) : null,- model.waiting && model.doing ? (0, import_react47.createElement)("span", { className: "bt-mw-dot" }, "·") : null,- model.doing ? (0, import_react47.createElement)("span", { className: "bt-mw-doing" }, (0, import_react47.createElement)(Shimmer, null, model.doing)) : null- model.waiting ? (0, import_react48.createElement)("span", { className: "bt-mw-ask" }, model.waiting) : null,- model.waiting && model.doing ? (0, import_react48.createElement)("span", { className: "bt-mw-dot" }, "·") : null,- model.doing ? (0, import_react48.createElement)("span", { className: "bt-mw-doing" }, (0, import_react48.createElement)(Shimmer, null, model.doing)) : null++ model.waiting ? (0, import_react49.createElement)("span", { className: "bt-mw-ask" }, model.waiting) : null,++ model.waiting && model.doing ? (0, import_react49.createElement)("span", { className: "bt-mw-dot" }, "·") : null,++ model.doing ? (0, import_react49.createElement)("span", { className: "bt-mw-doing" }, (0, import_react49.createElement)(Shimmer, null, model.doing)) : null))));}- var stateLine = (className, at, ...what) => (0, import_react47.createElement)(-var stateLine = (className, at, ...what) => (0, import_react48.createElement)(++var stateLine = (className, at, ...what) => (0, import_react49.createElement)("span",{ className },- (0, import_react47.createElement)("span", { className: "bt-member-what" }, ...what),- typeof at === "number" ? (0, import_react47.createElement)(Elapsed, { at, className: "bt-member-time" }) : null- (0, import_react48.createElement)("span", { className: "bt-member-what" }, ...what),- typeof at === "number" ? (0, import_react48.createElement)(Elapsed, { at, className: "bt-member-time" }) : null++ (0, import_react49.createElement)("span", { className: "bt-member-what" }, ...what),++ typeof at === "number" ? (0, import_react49.createElement)(Elapsed, { at, className: "bt-member-time" }) : null);function ApprovalCard({ approval, bot, actions }) {- const [busy, setBusy] = (0, import_react47.useState)(false);- const [busy, setBusy] = (0, import_react48.useState)(false);++ const [busy, setBusy] = (0, import_react49.useState)(false);const answer = (choice) => {setBusy(true);void Promise.resolve(actions.answerApproval(approval.id, choice)).catch((error) => actions.reportError(error, "approval")).finally(() => setBusy(false));};- return (0, import_react47.createElement)(- return (0, import_react48.createElement)(++ return (0, import_react49.createElement)("div",{ className: "bt-mw-card", role: "group", "aria-label": t("{name} is waiting for your approval", { name: bot.name }) },- (0, import_react47.createElement)("div", { className: "bt-mw-tool" }, approval.tool),- approval.detail?.text ? (0, import_react47.createElement)("div", { className: "bt-mw-text" }, approval.detail.text) : null,- approval.reason ? (0, import_react47.createElement)("div", { className: "bt-mw-reason" }, approval.reason) : null,- approval.detail?.code ? (0, import_react47.createElement)("code", { className: "bt-mw-code", title: approval.detail.code }, approval.detail.code) : null,- approval.answerable ? (0, import_react47.createElement)(- (0, import_react48.createElement)("div", { className: "bt-mw-tool" }, approval.tool),- approval.detail?.text ? (0, import_react48.createElement)("div", { className: "bt-mw-text" }, approval.detail.text) : null,- approval.reason ? (0, import_react48.createElement)("div", { className: "bt-mw-reason" }, approval.reason) : null,- approval.detail?.code ? (0, import_react48.createElement)("code", { className: "bt-mw-code", title: approval.detail.code }, approval.detail.code) : null,- approval.answerable ? (0, import_react48.createElement)(++ (0, import_react49.createElement)("div", { className: "bt-mw-tool" }, approval.tool),++ approval.detail?.text ? (0, import_react49.createElement)("div", { className: "bt-mw-text" }, approval.detail.text) : null,++ approval.reason ? (0, import_react49.createElement)("div", { className: "bt-mw-reason" }, approval.reason) : null,++ approval.detail?.code ? (0, import_react49.createElement)("code", { className: "bt-mw-code", title: approval.detail.code }, approval.detail.code) : null,++ approval.answerable ? (0, import_react49.createElement)("div",{ className: "bt-mw-actions" },- (0, import_react47.createElement)("button", { type: "button", className: "bt-q-btn", disabled: busy, onClick: () => answer("reject") }, t("Reject")),- (0, import_react47.createElement)("button", { type: "button", className: "bt-q-submit", disabled: busy, onClick: () => answer("allow") }, t("Allow once"))- ) : (0, import_react47.createElement)(- (0, import_react48.createElement)("button", { type: "button", className: "bt-q-btn", disabled: busy, onClick: () => answer("reject") }, t("Reject")),- (0, import_react48.createElement)("button", { type: "button", className: "bt-q-submit", disabled: busy, onClick: () => answer("allow") }, t("Allow once"))- ) : (0, import_react48.createElement)(++ (0, import_react49.createElement)("button", { type: "button", className: "bt-q-btn", disabled: busy, onClick: () => answer("reject") }, t("Reject")),++ (0, import_react49.createElement)("button", { type: "button", className: "bt-q-submit", disabled: busy, onClick: () => answer("allow") }, t("Allow once"))++ ) : (0, import_react49.createElement)("div",{ className: "bt-mw-actions" },- (0, import_react47.createElement)("button", { type: "button", className: "bt-q-btn", onClick: () => actions.openSession(bot.id) }, t("Open {name}'s chat", { name: bot.name }))- (0, import_react48.createElement)("button", { type: "button", className: "bt-q-btn", onClick: () => actions.openSession(bot.id) }, t("Open {name}'s chat", { name: bot.name }))++ (0, import_react49.createElement)("button", { type: "button", className: "bt-q-btn", onClick: () => actions.openSession(bot.id) }, t("Open {name}'s chat", { name: bot.name }))));}- function MemberState({ entry, bot, room: room2, roster }) {+ function MemberState({ entry, bot }) {if (entry?.state === "ask") return stateLine("bt-member-state bt-mw-ask", entry.approvals[0].at, t("Waiting for your approval"));if (entry?.state !== "work") return bot.role ? stateLine("bt-member-state", void 0, bot.role) : null;- const where = entry.doing.roomId === room2.id ? "" : entry.doing.roomId ? t("in {name}", { name: roster.roomsById[entry.doing.roomId]?.name ?? t("a group chat") }) : t("in its own chat");- return stateLine("bt-member-state", entry.doing.since, (0, import_react47.createElement)(Shimmer, null, `${workPhrase(entry.doing)}…`), where ? ` ${where}` : "");- return stateLine("bt-member-state", entry.doing.since, (0, import_react48.createElement)(Shimmer, null, `${workPhrase(entry.doing)}…`));++ return stateLine("bt-member-state", entry.doing.since, (0, import_react49.createElement)(Shimmer, null, `${workPhrase(entry.doing)}…`));}function StopMemberWork({ entry, bot, room: room2, actions }) {- const [stopping, setStopping] = (0, import_react47.useState)(false);- const [stopping, setStopping] = (0, import_react48.useState)(false);++ const [stopping, setStopping] = (0, import_react49.useState)(false);if (!entry?.here || entry.state !== "work" && entry.state !== "ask") return null;const stop = () => {setStopping(true);void Promise.resolve(actions.stopMemberWork(room2.id, bot.id)).catch((error) => actions.reportError(error, "stop")).finally(() => setStopping(false));};- return (0, import_react47.createElement)("button", { type: "button", className: "bt-member-stop", disabled: stopping, "aria-label": `${t("Stop")} · ${bot.name}`, onClick: stop }, t("Stop"));- return (0, import_react48.createElement)("button", { type: "button", className: "bt-member-stop", disabled: stopping, "aria-label": `${t("Stop")} · ${bot.name}`, onClick: stop }, t("Stop"));++ return (0, import_react49.createElement)("button", { type: "button", className: "bt-member-stop", disabled: stopping, "aria-label": `${t("Stop")} · ${bot.name}`, onClick: stop }, t("Stop"));}function StopRoomWork({ room: room2, entries: entries2, actions }) {- const [stopping, setStopping] = (0, import_react47.useState)(false);- const [stopping, setStopping] = (0, import_react48.useState)(false);++ const [stopping, setStopping] = (0, import_react49.useState)(false);if (!entries2.some((entry) => entry.here)) return null;const stop = () => {setStopping(true);void Promise.resolve(actions.stopRoomWork(room2.id)).catch((error) => actions.reportError(error, "stop")).finally(() => setStopping(false));};const label = t("Stop all work in this group");- return (0, import_react47.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: stopping, "aria-label": label, title: label, onClick: stop }, t("Stop all"));- return (0, import_react48.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: stopping, "aria-label": label, title: label, onClick: stop }, t("Stop all"));++ return (0, import_react49.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: stopping, "aria-label": label, title: label, onClick: stop }, t("Stop all"));}function MemberApprovals({ entry, bot, actions }) {if (entry?.state !== "ask") return null;- return (0, import_react47.createElement)("div", { className: "bt-member-cards" }, entry.approvals.map((approval) => (0, import_react47.createElement)(ApprovalCard, { key: approval.id, approval, bot, actions })));- return (0, import_react48.createElement)("div", { className: "bt-member-cards" }, entry.approvals.map((approval) => (0, import_react48.createElement)(ApprovalCard, { key: approval.id, approval, bot, actions })));++ return (0, import_react49.createElement)("div", { className: "bt-member-cards" }, entry.approvals.map((approval) => (0, import_react49.createElement)(ApprovalCard, { key: approval.id, approval, bot, actions })));}function useMemberWork(room2, useWork) {const work = useWork?.((value) => value) ?? NO_WORK;@@@ -17779,7 -18267,7 +18617,7 @@@ body[data-ds-dark-theme] .bt-member-sta`;// src/client/details-drawer.js- var import_react48 = require("react");-var import_react49 = require("react");++var import_react50 = require("react");function transcriptOf(list, id, name, hiddenTurns = []) {const outline = list.projectionsBySession?.[id]?.values?.turnOutline ?? list.byId[id]?.projectionValues?.turnOutline;if (!Array.isArray(outline)) return "";@@@ -17804,17 -18292,17 +18642,17 @@@ var EMPTY_TABS = { ids: [], active: nulfunction PermissionRow({ bot, roster, actions, run: run2 }) {const catalog = roster.permissions;if (!catalog?.options?.length) return null;- return (0, import_react48.createElement)(- return (0, import_react49.createElement)(++ return (0, import_react50.createElement)("div",{ className: "bt-drawer-permission" },- (0, import_react48.createElement)("div", { className: "bt-section-title" }, t("Permissions")),- (0, import_react49.createElement)("div", { className: "bt-section-title" }, t("Permissions")),++ (0, import_react50.createElement)("div", { className: "bt-section-title" }, t("Permissions")),// A Bot without its own preset may run on another one set in DSH, so its first pick always applies.- (0, import_react48.createElement)(PermissionPicker, { catalog, saved: bot.permission ?? catalog.defaultPreset, repick: bot.permission === void 0, onPick: (permission) => run2(actions.updateBot(bot.id, { permission })) })- (0, import_react49.createElement)(PermissionPicker, { catalog, saved: bot.permission ?? catalog.defaultPreset, repick: bot.permission === void 0, onPick: (permission) => run2(actions.updateBot(bot.id, { permission })) })++ (0, import_react50.createElement)(PermissionPicker, { catalog, saved: bot.permission ?? catalog.defaultPreset, repick: bot.permission === void 0, onPick: (permission) => run2(actions.updateBot(bot.id, { permission })) }));}function RunStats({ bot, part, running, actions }) {- const [values, setValues] = (0, import_react48.useState)(null);- (0, import_react48.useEffect)(() => {- const [values, setValues] = (0, import_react49.useState)(null);- (0, import_react49.useEffect)(() => {++ const [values, setValues] = (0, import_react50.useState)(null);++ (0, import_react50.useEffect)(() => {if (!actions.runStats) return void 0;let current = true;actions.runStats(bot.id).then(@@@ -17831,56 -18319,56 +18669,56 @@@}, [bot.id, part, running]);const shown = runStatsOf(values);if (shown.length === 0) return null;- return (0, import_react48.createElement)(- return (0, import_react49.createElement)(++ return (0, import_react50.createElement)("div",{ className: "bt-run-stats" },- shown.map((entry, index) => (0, import_react48.createElement)(- import_react48.Fragment,- shown.map((entry, index) => (0, import_react49.createElement)(- import_react49.Fragment,++ shown.map((entry, index) => (0, import_react50.createElement)(++ import_react50.Fragment,{ key: entry.key },- index > 0 ? (0, import_react48.createElement)("span", { className: "bt-run-sep", "aria-hidden": true }, "·") : null,- (0, import_react48.createElement)("span", { title: entry.title }, entry.text)- index > 0 ? (0, import_react49.createElement)("span", { className: "bt-run-sep", "aria-hidden": true }, "·") : null,- (0, import_react49.createElement)("span", { title: entry.title }, entry.text)++ index > 0 ? (0, import_react50.createElement)("span", { className: "bt-run-sep", "aria-hidden": true }, "·") : null,++ (0, import_react50.createElement)("span", { title: entry.title }, entry.text))));}function BrowserCards({ bot, sessionId, roster, actions, useBrowserTabs, useBrowserPages }) {const state = useBrowserTabs((map) => map[bot.id] ?? EMPTY_TABS);const pages = useBrowserPages((map) => map);- (0, import_react48.useEffect)(() => {- (0, import_react49.useEffect)(() => {++ (0, import_react50.useEffect)(() => {actions.browserEnsure?.(bot.id);}, [bot.id]);if (roster.browser !== true || !actions.browserShow) {- return (0, import_react48.createElement)("div", { className: "bt-muted" }, t("The browser is in DSH Desktop and the DeepSeek Bot app."));- return (0, import_react49.createElement)("div", { className: "bt-muted" }, t("The browser is in DSH Desktop and the DS Bot app."));++ return (0, import_react50.createElement)("div", { className: "bt-muted" }, t("The browser is in DSH Desktop and the DS Bot app."));}if (state.ids.length === 0) {- return (0, import_react48.createElement)(- return (0, import_react49.createElement)(++ return (0, import_react50.createElement)("div",{ className: "bt-browser-empty-mark" },- (0, import_react48.createElement)(BotMark, { bot, size: 40, state: "idle", live: true }),- (0, import_react48.createElement)("div", { className: "bt-browser-empty-title" }, t("{name}'s browser", { name: bot.name })),- (0, import_react48.createElement)("div", { className: "bt-muted" }, t("Open a page here and {name} can read it with you. Logins and cookies stay with {name}; other Bots never see them.", { name: bot.name })),- (0, import_react48.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: () => actions.openBrowser(sessionId) }, t("Open browser"))- (0, import_react49.createElement)(BotMark, { bot, size: 40, state: "idle", live: true }),- (0, import_react49.createElement)("div", { className: "bt-browser-empty-title" }, t("{name}'s browser", { name: bot.name })),- (0, import_react49.createElement)("div", { className: "bt-muted" }, t("Open a page here and {name} can read it with you. Logins and cookies stay with {name}; other Bots never see them.", { name: bot.name })),- (0, import_react49.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: () => actions.openBrowser(sessionId) }, t("Open browser"))++ (0, import_react50.createElement)(BotMark, { bot, size: 40, state: "idle", live: true }),++ (0, import_react50.createElement)("div", { className: "bt-browser-empty-title" }, t("{name}'s browser", { name: bot.name })),++ (0, import_react50.createElement)("div", { className: "bt-muted" }, t("Open a page here and {name} can read it with you. Logins and cookies stay with {name}; other Bots never see them.", { name: bot.name })),++ (0, import_react50.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: () => actions.openBrowser(sessionId) }, t("Open browser")));}- return (0, import_react48.createElement)(- return (0, import_react49.createElement)(++ return (0, import_react50.createElement)("div",{ className: "bt-bcards" },state.ids.map((tabId, index) => {const page = pages[tabId] ?? {};const label = page.title || shortUrl(page.url) || t("New tab");- return (0, import_react48.createElement)(- return (0, import_react49.createElement)(++ return (0, import_react50.createElement)("div",{ key: tabId, className: "bt-bcard", "data-active": state.active === tabId || void 0, style: { animationDelay: `${index * 30}ms` } },- (0, import_react48.createElement)(- (0, import_react49.createElement)(++ (0, import_react50.createElement)("button",{ type: "button", className: "bt-bcard-shot", "aria-label": t("Open {title}", { title: label }), title: page.url, onClick: () => actions.browserPick(sessionId, tabId) },- page.excerpt ? (0, import_react48.createElement)(- page.excerpt ? (0, import_react49.createElement)(++ page.excerpt ? (0, import_react50.createElement)("span",{ className: "bt-bcard-preview" },- (0, import_react48.createElement)("span", { className: "bt-bcard-ptitle" }, label),- (0, import_react48.createElement)("span", { className: "bt-bcard-excerpt" }, page.excerpt)- ) : (0, import_react48.createElement)("span", { className: "bt-bcard-blank" }, (0, import_react48.createElement)(GlobeIcon2), (0, import_react48.createElement)("span", null, label))- (0, import_react49.createElement)("span", { className: "bt-bcard-ptitle" }, label),- (0, import_react49.createElement)("span", { className: "bt-bcard-excerpt" }, page.excerpt)- ) : (0, import_react49.createElement)("span", { className: "bt-bcard-blank" }, (0, import_react49.createElement)(GlobeIcon2), (0, import_react49.createElement)("span", null, label))++ (0, import_react50.createElement)("span", { className: "bt-bcard-ptitle" }, label),++ (0, import_react50.createElement)("span", { className: "bt-bcard-excerpt" }, page.excerpt)++ ) : (0, import_react50.createElement)("span", { className: "bt-bcard-blank" }, (0, import_react50.createElement)(GlobeIcon2), (0, import_react50.createElement)("span", null, label))),- (0, import_react48.createElement)("button", {- (0, import_react49.createElement)("button", {++ (0, import_react50.createElement)("button", {type: "button",className: "bt-bcard-x","aria-label": t("Close tab"),@@@ -17889,29 -18377,29 +18727,29 @@@void actions.browserCloseTab(bot.id, tabId);}}, "×"),- (0, import_react48.createElement)(- (0, import_react49.createElement)(++ (0, import_react50.createElement)("div",{ className: "bt-bcard-row" },- (0, import_react48.createElement)(Favicon, { src: page.favicon, className: "bt-bcard-fav" }),- (0, import_react48.createElement)("span", { className: "bt-bcard-title" }, label),- page.url ? (0, import_react48.createElement)("span", { className: "bt-bcard-host" }, hostOf2(page.url)) : null- (0, import_react49.createElement)(Favicon, { src: page.favicon, className: "bt-bcard-fav" }),- (0, import_react49.createElement)("span", { className: "bt-bcard-title" }, label),- page.url ? (0, import_react49.createElement)("span", { className: "bt-bcard-host" }, hostOf2(page.url)) : null++ (0, import_react50.createElement)(Favicon, { src: page.favicon, className: "bt-bcard-fav" }),++ (0, import_react50.createElement)("span", { className: "bt-bcard-title" }, label),++ page.url ? (0, import_react50.createElement)("span", { className: "bt-bcard-host" }, hostOf2(page.url)) : null));}),- (0, import_react48.createElement)("button", { type: "button", className: "bt-bcard-new", style: { animationDelay: `${state.ids.length * 30}ms` }, onClick: () => actions.browserNewTab(sessionId) }, (0, import_react48.createElement)(PlusIcon), t("New tab"))- (0, import_react49.createElement)("button", { type: "button", className: "bt-bcard-new", style: { animationDelay: `${state.ids.length * 30}ms` }, onClick: () => actions.browserNewTab(sessionId) }, (0, import_react49.createElement)(PlusIcon), t("New tab"))++ (0, import_react50.createElement)("button", { type: "button", className: "bt-bcard-new", style: { animationDelay: `${state.ids.length * 30}ms` }, onClick: () => actions.browserNewTab(sessionId) }, (0, import_react50.createElement)(PlusIcon), t("New tab")));}function About({ text, title = "About" }) {- const [open, setOpen] = (0, import_react48.useState)(false);- const [open, setOpen] = (0, import_react49.useState)(false);++ const [open, setOpen] = (0, import_react50.useState)(false);const long = text.split("\n").length > 5 || text.length > 240;- const body = (0, import_react48.useRef)(null);- const body = (0, import_react49.useRef)(null);++ const body = (0, import_react50.useRef)(null);useMorph(body, open);- return (0, import_react48.createElement)(- return (0, import_react49.createElement)(++ return (0, import_react50.createElement)("div",null,- (0, import_react48.createElement)("div", { className: "bt-section-title" }, t(title)),- (0, import_react48.createElement)("div", { ref: body, className: "bt-about", "data-open": open || void 0 }, text),- long ? (0, import_react48.createElement)("button", { type: "button", className: "bt-more", onClick: () => setOpen((value) => !value) }, open ? t("Show less") : t("Show more")) : null- (0, import_react49.createElement)("div", { className: "bt-section-title" }, t(title)),- (0, import_react49.createElement)("div", { ref: body, className: "bt-about", "data-open": open || void 0 }, text),- long ? (0, import_react49.createElement)("button", { type: "button", className: "bt-more", onClick: () => setOpen((value) => !value) }, open ? t("Show less") : t("Show more")) : null++ (0, import_react50.createElement)("div", { className: "bt-section-title" }, t(title)),++ (0, import_react50.createElement)("div", { ref: body, className: "bt-about", "data-open": open || void 0 }, text),++ long ? (0, import_react50.createElement)("button", { type: "button", className: "bt-more", onClick: () => setOpen((value) => !value) }, open ? t("Show less") : t("Show more")) : null);}var PILE_MAX = 4;@@@ -17919,57 -18407,57 +18757,57 @@@ function MemberPile({ room: room2, rostconst members = room2.members.map((id) => roster.byId[id]).filter(Boolean);const shown = members.length > PILE_MAX ? members.slice(0, PILE_MAX - 1) : members;const more = members.length - shown.length;- return (0, import_react48.createElement)(- return (0, import_react49.createElement)(++ return (0, import_react50.createElement)("span",{ className: "bt-pile", "aria-hidden": true },- shown.map((bot, index) => (0, import_react48.createElement)("span", { key: bot.id, className: "bt-pile-face", style: { animationDelay: `${index * 40}ms` } }, (0, import_react48.createElement)(BotMark, { bot, size: 44, live: true }))),- more > 0 ? (0, import_react48.createElement)("span", { key: "more", className: "bt-pile-face bt-pile-more", style: { animationDelay: `${shown.length * 40}ms` } }, `+${more}`) : null- shown.map((bot, index) => (0, import_react49.createElement)("span", { key: bot.id, className: "bt-pile-face", style: { animationDelay: `${index * 40}ms` } }, (0, import_react49.createElement)(BotMark, { bot, size: 44, live: true }))),- more > 0 ? (0, import_react49.createElement)("span", { key: "more", className: "bt-pile-face bt-pile-more", style: { animationDelay: `${shown.length * 40}ms` } }, `+${more}`) : null++ shown.map((bot, index) => (0, import_react50.createElement)("span", { key: bot.id, className: "bt-pile-face", style: { animationDelay: `${index * 40}ms` } }, (0, import_react50.createElement)(BotMark, { bot, size: 44, live: true }))),++ more > 0 ? (0, import_react50.createElement)("span", { key: "more", className: "bt-pile-face bt-pile-more", style: { animationDelay: `${shown.length * 40}ms` } }, `+${more}`) : null);}var markOf = (entry) => entry?.state === "ask" ? "alert" : entry?.state === "work" ? workState(entry.doing) : "idle";function MemberRow({ member, entry, room: room2, roster, actions }) {- return (0, import_react48.createElement)(- return (0, import_react49.createElement)(++ return (0, import_react50.createElement)("div",{ role: "listitem", className: "bt-member" },- (0, import_react48.createElement)(- (0, import_react49.createElement)(++ (0, import_react50.createElement)("div",{ className: "bt-member-row" },- (0, import_react48.createElement)(- (0, import_react49.createElement)(++ (0, import_react50.createElement)("button",{ type: "button", className: "bt-member-open", title: t("Open {name}'s chat", { name: member.name }), onClick: () => actions.openSession(member.id) },- (0, import_react48.createElement)(BotMark, { bot: member, size: 32, state: markOf(entry) }),- (0, import_react48.createElement)(- (0, import_react49.createElement)(BotMark, { bot: member, size: 32, state: markOf(entry) }),- (0, import_react49.createElement)(++ (0, import_react50.createElement)(BotMark, { bot: member, size: 32, state: markOf(entry) }),++ (0, import_react50.createElement)("span",{ className: "bt-member-text" },- (0, import_react48.createElement)(- (0, import_react49.createElement)(++ (0, import_react50.createElement)("span",{ className: "bt-member-line" },- (0, import_react48.createElement)("span", { className: "bt-member-name" }, member.name),- room2.admin === member.id ? (0, import_react48.createElement)("span", { className: "bt-tag" }, t("Admin")) : null- (0, import_react49.createElement)("span", { className: "bt-member-name" }, member.name),- room2.admin === member.id ? (0, import_react49.createElement)("span", { className: "bt-tag" }, t("Admin")) : null++ (0, import_react50.createElement)("span", { className: "bt-member-name" }, member.name),++ room2.admin === member.id ? (0, import_react50.createElement)("span", { className: "bt-tag" }, t("Admin")) : null),- (0, import_react48.createElement)(MemberState, { entry, bot: member, room: room2, roster })- (0, import_react49.createElement)(MemberState, { entry, bot: member, room: room2, roster })++ (0, import_react50.createElement)(MemberState, { entry, bot: member, room: room2, roster }))),- (0, import_react48.createElement)(StopMemberWork, { entry, bot: member, room: room2, actions })- (0, import_react49.createElement)(StopMemberWork, { entry, bot: member, room: room2, actions })++ (0, import_react50.createElement)(StopMemberWork, { entry, bot: member, room: room2, actions })),- (0, import_react48.createElement)(MemberApprovals, { entry, bot: member, actions })- (0, import_react49.createElement)(MemberApprovals, { entry, bot: member, actions })++ (0, import_react50.createElement)(MemberApprovals, { entry, bot: member, actions }));}function GroupOverview({ room: room2, roster, actions, usage, useWork, openSettings }) {const members = room2.members.map((id) => roster.byId[id]).filter(Boolean);const { entries: entries2 } = useMemberWork(room2, useWork);return [- room2.notice ? (0, import_react48.createElement)(About, { key: "notice", title: "Notice", text: room2.notice }) : (0, import_react48.createElement)("button", { key: "notice", type: "button", className: "bt-more", onClick: openSettings }, t("Add a notice in group settings")),- (0, import_react48.createElement)(- room2.notice ? (0, import_react49.createElement)(About, { key: "notice", title: "Notice", text: room2.notice }) : (0, import_react49.createElement)("button", { key: "notice", type: "button", className: "bt-more", onClick: openSettings }, t("Add a notice in group settings")),- (0, import_react49.createElement)(++ room2.notice ? (0, import_react50.createElement)(About, { key: "notice", title: "Notice", text: room2.notice }) : (0, import_react50.createElement)("button", { key: "notice", type: "button", className: "bt-more", onClick: openSettings }, t("Add a notice in group settings")),++ (0, import_react50.createElement)("div",{ key: "members" },- (0, import_react48.createElement)(- (0, import_react49.createElement)(++ (0, import_react50.createElement)("div",{ className: "bt-members-head" },- (0, import_react48.createElement)("div", { className: "bt-section-title" }, t("Members · {count}", { count: members.length })),- (0, import_react48.createElement)(StopRoomWork, { room: room2, entries: entries2, actions })- (0, import_react49.createElement)("div", { className: "bt-section-title" }, t("Members · {count}", { count: members.length })),- (0, import_react49.createElement)(StopRoomWork, { room: room2, entries: entries2, actions })++ (0, import_react50.createElement)("div", { className: "bt-section-title" }, t("Members · {count}", { count: members.length })),++ (0, import_react50.createElement)(StopRoomWork, { room: room2, entries: entries2, actions })),- (0, import_react48.createElement)("div", { className: "bt-members", role: "list" }, members.map((member) => (0, import_react48.createElement)(MemberRow, {- (0, import_react49.createElement)("div", { className: "bt-members", role: "list" }, members.map((member) => (0, import_react49.createElement)(MemberRow, {++ (0, import_react50.createElement)("div", { className: "bt-members", role: "list" }, members.map((member) => (0, import_react50.createElement)(MemberRow, {key: member.id,member,entry: entries2.find((item) => item.id === member.id),@@@ -17978,24 -18466,51 +18816,51 @@@actions})))),- (0, import_react48.createElement)(- (0, import_react49.createElement)(++ (0, import_react50.createElement)(+ "div",+ { key: "goal" },- (0, import_react49.createElement)("div", { className: "bt-section-title" }, t("Goal")),- (0, import_react49.createElement)(++ (0, import_react50.createElement)("div", { className: "bt-section-title" }, t("Goal")),++ (0, import_react50.createElement)(+ "div",+ { className: "bt-kv" },+ room2.goal ? [- (0, import_react49.createElement)("span", { key: "t" }, room2.goal.title, " ", (0, import_react49.createElement)("span", { className: "bt-note" }, goalView(room2.goal, { roster })?.barLabel ?? "")),- (0, import_react49.createElement)("button", {++ (0, import_react50.createElement)("span", { key: "t" }, room2.goal.title, " ", (0, import_react50.createElement)("span", { className: "bt-note" }, goalView(room2.goal, { roster })?.barLabel ?? "")),++ (0, import_react50.createElement)("button", {+ key: "s",+ type: "button",+ className: "bt-soft bt-soft-sm",+ onClick: () => {+ actions.toggleGoal(room2.id);+ if (typeof document !== "undefined" && document.querySelector("[data-rightbar-fullscreen]")) actions.closeOverlay();+ }+ }, t("Show"))- ] : (0, import_react49.createElement)("button", {++ ] : (0, import_react50.createElement)("button", {+ type: "button",+ className: "bt-soft bt-soft-sm",+ disabled: !canSetGoal(room2, roster),+ title: hasGoalAdmin(room2, roster) ? void 0 : t("This group has no admin"),+ onClick: () => actions.composeGoal(room2.id)+ }, t("Set a goal"))+ )+ ),- (0, import_react49.createElement)(++ (0, import_react50.createElement)("div",{ key: "mode" },- (0, import_react48.createElement)("div", { className: "bt-section-title" }, t("Who answers")),- (0, import_react48.createElement)("div", { className: "bt-kv" }, (0, import_react48.createElement)("span", null, t(ROOM_MODES.find(([id]) => id === shownMode(room2, roster))?.[1] ?? "Everyone")))- (0, import_react49.createElement)("div", { className: "bt-section-title" }, t("Who answers")),- (0, import_react49.createElement)("div", { className: "bt-kv" }, (0, import_react49.createElement)("span", null, t(ROOM_MODES.find(([id]) => id === shownMode(room2, roster))?.[1] ?? "Everyone")))++ (0, import_react50.createElement)("div", { className: "bt-section-title" }, t("Who answers")),++ (0, import_react50.createElement)("div", { className: "bt-kv" }, (0, import_react50.createElement)("span", null, t(ROOM_MODES.find(([id]) => id === shownMode(room2, roster))?.[1] ?? "Everyone")))),- room2.permission ? (0, import_react48.createElement)(- room2.permission ? (0, import_react49.createElement)(++ room2.permission ? (0, import_react50.createElement)("div",{ key: "permission" },- (0, import_react48.createElement)("div", { className: "bt-section-title" }, t("Permissions")),- (0, import_react48.createElement)("div", { className: "bt-kv" }, (0, import_react48.createElement)("span", { className: presetDanger(room2.permission) ? "bt-perm-danger" : void 0 }, presetName(room2.permission, roster.permissions)))- (0, import_react49.createElement)("div", { className: "bt-section-title" }, t("Permissions")),- (0, import_react49.createElement)("div", { className: "bt-kv" }, (0, import_react49.createElement)("span", { className: presetDanger(room2.permission) ? "bt-perm-danger" : void 0 }, presetName(room2.permission, roster.permissions)))++ (0, import_react50.createElement)("div", { className: "bt-section-title" }, t("Permissions")),++ (0, import_react50.createElement)("div", { className: "bt-kv" }, (0, import_react50.createElement)("span", { className: presetDanger(room2.permission) ? "bt-perm-danger" : void 0 }, presetName(room2.permission, roster.permissions)))) : null,- roster.memory === false ? null : (0, import_react48.createElement)(MemoryRow, { key: "memory", owner: { id: room2.id, name: room2.name, group: true }, actions }),- usage ? (0, import_react48.createElement)(- roster.memory === false ? null : (0, import_react49.createElement)(MemoryRow, { key: "memory", owner: { id: room2.id, name: room2.name, group: true }, actions }),- usage ? (0, import_react49.createElement)(++ roster.memory === false ? null : (0, import_react50.createElement)(MemoryRow, { key: "memory", owner: { id: room2.id, name: room2.name, group: true }, actions }),++ usage ? (0, import_react50.createElement)("div",{ key: "usage" },- (0, import_react48.createElement)("div", { className: "bt-section-title" }, t("Usage")),- (0, import_react48.createElement)("div", { className: "bt-kv" }, (0, import_react48.createElement)("span", null, room2.name), (0, import_react48.createElement)("span", null, usage))- (0, import_react49.createElement)("div", { className: "bt-section-title" }, t("Usage")),- (0, import_react49.createElement)("div", { className: "bt-kv" }, (0, import_react49.createElement)("span", null, room2.name), (0, import_react49.createElement)("span", null, usage))++ (0, import_react50.createElement)("div", { className: "bt-section-title" }, t("Usage")),++ (0, import_react50.createElement)("div", { className: "bt-kv" }, (0, import_react50.createElement)("span", null, room2.name), (0, import_react50.createElement)("span", null, usage))) : null];}@@@ -18003,15 -18518,15 +18868,15 @@@ function DetailsDrawer({ sessionId, staconst owner = roster.byId[sessionId];const part = owner ? currentPart(owner) : sessionId;const isMainBot = isMainOf(roster, owner?.id);- const [tab, setTab] = (0, import_react48.useState)("details");- const [tab, setTab] = (0, import_react49.useState)("details");++ const [tab, setTab] = (0, import_react50.useState)("details");const room2 = roster.roomsById[sessionId];- const [view, setView] = (0, import_react48.useState)(startTab === "settings" && (owner || room2) ? "settings" : "overview");- const [editing, setEditing] = (0, import_react48.useState)(Boolean(startRenaming && (roster.byId[sessionId] || roster.roomsById[sessionId])));- const [draftName, setDraftName] = (0, import_react48.useState)(roster.byId[sessionId]?.name ?? (roster.roomsById[sessionId]?.named ? roster.roomsById[sessionId].name : ""));- const [copied, setCopied] = (0, import_react48.useState)(false);- const [error, setError] = (0, import_react48.useState)("");- const [view, setView] = (0, import_react49.useState)(startTab === "settings" && (owner || room2) ? "settings" : "overview");- const [editing, setEditing] = (0, import_react49.useState)(Boolean(startRenaming && (roster.byId[sessionId] || roster.roomsById[sessionId])));- const [draftName, setDraftName] = (0, import_react49.useState)(roster.byId[sessionId]?.name ?? (roster.roomsById[sessionId]?.named ? roster.roomsById[sessionId].name : ""));- const [copied, setCopied] = (0, import_react49.useState)(false);- const [error, setError] = (0, import_react49.useState)("");++ const [view, setView] = (0, import_react50.useState)(startTab === "settings" && (owner || room2) ? "settings" : "overview");++ const [editing, setEditing] = (0, import_react50.useState)(Boolean(startRenaming && (roster.byId[sessionId] || roster.roomsById[sessionId])));++ const [draftName, setDraftName] = (0, import_react50.useState)(roster.byId[sessionId]?.name ?? (roster.roomsById[sessionId]?.named ? roster.roomsById[sessionId].name : ""));++ const [copied, setCopied] = (0, import_react50.useState)(false);++ const [error, setError] = (0, import_react50.useState)("");const glide = useGlide(tab);- const last = (0, import_react48.useRef)({ view, tab, move: void 0 });- const last = (0, import_react49.useRef)({ view, tab, move: void 0 });++ const last = (0, import_react50.useRef)({ view, tab, move: void 0 });if (last.current.view !== view) last.current = { view, tab, move: view === "settings" ? "in" : "out" };else if (last.current.tab !== tab) last.current = { view, tab, move: "tab" };const move = last.current.move;@@@ -18036,21 -18551,21 +18901,21 @@@setTimeout(() => setCopied(false), 1600);});};- const errorLine = error ? (0, import_react48.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null;- const errorLine = error ? (0, import_react49.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null;++ const errorLine = error ? (0, import_react50.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null;if ((bot || room2) && view === "settings") {return [- (0, import_react48.createElement)(- (0, import_react49.createElement)(++ (0, import_react50.createElement)("div",{ key: "head", className: "bt-subhead", "data-move": move },- (0, import_react48.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to details"), onClick: () => setView("overview") }, (0, import_react48.createElement)(ChevronLeftIcon)),- (0, import_react48.createElement)("span", { className: "bt-subhead-title" }, bot ? t("Settings") : t("Group settings")),- hasStrip ? null : (0, import_react48.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close details"), onClick: close }, (0, import_react48.createElement)(CloseIcon))- (0, import_react49.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to details"), onClick: () => setView("overview") }, (0, import_react49.createElement)(ChevronLeftIcon)),- (0, import_react49.createElement)("span", { className: "bt-subhead-title" }, bot ? t("Settings") : t("Group settings")),- hasStrip ? null : (0, import_react49.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close details"), onClick: close }, (0, import_react49.createElement)(CloseIcon))++ (0, import_react50.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to details"), onClick: () => setView("overview") }, (0, import_react50.createElement)(ChevronLeftIcon)),++ (0, import_react50.createElement)("span", { className: "bt-subhead-title" }, bot ? t("Settings") : t("Group settings")),++ hasStrip ? null : (0, import_react50.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close details"), onClick: close }, (0, import_react50.createElement)(CloseIcon))),- (0, import_react48.createElement)(- (0, import_react49.createElement)(++ (0, import_react50.createElement)("div",{ key: "set-body", className: "bt-drawer-body bt-set-body", "data-move": move },errorLine,- bot ? (0, import_react48.createElement)(BotSettingsForm, { bot, roster, actions, run: run2 }) : (0, import_react48.createElement)(GroupSettingsForm, { room: room2, roster, actions, run: run2, onDeleted: close })- bot ? (0, import_react49.createElement)(BotSettingsForm, { bot, roster, actions, run: run2 }) : (0, import_react49.createElement)(GroupSettingsForm, { room: room2, roster, actions, run: run2, onDeleted: close })++ bot ? (0, import_react50.createElement)(BotSettingsForm, { bot, roster, actions, run: run2 }) : (0, import_react50.createElement)(GroupSettingsForm, { room: room2, roster, actions, run: run2, onDeleted: close }))];}@@@ -18061,18 -18576,18 +18926,18 @@@canTerminal: actions.canOpenTerminal?.() === true,canFiles: actions.canOpenFiles?.() === true}).map((key) => menuItemFor(key, actions, sessionId));- const top = (0, import_react48.createElement)(- const top = (0, import_react49.createElement)(++ const top = (0, import_react50.createElement)("div",{ className: "bt-drawer-top", "data-move": side },- bot || room2 ? (0, import_react48.createElement)("button", { type: "button", className: "bt-round", "aria-label": bot ? t("Edit Bot") : t("Group settings"), title: bot ? t("Edit Bot") : t("Group settings"), "data-info-row": "settings", onClick: () => setView("settings") }, (0, import_react48.createElement)(GearIcon)) : null,- more.length > 0 ? (0, import_react48.createElement)("span", { "data-info-row": "more" }, (0, import_react48.createElement)(PanelMenu, { items: more, className: "bt-round", "aria-label": t("More") })) : null,- bot || room2 ? (0, import_react48.createElement)("button", { type: "button", className: "bt-round", "aria-label": copied ? t("Copied conversation") : t("Share conversation"), title: copied ? t("Copied") : t("Copy conversation as Markdown"), onClick: share }, copied ? (0, import_react48.createElement)("span", { key: "copied", className: "bt-pop-in" }, "✓") : (0, import_react48.createElement)(ShareIcon)) : null,- hasStrip ? null : (0, import_react48.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("Close details"), onClick: close }, (0, import_react48.createElement)(CloseIcon))- bot || room2 ? (0, import_react49.createElement)("button", { type: "button", className: "bt-round", "aria-label": bot ? t("Edit Bot") : t("Group settings"), title: bot ? t("Edit Bot") : t("Group settings"), "data-info-row": "settings", onClick: () => setView("settings") }, (0, import_react49.createElement)(GearIcon)) : null,- more.length > 0 ? (0, import_react49.createElement)("span", { "data-info-row": "more" }, (0, import_react49.createElement)(PanelMenu, { items: more, className: "bt-round", "aria-label": t("More") })) : null,- bot || room2 ? (0, import_react49.createElement)("button", { type: "button", className: "bt-round", "aria-label": copied ? t("Copied conversation") : t("Share conversation"), title: copied ? t("Copied") : t("Copy conversation as Markdown"), onClick: share }, copied ? (0, import_react49.createElement)("span", { key: "copied", className: "bt-pop-in" }, "✓") : (0, import_react49.createElement)(ShareIcon)) : null,- hasStrip ? null : (0, import_react49.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("Close details"), onClick: close }, (0, import_react49.createElement)(CloseIcon))++ bot || room2 ? (0, import_react50.createElement)("button", { type: "button", className: "bt-round", "aria-label": bot ? t("Edit Bot") : t("Group settings"), title: bot ? t("Edit Bot") : t("Group settings"), "data-info-row": "settings", onClick: () => setView("settings") }, (0, import_react50.createElement)(GearIcon)) : null,++ more.length > 0 ? (0, import_react50.createElement)("span", { "data-info-row": "more" }, (0, import_react50.createElement)(PanelMenu, { items: more, className: "bt-round", "aria-label": t("More") })) : null,++ bot || room2 ? (0, import_react50.createElement)("button", { type: "button", className: "bt-round", "aria-label": copied ? t("Copied conversation") : t("Share conversation"), title: copied ? t("Copied") : t("Copy conversation as Markdown"), onClick: share }, copied ? (0, import_react50.createElement)("span", { key: "copied", className: "bt-pop-in" }, "✓") : (0, import_react50.createElement)(ShareIcon)) : null,++ hasStrip ? null : (0, import_react50.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("Close details"), onClick: close }, (0, import_react50.createElement)(CloseIcon)));if (!bot && !room2) {return [- (0, import_react48.createElement)(import_react48.Fragment, { key: "top" }, top),- (0, import_react48.createElement)("div", { key: "body", className: "bt-drawer-body" }, (0, import_react48.createElement)("div", { className: "bt-muted" }, t("This conversation is not part of your Bot team.")))- (0, import_react49.createElement)(import_react49.Fragment, { key: "top" }, top),- (0, import_react49.createElement)("div", { key: "body", className: "bt-drawer-body" }, (0, import_react49.createElement)("div", { className: "bt-muted" }, t("This conversation is not part of your Bot team.")))++ (0, import_react50.createElement)(import_react50.Fragment, { key: "top" }, top),++ (0, import_react50.createElement)("div", { key: "body", className: "bt-drawer-body" }, (0, import_react50.createElement)("div", { className: "bt-muted" }, t("This conversation is not part of your Bot team.")))];}const current = bot?.name ?? room2.name;@@@ -18086,12 -18601,12 +18951,12 @@@const subtitle = bot ? bot.role : roomSubtitle(room2, roster);const tabs = bot ? ["details", "browser"] : ["details"];return [- (0, import_react48.createElement)(import_react48.Fragment, { key: "top" }, top),- (0, import_react48.createElement)(- (0, import_react49.createElement)(import_react49.Fragment, { key: "top" }, top),- (0, import_react49.createElement)(++ (0, import_react50.createElement)(import_react50.Fragment, { key: "top" }, top),++ (0, import_react50.createElement)("div",{ key: "id", className: "bt-drawer-id", "data-move": side },- bot ? (0, import_react48.createElement)(BotAvatar, { bot, size: 64, state: botState(running, doing, roster.questions?.[part] !== void 0), main: isMainBot, badge: false, gaze: true, pokeable: true }) : (0, import_react48.createElement)(MemberPile, { room: room2, roster }),- editing ? (0, import_react48.createElement)("input", {- bot ? (0, import_react49.createElement)(BotAvatar, { bot, size: 64, state: botState(running, doing, roster.questions?.[part] !== void 0), main: isMainBot, badge: false, gaze: true, pokeable: true }) : (0, import_react49.createElement)(MemberPile, { room: room2, roster }),- editing ? (0, import_react49.createElement)("input", {++ bot ? (0, import_react50.createElement)(BotAvatar, { bot, size: 64, state: botState(running, doing, roster.questions?.[part] !== void 0), main: isMainBot, badge: false, gaze: true, pokeable: true }) : (0, import_react50.createElement)(MemberPile, { room: room2, roster }),++ editing ? (0, import_react50.createElement)("input", {className: "bt-drawer-name-input",autoFocus: true,value: draftName,@@@ -18106,50 -18621,50 +18971,50 @@@setEditing(false);}}- }) : (0, import_react48.createElement)("button", { type: "button", className: "bt-drawer-name", "aria-label": t("Rename {name}", { name: current }), title: t("Rename"), onClick: () => {- }) : (0, import_react49.createElement)("button", { type: "button", className: "bt-drawer-name", "aria-label": t("Rename {name}", { name: current }), title: t("Rename"), onClick: () => {++ }) : (0, import_react50.createElement)("button", { type: "button", className: "bt-drawer-name", "aria-label": t("Rename {name}", { name: current }), title: t("Rename"), onClick: () => {setDraftName(room2 && !room2.named ? "" : current);setEditing(true);} }, current),- subtitle ? (0, import_react48.createElement)("span", { className: "bt-drawer-role" }, subtitle) : null- subtitle ? (0, import_react49.createElement)("span", { className: "bt-drawer-role" }, subtitle) : null++ subtitle ? (0, import_react50.createElement)("span", { className: "bt-drawer-role" }, subtitle) : null),- tabs.length > 1 ? (0, import_react48.createElement)(- tabs.length > 1 ? (0, import_react49.createElement)(++ tabs.length > 1 ? (0, import_react50.createElement)("div",{ key: "tabs", ref: glide.box, className: "bt-tabs", role: "tablist", "data-move": side },- (0, import_react48.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),- tabs.map((key) => (0, import_react48.createElement)("button", { key, type: "button", role: "tab", className: "bt-tab", "aria-selected": tab === key, onClick: () => setTab(key) }, t(TAB_LABELS[key])))- (0, import_react49.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),- tabs.map((key) => (0, import_react49.createElement)("button", { key, type: "button", role: "tab", className: "bt-tab", "aria-selected": tab === key, onClick: () => setTab(key) }, t(TAB_LABELS[key])))++ (0, import_react50.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),++ tabs.map((key) => (0, import_react50.createElement)("button", { key, type: "button", role: "tab", className: "bt-tab", "aria-selected": tab === key, onClick: () => setTab(key) }, t(TAB_LABELS[key])))) : null,- (0, import_react48.createElement)(- (0, import_react49.createElement)(++ (0, import_react50.createElement)("div",{ key: `body:${tab}`, className: "bt-drawer-body", "data-move": move },errorLine,- room2 && tab === "details" ? (0, import_react48.createElement)(GroupOverview, { room: room2, roster, actions, usage, useWork, openSettings: () => setView("settings") }) : null,- room2 && tab === "details" ? (0, import_react49.createElement)(GroupOverview, { room: room2, roster, actions, usage, useWork, openSettings: () => setView("settings") }) : null,++ room2 && tab === "details" ? (0, import_react50.createElement)(GroupOverview, { room: room2, roster, actions, usage, useWork, openSettings: () => setView("settings") }) : null,bot && tab === "details" ? [- (0, import_react48.createElement)(RunStats, { key: "stats", bot, part, running, actions }),- (0, import_react48.createElement)(- (0, import_react49.createElement)(RunStats, { key: "stats", bot, part, running, actions }),- (0, import_react49.createElement)(++ (0, import_react50.createElement)(RunStats, { key: "stats", bot, part, running, actions }),++ (0, import_react50.createElement)("div",{ key: "model", className: "bt-drawer-model" },- (0, import_react48.createElement)("div", { className: "bt-section-title" }, t("Model")),- (0, import_react48.createElement)(ModelMenu, { bot, roster, actions, run: run2, wide: true }),- modelOf(bot, roster) ? null : (0, import_react48.createElement)("div", { className: "bt-note" }, t("Pick a model and {name} can start.", { name: bot.name }))- (0, import_react49.createElement)("div", { className: "bt-section-title" }, t("Model")),- (0, import_react49.createElement)(ModelMenu, { bot, roster, actions, run: run2, wide: true }),- modelOf(bot, roster) ? null : (0, import_react49.createElement)("div", { className: "bt-note" }, t("Pick a model and {name} can start.", { name: bot.name }))++ (0, import_react50.createElement)("div", { className: "bt-section-title" }, t("Model")),++ (0, import_react50.createElement)(ModelMenu, { bot, roster, actions, run: run2, wide: true }),++ modelOf(bot, roster) ? null : (0, import_react50.createElement)("div", { className: "bt-note" }, t("Pick a model and {name} can start.", { name: bot.name }))),- (0, import_react48.createElement)(PermissionRow, { key: "permission", bot, roster, actions, run: run2 }),- (0, import_react48.createElement)(- (0, import_react49.createElement)(PermissionRow, { key: "permission", bot, roster, actions, run: run2 }),- (0, import_react49.createElement)(++ (0, import_react50.createElement)(PermissionRow, { key: "permission", bot, roster, actions, run: run2 }),++ (0, import_react50.createElement)("div",{ key: "folder", className: "bt-drawer-model" },- (0, import_react48.createElement)("div", { className: "bt-section-title" }, t("Working folder")),- (0, import_react48.createElement)(FolderMenu, { value: bot.workDir, actions, run: run2, wide: true, onPick: (workDir) => run2(actions.updateBot(bot.id, { workDir })) })- (0, import_react49.createElement)("div", { className: "bt-section-title" }, t("Working folder")),- (0, import_react49.createElement)(FolderMenu, { value: bot.workDir, actions, run: run2, wide: true, onPick: (workDir) => run2(actions.updateBot(bot.id, { workDir })) })++ (0, import_react50.createElement)("div", { className: "bt-section-title" }, t("Working folder")),++ (0, import_react50.createElement)(FolderMenu, { value: bot.workDir, actions, run: run2, wide: true, onPick: (workDir) => run2(actions.updateBot(bot.id, { workDir })) })),- bot.instructions ? (0, import_react48.createElement)(About, { key: "about", text: bot.instructions }) : (0, import_react48.createElement)("button", { key: "about", type: "button", className: "bt-more", onClick: () => setView("settings") }, t("Add instructions in Bot settings")),- roster.memory === false ? null : (0, import_react48.createElement)(MemoryRow, { key: "memory", owner: { id: bot.id, name: bot.name }, actions }),- usage ? (0, import_react48.createElement)(- bot.instructions ? (0, import_react49.createElement)(About, { key: "about", text: bot.instructions }) : (0, import_react49.createElement)("button", { key: "about", type: "button", className: "bt-more", onClick: () => setView("settings") }, t("Add instructions in Bot settings")),- roster.memory === false ? null : (0, import_react49.createElement)(MemoryRow, { key: "memory", owner: { id: bot.id, name: bot.name }, actions }),- usage ? (0, import_react49.createElement)(++ bot.instructions ? (0, import_react50.createElement)(About, { key: "about", text: bot.instructions }) : (0, import_react50.createElement)("button", { key: "about", type: "button", className: "bt-more", onClick: () => setView("settings") }, t("Add instructions in Bot settings")),++ roster.memory === false ? null : (0, import_react50.createElement)(MemoryRow, { key: "memory", owner: { id: bot.id, name: bot.name }, actions }),++ usage ? (0, import_react50.createElement)("div",{ key: "usage" },- (0, import_react48.createElement)("div", { className: "bt-section-title" }, t("Usage")),- (0, import_react48.createElement)("div", { className: "bt-kv" }, (0, import_react48.createElement)("span", null, bot.name), (0, import_react48.createElement)("span", null, usage))- (0, import_react49.createElement)("div", { className: "bt-section-title" }, t("Usage")),- (0, import_react49.createElement)("div", { className: "bt-kv" }, (0, import_react49.createElement)("span", null, bot.name), (0, import_react49.createElement)("span", null, usage))++ (0, import_react50.createElement)("div", { className: "bt-section-title" }, t("Usage")),++ (0, import_react50.createElement)("div", { className: "bt-kv" }, (0, import_react50.createElement)("span", null, bot.name), (0, import_react50.createElement)("span", null, usage))) : null,- (0, import_react48.createElement)(ScheduleSummary, { key: "routines", bot, actions })- (0, import_react49.createElement)(ScheduleSummary, { key: "routines", bot, actions })++ (0, import_react50.createElement)(ScheduleSummary, { key: "routines", bot, actions })] : null,- bot && tab === "browser" ? (0, import_react48.createElement)(BrowserCards, { bot, sessionId, roster, actions, useBrowserTabs, useBrowserPages }) : null- bot && tab === "browser" ? (0, import_react49.createElement)(BrowserCards, { bot, sessionId, roster, actions, useBrowserTabs, useBrowserPages }) : null++ bot && tab === "browser" ? (0, import_react50.createElement)(BrowserCards, { bot, sessionId, roster, actions, useBrowserTabs, useBrowserPages }) : null)];}@@@ -18160,7 -18675,7 +19025,7 @@@ function rectsOverlap(a, b)}// src/client/browser-pane.js- var import_react49 = require("react");-var import_react50 = require("react");++var import_react51 = require("react");var import_react_dom8 = require("react-dom");var PANEL_LINGER_MS = 300;var WIDTH_KEY = STORAGE.browserWidth;@@@ -18174,10 -18689,10 +19039,10 @@@ var EMPTY_TABS2 = { ids: [], active: nuvar SPRING_LEAD2 = springEasing(576, 39.4);var SPRING_TRAIL2 = springEasing(144, 19.7);var icon = (paths) => function BrowserIcon() {- return (0, import_react49.createElement)(- return (0, import_react50.createElement)(++ return (0, import_react51.createElement)("svg",{ width: 16, height: 16, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true },- paths.map((d, index) => (0, import_react49.createElement)("path", { key: index, d }))- paths.map((d, index) => (0, import_react50.createElement)("path", { key: index, d }))++ paths.map((d, index) => (0, import_react51.createElement)("path", { key: index, d })));};var GlobeIcon2 = icon(["M10 3a7 7 0 1 0 0 14 7 7 0 0 0 0-14z", "M3 10h14", "M10 3c2 2.2 2.9 4.5 2.9 7S12 14.8 10 17c-2-2.2-2.9-4.5-2.9-7S8 5.2 10 3z"]);@@@ -18192,9 -18707,9 +19057,9 @@@ var ImportIcon = icon(["M10 3.5v8.5", "var FileIcon = icon(["M6 3.5h5.5L14.5 6.5v10H6z", "M11 3.5v3.5h3.5"]);var WindowIcon = icon(["M4 5h12v9.5H4z", "M4 7.5h12"]);function Favicon({ src, className }) {- const [failed, setFailed] = (0, import_react49.useState)(null);- if (!src || failed === src) return (0, import_react49.createElement)("span", { className: `${className} bt-ptab-globe` }, (0, import_react49.createElement)(GlobeIcon2));- return (0, import_react49.createElement)("img", { className, src, alt: "", "aria-hidden": true, onError: () => setFailed(src) });- const [failed, setFailed] = (0, import_react50.useState)(null);- if (!src || failed === src) return (0, import_react50.createElement)("span", { className: `${className} bt-ptab-globe` }, (0, import_react50.createElement)(GlobeIcon2));- return (0, import_react50.createElement)("img", { className, src, alt: "", "aria-hidden": true, onError: () => setFailed(src) });++ const [failed, setFailed] = (0, import_react51.useState)(null);++ if (!src || failed === src) return (0, import_react51.createElement)("span", { className: `${className} bt-ptab-globe` }, (0, import_react51.createElement)(GlobeIcon2));++ return (0, import_react51.createElement)("img", { className, src, alt: "", "aria-hidden": true, onError: () => setFailed(src) });}var savedWidth = () => {try {@@@ -18210,9 -18725,9 +19075,9 @@@ var shortAddress = (url) => String(urlvar reducedMotion2 = () => typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;var tabLabel = (page) => page.title || shortAddress(page.url) || t("New tab");function PanelMenu({ items, className, "aria-label": label }) {- const [open, setOpen] = (0, import_react49.useState)(false);- const wrap = (0, import_react49.useRef)(null);- (0, import_react49.useEffect)(() => {- const [open, setOpen] = (0, import_react50.useState)(false);- const wrap = (0, import_react50.useRef)(null);- (0, import_react50.useEffect)(() => {++ const [open, setOpen] = (0, import_react51.useState)(false);++ const wrap = (0, import_react51.useRef)(null);++ (0, import_react51.useEffect)(() => {if (!open) return void 0;const onDown = (event) => {if (wrap.current && !wrap.current.contains(event.target)) setOpen(false);@@@ -18230,10 -18745,10 +19095,10 @@@};}, [open]);if (items.length === 0) return null;- return (0, import_react49.createElement)(- return (0, import_react50.createElement)(++ return (0, import_react51.createElement)("span",{ className: "bt-pmenu", ref: wrap },- (0, import_react49.createElement)("button", {- (0, import_react50.createElement)("button", {++ (0, import_react51.createElement)("button", {type: "button",className,"aria-label": label,@@@ -18241,11 -18756,11 +19106,11 @@@"aria-haspopup": "menu","aria-expanded": open,onClick: () => setOpen((value) => !value)- }, (0, import_react49.createElement)(DotsIcon)),- open ? (0, import_react49.createElement)(- }, (0, import_react50.createElement)(DotsIcon)),- open ? (0, import_react50.createElement)(++ }, (0, import_react51.createElement)(DotsIcon)),++ open ? (0, import_react51.createElement)("div",{ className: "bt-pmenu-pop", role: "menu" },- items.map((item, index) => item.sep ? (0, import_react49.createElement)("span", { key: `sep-${index}`, className: "bt-pmenu-sep", role: "separator" }) : (0, import_react49.createElement)("button", {- items.map((item, index) => item.sep ? (0, import_react50.createElement)("span", { key: `sep-${index}`, className: "bt-pmenu-sep", role: "separator" }) : (0, import_react50.createElement)("button", {++ items.map((item, index) => item.sep ? (0, import_react51.createElement)("span", { key: `sep-${index}`, className: "bt-pmenu-sep", role: "separator" }) : (0, import_react51.createElement)("button", {key: item.key,type: "button",role: "menuitem",@@@ -18254,7 -18769,7 +19119,7 @@@setOpen(false);item.onPick();}- }, (0, import_react49.createElement)(item.icon), (0, import_react49.createElement)("span", null, item.label)))- }, (0, import_react50.createElement)(item.icon), (0, import_react50.createElement)("span", null, item.label)))++ }, (0, import_react51.createElement)(item.icon), (0, import_react51.createElement)("span", null, item.label)))) : null);}@@@ -18280,12 -18795,12 +19145,12 @@@ function menuItemFor(key, actions, subjvar sideTitle = (chat) => chat?.entries?.[0]?.question?.trim() || t("Side chat");function PanelStrip({ bot, subject, view, ids, active, sides, side, canBrowse, reading, onView, actions, useBrowserPages }) {const pages = useBrowserPages((map) => map);- const wrap = (0, import_react49.useRef)(null);- const ind = (0, import_react49.useRef)(null);- const spot = (0, import_react49.useRef)(null);- const under = (0, import_react49.useRef)(null);- const watcher = (0, import_react49.useRef)(null);- (0, import_react49.useLayoutEffect)(() => {- const wrap = (0, import_react50.useRef)(null);- const ind = (0, import_react50.useRef)(null);- const spot = (0, import_react50.useRef)(null);- const under = (0, import_react50.useRef)(null);- const watcher = (0, import_react50.useRef)(null);- (0, import_react50.useLayoutEffect)(() => {++ const wrap = (0, import_react51.useRef)(null);++ const ind = (0, import_react51.useRef)(null);++ const spot = (0, import_react51.useRef)(null);++ const under = (0, import_react51.useRef)(null);++ const watcher = (0, import_react51.useRef)(null);++ (0, import_react51.useLayoutEffect)(() => {const box = wrap.current;const capsule = ind.current;if (!box || !capsule) return void 0;@@@ -18318,7 -18833,7 +19183,7 @@@trail.cancel();};});- (0, import_react49.useEffect)(() => {- (0, import_react50.useEffect)(() => {++ (0, import_react51.useEffect)(() => {const box = wrap.current;if (!box) return void 0;const observer = new ResizeObserver(() => {@@@ -18342,13 -18857,13 +19207,13 @@@canTerminal: actions.canOpenTerminal?.() === true,canFiles: actions.canOpenFiles?.() === true}).map((key) => menuItemFor(key, actions, subject));- return (0, import_react49.createElement)(- return (0, import_react50.createElement)(++ return (0, import_react51.createElement)("div",{ className: "bt-ptabs", role: "tablist", "aria-label": t("Panel tabs") },- (0, import_react49.createElement)(- (0, import_react50.createElement)(++ (0, import_react51.createElement)("div",{ className: "bt-ptabs-in", ref: wrap },- (0, import_react49.createElement)(- (0, import_react50.createElement)(++ (0, import_react51.createElement)("button",{type: "button",@@@ -18358,13 -18873,13 +19223,13 @@@title: bot.name,onClick: () => onView("details")},- (0, import_react49.createElement)(BotMark, { bot, size: 20, state: reading ? "searching" : "idle" }),- view === "details" ? (0, import_react49.createElement)("span", { className: "bt-ptab-name" }, bot.name) : null- (0, import_react50.createElement)(BotMark, { bot, size: 20, state: reading ? "searching" : "idle" }),- view === "details" ? (0, import_react50.createElement)("span", { className: "bt-ptab-name" }, bot.name) : null++ (0, import_react51.createElement)(BotMark, { bot, size: 20, state: reading ? "searching" : "idle" }),++ view === "details" ? (0, import_react51.createElement)("span", { className: "bt-ptab-name" }, bot.name) : null),ids.map((tabId) => {const page = pages[tabId] ?? EMPTY_PAGE;const on = view === "browser" && tabId === active;- return (0, import_react49.createElement)(- return (0, import_react50.createElement)(++ return (0, import_react51.createElement)("button",{key: tabId,@@@ -18385,9 -18900,9 +19250,9 @@@}}},- (0, import_react49.createElement)(Favicon, { src: page.favicon, className: "bt-ptab-fav" }),- (0, import_react49.createElement)("span", { className: "bt-ptab-title" }, tabLabel(page)),- (0, import_react49.createElement)("span", {- (0, import_react50.createElement)(Favicon, { src: page.favicon, className: "bt-ptab-fav" }),- (0, import_react50.createElement)("span", { className: "bt-ptab-title" }, tabLabel(page)),- (0, import_react50.createElement)("span", {++ (0, import_react51.createElement)(Favicon, { src: page.favicon, className: "bt-ptab-fav" }),++ (0, import_react51.createElement)("span", { className: "bt-ptab-title" }, tabLabel(page)),++ (0, import_react51.createElement)("span", {className: "bt-ptab-x",role: "button","aria-label": t("Close tab"),@@@ -18401,7 -18916,7 +19266,7 @@@}),sides.map((chat) => {const on = view === "side" && chat.id === side;- return (0, import_react49.createElement)(- return (0, import_react50.createElement)(++ return (0, import_react51.createElement)("button",{key: chat.id,@@@ -18419,9 -18934,9 +19284,9 @@@}}},- (0, import_react49.createElement)("span", { className: "bt-ptab-globe", "aria-hidden": true }, (0, import_react49.createElement)(SideIcon)),- (0, import_react49.createElement)("span", { className: "bt-ptab-title" }, sideTitle(chat)),- (0, import_react49.createElement)("span", {- (0, import_react50.createElement)("span", { className: "bt-ptab-globe", "aria-hidden": true }, (0, import_react50.createElement)(SideIcon)),- (0, import_react50.createElement)("span", { className: "bt-ptab-title" }, sideTitle(chat)),- (0, import_react50.createElement)("span", {++ (0, import_react51.createElement)("span", { className: "bt-ptab-globe", "aria-hidden": true }, (0, import_react51.createElement)(SideIcon)),++ (0, import_react51.createElement)("span", { className: "bt-ptab-title" }, sideTitle(chat)),++ (0, import_react51.createElement)("span", {className: "bt-ptab-x",role: "button","aria-label": t("Close side chat"),@@@ -18433,30 -18948,30 +19298,30 @@@}, "×"));}),- (0, import_react49.createElement)("span", { ref: ind, className: "bt-ptab-ind", "aria-hidden": true })- (0, import_react50.createElement)("span", { ref: ind, className: "bt-ptab-ind", "aria-hidden": true })++ (0, import_react51.createElement)("span", { ref: ind, className: "bt-ptab-ind", "aria-hidden": true })),// The `···` and Close stay outside the scrolling tabs, so a narrow panel keeps both.- (0, import_react49.createElement)(PanelMenu, { items, className: "bt-ptab-new", "aria-label": t("More") }),- (0, import_react49.createElement)("button", { type: "button", className: "bt-icon-btn bt-ptab-close", "aria-label": t("Close panel"), title: t("Close panel"), onClick: () => actions.closePanel() }, (0, import_react49.createElement)(CloseIcon3))- (0, import_react50.createElement)(PanelMenu, { items, className: "bt-ptab-new", "aria-label": t("More") }),- (0, import_react50.createElement)("button", { type: "button", className: "bt-icon-btn bt-ptab-close", "aria-label": t("Close panel"), title: t("Close panel"), onClick: () => actions.closePanel() }, (0, import_react50.createElement)(CloseIcon3))++ (0, import_react51.createElement)(PanelMenu, { items, className: "bt-ptab-new", "aria-label": t("More") }),++ (0, import_react51.createElement)("button", { type: "button", className: "bt-icon-btn bt-ptab-close", "aria-label": t("Close panel"), title: t("Close panel"), onClick: () => actions.closePanel() }, (0, import_react51.createElement)(CloseIcon3)));}function BrowserView({ bot, tabId, leaving, landed, actions, useBrowserPages, hold }) {const page = useBrowserPages((pages) => pages[tabId ?? ""]) ?? EMPTY_PAGE;- const frame = (0, import_react49.useRef)(null);- const input = (0, import_react49.useRef)(null);- const [draft, setDraft] = (0, import_react49.useState)(null);- const [covered, setCovered] = (0, import_react49.useState)(false);- const frame = (0, import_react50.useRef)(null);- const input = (0, import_react50.useRef)(null);- const [draft, setDraft] = (0, import_react50.useState)(null);- const [covered, setCovered] = (0, import_react50.useState)(false);++ const frame = (0, import_react51.useRef)(null);++ const input = (0, import_react51.useRef)(null);++ const [draft, setDraft] = (0, import_react51.useState)(null);++ const [covered, setCovered] = (0, import_react51.useState)(false);const imports = actions.browserImport;- const [flow, setFlow] = (0, import_react49.useState)(null);- const flowRef = (0, import_react49.useRef)(null);- const [sources, setSources] = (0, import_react49.useState)(null);- const [busy, setBusy] = (0, import_react49.useState)(false);- const [flow, setFlow] = (0, import_react50.useState)(null);- const flowRef = (0, import_react50.useRef)(null);- const [sources, setSources] = (0, import_react50.useState)(null);- const [busy, setBusy] = (0, import_react50.useState)(false);++ const [flow, setFlow] = (0, import_react51.useState)(null);++ const flowRef = (0, import_react51.useRef)(null);++ const [sources, setSources] = (0, import_react51.useState)(null);++ const [busy, setBusy] = (0, import_react51.useState)(false);const setFlowTracked = (next) => {flowRef.current = typeof next === "function" ? next(flowRef.current) : next;setFlow(flowRef.current);};const showGuest = landed && !leaving && !covered && Boolean(page.url) && !page.error && flow === null;- (0, import_react49.useEffect)(() => {- (0, import_react50.useEffect)(() => {++ (0, import_react51.useEffect)(() => {const update = () => {const panel = frame.current?.getBoundingClientRect();const overlaps2 = panel && [...document.querySelectorAll('[role="dialog"],[role="menu"],[role="listbox"]')].some((element) => rectsOverlap(panel, element.getBoundingClientRect()));@@@ -18471,7 -18986,7 +19336,7 @@@window.removeEventListener("resize", update);};}, []);- (0, import_react49.useEffect)(() => {- (0, import_react50.useEffect)(() => {++ (0, import_react51.useEffect)(() => {setFlowTracked(null);return () => {const id = typeof flowRef.current === "object" && flowRef.current !== null ? flowRef.current.id : null;@@@ -18515,7 -19030,7 +19380,7 @@@if (id) void imports?.cancel(id).catch(() => {});};- (0, import_react49.useLayoutEffect)(() => {- (0, import_react50.useLayoutEffect)(() => {++ (0, import_react51.useLayoutEffect)(() => {const element = frame.current;if (!element || leaving || !tabId) {void actions.browserShow(null);@@@ -18541,7 -19056,7 +19406,7 @@@window.removeEventListener("resize", schedule);};}, [tabId, showGuest, leaving]);- (0, import_react49.useEffect)(() => {- (0, import_react50.useEffect)(() => {++ (0, import_react51.useEffect)(() => {setDraft(null);if (landed && !page.url) input.current?.focus();}, [tabId, landed]);@@@ -18557,38 -19072,38 +19422,38 @@@};const editing = draft !== null;const secure = /^https:/i.test(page.url);- return (0, import_react49.createElement)(- return (0, import_react50.createElement)(++ return (0, import_react51.createElement)("div",{ className: "bt-panel-view bt-panel-browser", "aria-label": t("{name}'s browser", { name: bot.name }) },- actions.browserTakeover ? (0, import_react49.createElement)(- actions.browserTakeover ? (0, import_react50.createElement)(++ actions.browserTakeover ? (0, import_react51.createElement)("div",{ className: "bt-browser-takeover", "data-held": hold?.by === "user" || void 0 },- (0, import_react49.createElement)("span", null, hold?.by === "user" ? t("You control this browser") : hold?.by === "bot" ? t("The Bot handed this browser to you: {reason}", { reason: hold.reason }) : t("The Bot controls this browser")),- hold?.by ? (0, import_react49.createElement)("button", { type: "button", onClick: () => void actions.browserGiveBack(bot.id) }, t("Give back")) : (0, import_react49.createElement)(- (0, import_react50.createElement)("span", null, hold?.by === "user" ? t("You control this browser") : hold?.by === "bot" ? t("The Bot handed this browser to you: {reason}", { reason: hold.reason }) : t("The Bot controls this browser")),- hold?.by ? (0, import_react50.createElement)("button", { type: "button", onClick: () => void actions.browserGiveBack(bot.id) }, t("Give back")) : (0, import_react50.createElement)(++ (0, import_react51.createElement)("span", null, hold?.by === "user" ? t("You control this browser") : hold?.by === "bot" ? t("The Bot handed this browser to you: {reason}", { reason: hold.reason }) : t("The Bot controls this browser")),++ hold?.by ? (0, import_react51.createElement)("button", { type: "button", onClick: () => void actions.browserGiveBack(bot.id) }, t("Give back")) : (0, import_react51.createElement)("span",{ className: "bt-browser-takeover-actions" },- (0, import_react49.createElement)("button", { type: "button", onClick: () => void actions.browserTakeover(bot.id) }, t("Take over")),- (0, import_react49.createElement)("button", { type: "button", onClick: () => void actions.browserStop(bot.id) }, t("Stop"))- (0, import_react50.createElement)("button", { type: "button", onClick: () => void actions.browserTakeover(bot.id) }, t("Take over")),- (0, import_react50.createElement)("button", { type: "button", onClick: () => void actions.browserStop(bot.id) }, t("Stop"))++ (0, import_react51.createElement)("button", { type: "button", onClick: () => void actions.browserTakeover(bot.id) }, t("Take over")),++ (0, import_react51.createElement)("button", { type: "button", onClick: () => void actions.browserStop(bot.id) }, t("Stop")))) : null,- (0, import_react49.createElement)(- (0, import_react50.createElement)(++ (0, import_react51.createElement)("div",{ className: "bt-browser-bar" },- (0, import_react49.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back"), title: t("Back"), disabled: !page.canGoBack, onClick: () => actions.browserCommand(tabId, "back") }, (0, import_react49.createElement)(BackIcon)),- (0, import_react49.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Forward"), title: t("Forward"), disabled: !page.canGoForward, onClick: () => actions.browserCommand(tabId, "forward") }, (0, import_react49.createElement)(ForwardIcon)),- (0, import_react49.createElement)("button", {- (0, import_react50.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back"), title: t("Back"), disabled: !page.canGoBack, onClick: () => actions.browserCommand(tabId, "back") }, (0, import_react50.createElement)(BackIcon)),- (0, import_react50.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Forward"), title: t("Forward"), disabled: !page.canGoForward, onClick: () => actions.browserCommand(tabId, "forward") }, (0, import_react50.createElement)(ForwardIcon)),- (0, import_react50.createElement)("button", {++ (0, import_react51.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back"), title: t("Back"), disabled: !page.canGoBack, onClick: () => actions.browserCommand(tabId, "back") }, (0, import_react51.createElement)(BackIcon)),++ (0, import_react51.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Forward"), title: t("Forward"), disabled: !page.canGoForward, onClick: () => actions.browserCommand(tabId, "forward") }, (0, import_react51.createElement)(ForwardIcon)),++ (0, import_react51.createElement)("button", {type: "button",className: "bt-icon-btn",disabled: !page.url,"aria-label": page.loading ? t("Stop") : t("Reload"),title: page.loading ? t("Stop") : t("Reload"),onClick: () => actions.browserCommand(tabId, page.loading ? "stop" : "reload")- }, (0, import_react49.createElement)(page.loading ? StopIcon : ReloadIcon)),- (0, import_react49.createElement)(- }, (0, import_react50.createElement)(page.loading ? StopIcon : ReloadIcon)),- (0, import_react50.createElement)(++ }, (0, import_react51.createElement)(page.loading ? StopIcon : ReloadIcon)),++ (0, import_react51.createElement)("form",{ className: "bt-browser-address", onSubmit: go, "data-editing": editing || void 0 },- (0, import_react49.createElement)("span", { className: "bt-browser-scheme", "aria-hidden": true }, (0, import_react49.createElement)(secure && !editing ? LockIcon2 : GlobeIcon2)),- (0, import_react49.createElement)("input", {- (0, import_react50.createElement)("span", { className: "bt-browser-scheme", "aria-hidden": true }, (0, import_react50.createElement)(secure && !editing ? LockIcon2 : GlobeIcon2)),- (0, import_react50.createElement)("input", {++ (0, import_react51.createElement)("span", { className: "bt-browser-scheme", "aria-hidden": true }, (0, import_react51.createElement)(secure && !editing ? LockIcon2 : GlobeIcon2)),++ (0, import_react51.createElement)("input", {ref: input,type: "text",spellCheck: false,@@@ -18612,14 -19127,14 +19477,14 @@@}})),- (0, import_react49.createElement)("button", {- (0, import_react50.createElement)("button", {++ (0, import_react51.createElement)("button", {type: "button",className: "bt-icon-btn","aria-label": t("New browser tab"),title: t("New browser tab"),onClick: () => actions.browserNewTab(bot.id)- }, (0, import_react49.createElement)(PlusTabIcon)),- imports ? (0, import_react49.createElement)("button", {- }, (0, import_react50.createElement)(PlusTabIcon)),- imports ? (0, import_react50.createElement)("button", {++ }, (0, import_react51.createElement)(PlusTabIcon)),++ imports ? (0, import_react51.createElement)("button", {type: "button",className: "bt-icon-btn bt-import-btn","aria-label": t("Import cookies"),@@@ -18630,29 -19145,29 +19495,29 @@@if (flow === "menu") setFlowTracked(null);else openImport();}- }, (0, import_react49.createElement)(ImportIcon)) : null,- page.loading ? (0, import_react49.createElement)("span", { className: "bt-browser-progress", "aria-hidden": true }) : null- }, (0, import_react50.createElement)(ImportIcon)) : null,- page.loading ? (0, import_react50.createElement)("span", { className: "bt-browser-progress", "aria-hidden": true }) : null++ }, (0, import_react51.createElement)(ImportIcon)) : null,++ page.loading ? (0, import_react51.createElement)("span", { className: "bt-browser-progress", "aria-hidden": true }) : null),- (0, import_react49.createElement)(- (0, import_react50.createElement)(++ (0, import_react51.createElement)("div",{ ref: frame, className: "bt-browser-frame", "data-guest": showGuest || void 0 },- flow === "menu" ? (0, import_react49.createElement)(ImportMenu, { sources, busy, onFile: pickFile, onSource: pickSource, onClose: () => setFlowTracked(null) }) : null,- typeof flow === "object" && flow !== null ? (0, import_react49.createElement)(ImportCard, { flow, page, busy, onApply: applyImport, onCancel: cancelImport, onCloseAndImport: closeAndImport, onDone: () => setFlowTracked(null), onReload: () => actions.browserCommand(tabId, "reload") }) : null,- flow === null && page.error ? (0, import_react49.createElement)(- flow === "menu" ? (0, import_react50.createElement)(ImportMenu, { sources, busy, onFile: pickFile, onSource: pickSource, onClose: () => setFlowTracked(null) }) : null,- typeof flow === "object" && flow !== null ? (0, import_react50.createElement)(ImportCard, { flow, page, busy, onApply: applyImport, onCancel: cancelImport, onCloseAndImport: closeAndImport, onDone: () => setFlowTracked(null), onReload: () => actions.browserCommand(tabId, "reload") }) : null,- flow === null && page.error ? (0, import_react50.createElement)(++ flow === "menu" ? (0, import_react51.createElement)(ImportMenu, { sources, busy, onFile: pickFile, onSource: pickSource, onClose: () => setFlowTracked(null) }) : null,++ typeof flow === "object" && flow !== null ? (0, import_react51.createElement)(ImportCard, { flow, page, busy, onApply: applyImport, onCancel: cancelImport, onCloseAndImport: closeAndImport, onDone: () => setFlowTracked(null), onReload: () => actions.browserCommand(tabId, "reload") }) : null,++ flow === null && page.error ? (0, import_react51.createElement)("div",{ className: "bt-browser-empty" },- (0, import_react49.createElement)("div", { className: "bt-browser-empty-title" }, t("This page didn’t load")),- (0, import_react49.createElement)("div", { className: "bt-browser-empty-text" }, t(page.error)),- page.url ? (0, import_react49.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: () => {- (0, import_react50.createElement)("div", { className: "bt-browser-empty-title" }, t("This page didn’t load")),- (0, import_react50.createElement)("div", { className: "bt-browser-empty-text" }, t(page.error)),- page.url ? (0, import_react50.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: () => {++ (0, import_react51.createElement)("div", { className: "bt-browser-empty-title" }, t("This page didn’t load")),++ (0, import_react51.createElement)("div", { className: "bt-browser-empty-text" }, t(page.error)),++ page.url ? (0, import_react51.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: () => {void actions.browserNavigate(tabId, page.url);} }, t("Try again")) : null- ) : flow === null && !page.url ? (0, import_react49.createElement)(- ) : flow === null && !page.url ? (0, import_react50.createElement)(++ ) : flow === null && !page.url ? (0, import_react51.createElement)("div",{ className: "bt-browser-empty" },- (0, import_react49.createElement)(BotMark, { bot, size: 48, state: "idle", live: true }),- (0, import_react49.createElement)("div", { className: "bt-browser-empty-title" }, t("{name}'s browser", { name: bot.name })),- (0, import_react49.createElement)("div", { className: "bt-browser-empty-text" }, t("Open a page here and {name} can read it with you. Logins and cookies stay with {name}; other Bots never see them.", { name: bot.name })),- imports ? (0, import_react49.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: openImport }, t("Import cookies")) : null- (0, import_react50.createElement)(BotMark, { bot, size: 48, state: "idle", live: true }),- (0, import_react50.createElement)("div", { className: "bt-browser-empty-title" }, t("{name}'s browser", { name: bot.name })),- (0, import_react50.createElement)("div", { className: "bt-browser-empty-text" }, t("Open a page here and {name} can read it with you. Logins and cookies stay with {name}; other Bots never see them.", { name: bot.name })),- imports ? (0, import_react50.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: openImport }, t("Import cookies")) : null++ (0, import_react51.createElement)(BotMark, { bot, size: 48, state: "idle", live: true }),++ (0, import_react51.createElement)("div", { className: "bt-browser-empty-title" }, t("{name}'s browser", { name: bot.name })),++ (0, import_react51.createElement)("div", { className: "bt-browser-empty-text" }, t("Open a page here and {name} can read it with you. Logins and cookies stay with {name}; other Bots never see them.", { name: bot.name })),++ imports ? (0, import_react51.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: openImport }, t("Import cookies")) : null) : null));@@@ -18664,25 -19179,25 +19529,25 @@@ function importError(error)return String(error);}function ImportMenu({ sources, busy, onFile, onSource, onClose }) {- (0, import_react49.useEffect)(() => {- (0, import_react50.useEffect)(() => {++ (0, import_react51.useEffect)(() => {const close = (event) => {if (event.key === "Escape") onClose();};window.addEventListener("keydown", close);return () => window.removeEventListener("keydown", close);}, [onClose]);- return (0, import_react49.createElement)(- return (0, import_react50.createElement)(++ return (0, import_react51.createElement)("div",{ className: "bt-import-menu", role: "menu", "aria-label": t("Import cookies") },- (0, import_react49.createElement)("div", { className: "bt-import-menu-title" }, t("Import cookies")),- (0, import_react49.createElement)(- (0, import_react50.createElement)("div", { className: "bt-import-menu-title" }, t("Import cookies")),- (0, import_react50.createElement)(++ (0, import_react51.createElement)("div", { className: "bt-import-menu-title" }, t("Import cookies")),++ (0, import_react51.createElement)("button",{ type: "button", className: "bt-import-item", role: "menuitem", disabled: busy, onClick: onFile },- (0, import_react49.createElement)(FileIcon, { className: "bt-import-item-icon" }),- (0, import_react49.createElement)("span", { className: "bt-import-item-name" }, t("From a file…")),- (0, import_react49.createElement)("span", { className: "bt-import-item-sub" }, t("cookies.txt, JSON, storageState"))- (0, import_react50.createElement)(FileIcon, { className: "bt-import-item-icon" }),- (0, import_react50.createElement)("span", { className: "bt-import-item-name" }, t("From a file…")),- (0, import_react50.createElement)("span", { className: "bt-import-item-sub" }, t("cookies.txt, JSON, storageState"))++ (0, import_react51.createElement)(FileIcon, { className: "bt-import-item-icon" }),++ (0, import_react51.createElement)("span", { className: "bt-import-item-name" }, t("From a file…")),++ (0, import_react51.createElement)("span", { className: "bt-import-item-sub" }, t("cookies.txt, JSON, storageState"))),- sources === null ? (0, import_react49.createElement)("div", { className: "bt-import-menu-note" }, t("Loading…")) : sources.length === 0 ? (0, import_react49.createElement)("div", { className: "bt-import-menu-note" }, t("No browsers found")) : sources.map((source) => (0, import_react49.createElement)(- sources === null ? (0, import_react50.createElement)("div", { className: "bt-import-menu-note" }, t("Loading…")) : sources.length === 0 ? (0, import_react50.createElement)("div", { className: "bt-import-menu-note" }, t("No browsers found")) : sources.map((source) => (0, import_react50.createElement)(++ sources === null ? (0, import_react51.createElement)("div", { className: "bt-import-menu-note" }, t("Loading…")) : sources.length === 0 ? (0, import_react51.createElement)("div", { className: "bt-import-menu-note" }, t("No browsers found")) : sources.map((source) => (0, import_react51.createElement)("button",{key: source.id,@@@ -18692,83 -19207,83 +19557,83 @@@disabled: busy,onClick: () => onSource(source)},- (0, import_react49.createElement)(WindowIcon, { className: "bt-import-item-icon" }),- (0, import_react49.createElement)("span", { className: "bt-import-item-name" }, source.label),- (0, import_react49.createElement)("span", { className: "bt-import-item-sub" }, t("Copy of its cookies"))- (0, import_react50.createElement)(WindowIcon, { className: "bt-import-item-icon" }),- (0, import_react50.createElement)("span", { className: "bt-import-item-name" }, source.label),- (0, import_react50.createElement)("span", { className: "bt-import-item-sub" }, t("Copy of its cookies"))++ (0, import_react51.createElement)(WindowIcon, { className: "bt-import-item-icon" }),++ (0, import_react51.createElement)("span", { className: "bt-import-item-name" }, source.label),++ (0, import_react51.createElement)("span", { className: "bt-import-item-sub" }, t("Copy of its cookies")))));}function ImportCard({ flow, page, busy, onApply, onCancel, onCloseAndImport, onDone, onReload }) {const { stage } = flow;if (stage === "running") {- return (0, import_react49.createElement)("div", { className: "bt-import-card" }, (0, import_react49.createElement)(- return (0, import_react50.createElement)("div", { className: "bt-import-card" }, (0, import_react50.createElement)(++ return (0, import_react51.createElement)("div", { className: "bt-import-card" }, (0, import_react51.createElement)("div",{ className: "bt-import-box" },- (0, import_react49.createElement)("div", { className: "bt-import-title" }, t("{name} is running", { name: flow.source.name })),- (0, import_react49.createElement)("div", { className: "bt-import-text" }, t("It must close for a moment so its cookies can be copied. It will reopen with your tabs.")),- (0, import_react49.createElement)(- (0, import_react50.createElement)("div", { className: "bt-import-title" }, t("{name} is running", { name: flow.source.name })),- (0, import_react50.createElement)("div", { className: "bt-import-text" }, t("It must close for a moment so its cookies can be copied. It will reopen with your tabs.")),- (0, import_react50.createElement)(++ (0, import_react51.createElement)("div", { className: "bt-import-title" }, t("{name} is running", { name: flow.source.name })),++ (0, import_react51.createElement)("div", { className: "bt-import-text" }, t("It must close for a moment so its cookies can be copied. It will reopen with your tabs.")),++ (0, import_react51.createElement)("div",{ className: "bt-import-actions" },- (0, import_react49.createElement)("button", { type: "button", className: "bt-import-primary", disabled: busy, onClick: onCloseAndImport }, busy ? t("Closing…") : t("Close {name} and import", { name: flow.source.name })),- (0, import_react49.createElement)("button", { type: "button", className: "bt-import-plain", disabled: busy, onClick: onCancel }, t("Cancel"))- (0, import_react50.createElement)("button", { type: "button", className: "bt-import-primary", disabled: busy, onClick: onCloseAndImport }, busy ? t("Closing…") : t("Close {name} and import", { name: flow.source.name })),- (0, import_react50.createElement)("button", { type: "button", className: "bt-import-plain", disabled: busy, onClick: onCancel }, t("Cancel"))++ (0, import_react51.createElement)("button", { type: "button", className: "bt-import-primary", disabled: busy, onClick: onCloseAndImport }, busy ? t("Closing…") : t("Close {name} and import", { name: flow.source.name })),++ (0, import_react51.createElement)("button", { type: "button", className: "bt-import-plain", disabled: busy, onClick: onCancel }, t("Cancel")))));}if (stage === "error") {- return (0, import_react49.createElement)("div", { className: "bt-import-card" }, (0, import_react49.createElement)(- return (0, import_react50.createElement)("div", { className: "bt-import-card" }, (0, import_react50.createElement)(++ return (0, import_react51.createElement)("div", { className: "bt-import-card" }, (0, import_react51.createElement)("div",{ className: "bt-import-box" },- (0, import_react49.createElement)("div", { className: "bt-import-title" }, t("Import failed")),- (0, import_react49.createElement)("div", { className: "bt-import-text" }, flow.message),- (0, import_react49.createElement)("div", { className: "bt-import-actions" }, (0, import_react49.createElement)("button", { type: "button", className: "bt-import-plain", onClick: onCancel }, t("Close")))- (0, import_react50.createElement)("div", { className: "bt-import-title" }, t("Import failed")),- (0, import_react50.createElement)("div", { className: "bt-import-text" }, flow.message),- (0, import_react50.createElement)("div", { className: "bt-import-actions" }, (0, import_react50.createElement)("button", { type: "button", className: "bt-import-plain", onClick: onCancel }, t("Close")))++ (0, import_react51.createElement)("div", { className: "bt-import-title" }, t("Import failed")),++ (0, import_react51.createElement)("div", { className: "bt-import-text" }, flow.message),++ (0, import_react51.createElement)("div", { className: "bt-import-actions" }, (0, import_react51.createElement)("button", { type: "button", className: "bt-import-plain", onClick: onCancel }, t("Close")))));}if (stage === "result") {const { report } = flow;const problems = [...report.dropped ?? [], ...report.failed ?? []];- return (0, import_react49.createElement)("div", { className: "bt-import-card" }, (0, import_react49.createElement)(- return (0, import_react50.createElement)("div", { className: "bt-import-card" }, (0, import_react50.createElement)(++ return (0, import_react51.createElement)("div", { className: "bt-import-card" }, (0, import_react51.createElement)("div",{ className: "bt-import-box" },- (0, import_react49.createElement)("div", { className: "bt-import-title" }, report.stored > 0 ? t("Imported {count} cookies", { count: report.stored }) : t("No cookies were stored")),- flow.label ? (0, import_react49.createElement)("div", { className: "bt-import-sub" }, flow.label) : null,- problems.length ? (0, import_react49.createElement)(- (0, import_react50.createElement)("div", { className: "bt-import-title" }, report.stored > 0 ? t("Imported {count} cookies", { count: report.stored }) : t("No cookies were stored")),- flow.label ? (0, import_react50.createElement)("div", { className: "bt-import-sub" }, flow.label) : null,- problems.length ? (0, import_react50.createElement)(++ (0, import_react51.createElement)("div", { className: "bt-import-title" }, report.stored > 0 ? t("Imported {count} cookies", { count: report.stored }) : t("No cookies were stored")),++ flow.label ? (0, import_react51.createElement)("div", { className: "bt-import-sub" }, flow.label) : null,++ problems.length ? (0, import_react51.createElement)("div",{ className: "bt-import-list" },- problems.slice(0, 8).map((item, index) => (0, import_react49.createElement)(- problems.slice(0, 8).map((item, index) => (0, import_react50.createElement)(++ problems.slice(0, 8).map((item, index) => (0, import_react51.createElement)("div",{ key: index, className: "bt-import-line" },- (0, import_react49.createElement)("span", { className: "bt-import-line-name" }, item.name ?? "—"),- (0, import_react49.createElement)("span", { className: "bt-import-line-reason" }, item.reason)- (0, import_react50.createElement)("span", { className: "bt-import-line-name" }, item.name ?? "—"),- (0, import_react50.createElement)("span", { className: "bt-import-line-reason" }, item.reason)++ (0, import_react51.createElement)("span", { className: "bt-import-line-name" }, item.name ?? "—"),++ (0, import_react51.createElement)("span", { className: "bt-import-line-reason" }, item.reason))),- problems.length > 8 ? (0, import_react49.createElement)("div", { className: "bt-import-line" }, (0, import_react49.createElement)("span", { className: "bt-import-line-reason" }, t("and {count} more", { count: problems.length - 8 }))) : null- problems.length > 8 ? (0, import_react50.createElement)("div", { className: "bt-import-line" }, (0, import_react50.createElement)("span", { className: "bt-import-line-reason" }, t("and {count} more", { count: problems.length - 8 }))) : null++ problems.length > 8 ? (0, import_react51.createElement)("div", { className: "bt-import-line" }, (0, import_react51.createElement)("span", { className: "bt-import-line-reason" }, t("and {count} more", { count: problems.length - 8 }))) : null) : null,- (0, import_react49.createElement)(- (0, import_react50.createElement)(++ (0, import_react51.createElement)("div",{ className: "bt-import-actions" },- page.url ? (0, import_react49.createElement)("button", { type: "button", className: "bt-import-plain", onClick: onReload }, t("Reload the page")) : null,- (0, import_react49.createElement)("button", { type: "button", className: "bt-import-primary", onClick: onDone }, t("Done"))- page.url ? (0, import_react50.createElement)("button", { type: "button", className: "bt-import-plain", onClick: onReload }, t("Reload the page")) : null,- (0, import_react50.createElement)("button", { type: "button", className: "bt-import-primary", onClick: onDone }, t("Done"))++ page.url ? (0, import_react51.createElement)("button", { type: "button", className: "bt-import-plain", onClick: onReload }, t("Reload the page")) : null,++ (0, import_react51.createElement)("button", { type: "button", className: "bt-import-primary", onClick: onDone }, t("Done")))));}const { preview } = flow;- return (0, import_react49.createElement)("div", { className: "bt-import-card" }, (0, import_react49.createElement)(- return (0, import_react50.createElement)("div", { className: "bt-import-card" }, (0, import_react50.createElement)(++ return (0, import_react51.createElement)("div", { className: "bt-import-card" }, (0, import_react51.createElement)("div",{ className: "bt-import-box" },- (0, import_react49.createElement)("div", { className: "bt-import-title" }, t("Import {count} cookies", { count: preview.cookies })),- (0, import_react49.createElement)(- (0, import_react50.createElement)("div", { className: "bt-import-title" }, t("Import {count} cookies", { count: preview.cookies })),- (0, import_react50.createElement)(++ (0, import_react51.createElement)("div", { className: "bt-import-title" }, t("Import {count} cookies", { count: preview.cookies })),++ (0, import_react51.createElement)("div",{ className: "bt-import-sub" },preview.source?.label ?? "",flow.restarted ? ` · ${t("the browser was restarted")}` : ""),- preview.sites.length ? (0, import_react49.createElement)(- preview.sites.length ? (0, import_react50.createElement)(++ preview.sites.length ? (0, import_react51.createElement)("div",{ className: "bt-import-list" },- preview.sites.map((site) => (0, import_react49.createElement)(- preview.sites.map((site) => (0, import_react50.createElement)(++ preview.sites.map((site) => (0, import_react51.createElement)("div",{ key: site.site, className: "bt-import-line" },- (0, import_react49.createElement)("span", { className: "bt-import-line-name" }, site.site),- (0, import_react49.createElement)(- (0, import_react50.createElement)("span", { className: "bt-import-line-name" }, site.site),- (0, import_react50.createElement)(++ (0, import_react51.createElement)("span", { className: "bt-import-line-name" }, site.site),++ (0, import_react51.createElement)("span",{ className: "bt-import-line-count" },t("{count}", { count: site.cookies }),@@@ -18776,35 -19291,35 +19641,35 @@@)))) : null,- preview.skipped.length ? (0, import_react49.createElement)(- preview.skipped.length ? (0, import_react50.createElement)(++ preview.skipped.length ? (0, import_react51.createElement)("div",{ className: "bt-import-list" },- (0, import_react49.createElement)("div", { className: "bt-import-note" }, t("{count} skipped", { count: preview.skipped.length })),- preview.skipped.slice(0, 5).map((item, index) => (0, import_react49.createElement)(- (0, import_react50.createElement)("div", { className: "bt-import-note" }, t("{count} skipped", { count: preview.skipped.length })),- preview.skipped.slice(0, 5).map((item, index) => (0, import_react50.createElement)(++ (0, import_react51.createElement)("div", { className: "bt-import-note" }, t("{count} skipped", { count: preview.skipped.length })),++ preview.skipped.slice(0, 5).map((item, index) => (0, import_react51.createElement)("div",{ key: index, className: "bt-import-line" },- (0, import_react49.createElement)("span", { className: "bt-import-line-name" }, item.name ?? item.where),- (0, import_react49.createElement)("span", { className: "bt-import-line-reason" }, item.reason)- (0, import_react50.createElement)("span", { className: "bt-import-line-name" }, item.name ?? item.where),- (0, import_react50.createElement)("span", { className: "bt-import-line-reason" }, item.reason)++ (0, import_react51.createElement)("span", { className: "bt-import-line-name" }, item.name ?? item.where),++ (0, import_react51.createElement)("span", { className: "bt-import-line-reason" }, item.reason))),- preview.skipped.length > 5 ? (0, import_react49.createElement)("div", { className: "bt-import-line" }, (0, import_react49.createElement)("span", { className: "bt-import-line-reason" }, t("and {count} more", { count: preview.skipped.length - 5 }))) : null- preview.skipped.length > 5 ? (0, import_react50.createElement)("div", { className: "bt-import-line" }, (0, import_react50.createElement)("span", { className: "bt-import-line-reason" }, t("and {count} more", { count: preview.skipped.length - 5 }))) : null++ preview.skipped.length > 5 ? (0, import_react51.createElement)("div", { className: "bt-import-line" }, (0, import_react51.createElement)("span", { className: "bt-import-line-reason" }, t("and {count} more", { count: preview.skipped.length - 5 }))) : null) : null,- preview.warnings.length ? (0, import_react49.createElement)(- preview.warnings.length ? (0, import_react50.createElement)(++ preview.warnings.length ? (0, import_react51.createElement)("details",{ className: "bt-import-warns" },- (0, import_react49.createElement)("summary", null, t("{count} adjusted", { count: preview.warnings.reduce((n, w) => n + w.count, 0) })),- preview.warnings.map((w, index) => (0, import_react49.createElement)(- (0, import_react50.createElement)("summary", null, t("{count} adjusted", { count: preview.warnings.reduce((n, w) => n + w.count, 0) })),- preview.warnings.map((w, index) => (0, import_react50.createElement)(++ (0, import_react51.createElement)("summary", null, t("{count} adjusted", { count: preview.warnings.reduce((n, w) => n + w.count, 0) })),++ preview.warnings.map((w, index) => (0, import_react51.createElement)("div",{ key: index, className: "bt-import-line" },- (0, import_react49.createElement)("span", { className: "bt-import-line-reason" }, `${w.count} × ${w.message}`)- (0, import_react50.createElement)("span", { className: "bt-import-line-reason" }, `${w.count} × ${w.message}`)++ (0, import_react51.createElement)("span", { className: "bt-import-line-reason" }, `${w.count} × ${w.message}`)))) : null,- preview.notes.includes("session-cookies") ? (0, import_react49.createElement)("div", { className: "bt-import-note" }, t("Cookies without an expiry stay until the app closes.")) : null,- preview.notes.includes("local-storage-left") ? (0, import_react49.createElement)("div", { className: "bt-import-note" }, t("Some sites also keep sign-in outside cookies; you may need to sign in again there.")) : null,- (0, import_react49.createElement)(- preview.notes.includes("session-cookies") ? (0, import_react50.createElement)("div", { className: "bt-import-note" }, t("Cookies without an expiry stay until the app closes.")) : null,- preview.notes.includes("local-storage-left") ? (0, import_react50.createElement)("div", { className: "bt-import-note" }, t("Some sites also keep sign-in outside cookies; you may need to sign in again there.")) : null,- (0, import_react50.createElement)(++ preview.notes.includes("session-cookies") ? (0, import_react51.createElement)("div", { className: "bt-import-note" }, t("Cookies without an expiry stay until the app closes.")) : null,++ preview.notes.includes("local-storage-left") ? (0, import_react51.createElement)("div", { className: "bt-import-note" }, t("Some sites also keep sign-in outside cookies; you may need to sign in again there.")) : null,++ (0, import_react51.createElement)("div",{ className: "bt-import-actions" },- (0, import_react49.createElement)("button", { type: "button", className: "bt-import-primary", disabled: busy, onClick: onApply }, busy ? t("Importing…") : t("Import")),- (0, import_react49.createElement)("button", { type: "button", className: "bt-import-plain", disabled: busy, onClick: onCancel }, t("Cancel"))- (0, import_react50.createElement)("button", { type: "button", className: "bt-import-primary", disabled: busy, onClick: onApply }, busy ? t("Importing…") : t("Import")),- (0, import_react50.createElement)("button", { type: "button", className: "bt-import-plain", disabled: busy, onClick: onCancel }, t("Cancel"))++ (0, import_react51.createElement)("button", { type: "button", className: "bt-import-primary", disabled: busy, onClick: onApply }, busy ? t("Importing…") : t("Import")),++ (0, import_react51.createElement)("button", { type: "button", className: "bt-import-plain", disabled: busy, onClick: onCancel }, t("Cancel")))));}@@@ -18818,41 -19333,41 +19683,41 @@@ function BotPanel({ pane, leaving, roomconst active = tabState.active;const page = useBrowserPages((pages) => (active ? pages[active] : null) ?? EMPTY_PAGE);const hold = useBrowserHolds?.((map) => bot ? map[bot.id] ?? null : null) ?? null;- const root = (0, import_react49.useRef)(null);- const fly = (0, import_react49.useRef)(null);- const [landed, setLanded] = (0, import_react49.useState)(false);- const [settling, setSettling] = (0, import_react49.useState)(false);- const [width, setWidth] = (0, import_react49.useState)(savedWidth);- const [dragging, setDragging] = (0, import_react49.useState)(false);- const [resizing, setResizing] = (0, import_react49.useState)(false);- const root = (0, import_react50.useRef)(null);- const fly = (0, import_react50.useRef)(null);- const [landed, setLanded] = (0, import_react50.useState)(false);- const [settling, setSettling] = (0, import_react50.useState)(false);- const [width, setWidth] = (0, import_react50.useState)(savedWidth);- const [dragging, setDragging] = (0, import_react50.useState)(false);- const [resizing, setResizing] = (0, import_react50.useState)(false);++ const root = (0, import_react51.useRef)(null);++ const fly = (0, import_react51.useRef)(null);++ const [landed, setLanded] = (0, import_react51.useState)(false);++ const [settling, setSettling] = (0, import_react51.useState)(false);++ const [width, setWidth] = (0, import_react51.useState)(savedWidth);++ const [dragging, setDragging] = (0, import_react51.useState)(false);++ const [resizing, setResizing] = (0, import_react51.useState)(false);const instant = dragging || resizing;- const [reading, setReading] = (0, import_react49.useState)(false);- const [reading, setReading] = (0, import_react50.useState)(false);++ const [reading, setReading] = (0, import_react51.useState)(false);const panelWidth = fitWidth(width ?? (view === "browser" ? DEFAULT_WIDTH : DETAILS_WIDTH), widthRange(view, room2));- (0, import_react49.useLayoutEffect)(() => {- (0, import_react50.useLayoutEffect)(() => {++ (0, import_react51.useLayoutEffect)(() => {if (view === "browser" && width === null) setWidth(DEFAULT_WIDTH);}, [view, width]);- (0, import_react49.useLayoutEffect)(() => {- (0, import_react50.useLayoutEffect)(() => {++ (0, import_react51.useLayoutEffect)(() => {chatRoom.hold(instant);}, [instant]);- const [last, setLast] = (0, import_react49.useState)({ view, width: panelWidth });- const [last, setLast] = (0, import_react50.useState)({ view, width: panelWidth });++ const [last, setLast] = (0, import_react51.useState)({ view, width: panelWidth });if (last.view !== view || last.width !== panelWidth) {setLast({ view, width: panelWidth });if (last.view !== view) setSettling(last.width !== panelWidth && !instant);}- const shownView = (0, import_react49.useRef)(view);- (0, import_react49.useLayoutEffect)(() => {- const shownView = (0, import_react50.useRef)(view);- (0, import_react50.useLayoutEffect)(() => {++ const shownView = (0, import_react51.useRef)(view);++ (0, import_react51.useLayoutEffect)(() => {const switched = settling && shownView.current !== view;shownView.current = view;if (switched) chatRoom.hold(true);chatRoom.setRight(leaving || overlay ? null : panelWidth);if (switched) chatRoom.hold(false);}, [view, panelWidth, leaving, overlay]);- (0, import_react49.useEffect)(() => () => {- (0, import_react50.useEffect)(() => () => {++ (0, import_react51.useEffect)(() => () => {chatRoom.setRight(null);chatRoom.hold(false);}, []);- const mounted = (0, import_react49.useRef)(false);- (0, import_react49.useEffect)(() => {- const mounted = (0, import_react50.useRef)(false);- (0, import_react50.useEffect)(() => {++ const mounted = (0, import_react51.useRef)(false);++ (0, import_react51.useEffect)(() => {if (!mounted.current) {mounted.current = true;return void 0;@@@ -18861,31 -19376,31 +19726,31 @@@const timer = setTimeout(() => setResizing(false), 160);return () => clearTimeout(timer);}, [room2]);- (0, import_react49.useEffect)(() => {- (0, import_react50.useEffect)(() => {++ (0, import_react51.useEffect)(() => {if (!settling) return void 0;const timer = setTimeout(() => setSettling(false), SPRING_SHAPE.duration + 40);return () => clearTimeout(timer);}, [settling, view]);- (0, import_react49.useEffect)(() => {- (0, import_react50.useEffect)(() => {++ (0, import_react51.useEffect)(() => {const timer = setTimeout(() => setLanded(true), 360);return () => clearTimeout(timer);}, []);- (0, import_react49.useEffect)(() => {- (0, import_react50.useEffect)(() => {++ (0, import_react51.useEffect)(() => {if (canBrowse) actions.browserEnsure(bot.id);}, [bot?.id, canBrowse]);- (0, import_react49.useEffect)(() => {- (0, import_react50.useEffect)(() => {++ (0, import_react51.useEffect)(() => {if (view === "browser" && (active === null || !tabState.ids.includes(active))) actions.setPanelView("details");}, [view, active, tabState.ids.length]);- (0, import_react49.useEffect)(() => {- (0, import_react50.useEffect)(() => {++ (0, import_react51.useEffect)(() => {if (pane.view === "side" && sideChat === void 0) actions.setPanelView("details");}, [pane.view, sideChat]);- (0, import_react49.useEffect)(() => {- (0, import_react50.useEffect)(() => {++ (0, import_react51.useEffect)(() => {if (view !== "browser" || leaving) void actions.browserShow?.(null);}, [view, leaving]);- (0, import_react49.useEffect)(() => () => {- (0, import_react50.useEffect)(() => () => {++ (0, import_react51.useEffect)(() => () => {void actions.browserShow?.(null);}, []);- (0, import_react49.useEffect)(() => {- (0, import_react50.useEffect)(() => {++ (0, import_react51.useEffect)(() => {if (!page.readAt || Date.now() - page.readAt > READ_FLASH_MS) return void 0;setReading(true);const timer = setTimeout(() => setReading(false), READ_FLASH_MS);@@@ -18928,7 -19444,7 +19794,7 @@@return actions[name](...args);};}- (0, import_react49.useLayoutEffect)(() => {- (0, import_react50.useLayoutEffect)(() => {++ (0, import_react51.useLayoutEffect)(() => {const move = fly.current;if (!move) return;fly.current = null;@@@ -19011,7 -19527,7 +19877,7 @@@for (const name of ends) grip.addEventListener(name, onEnd);};const hasStrip = panelHasStrip(canBrowse, tabState.ids.length, sideChats.length);- return (0, import_react49.createElement)(- return (0, import_react50.createElement)(++ return (0, import_react51.createElement)("aside",{ref: root,@@@ -19029,15 -19545,15 +19895,15 @@@if (event.target === event.currentTarget) setLanded(true);}},- leaving || overlay ? null : (0, import_react49.createElement)("div", { className: "bt-panel-grip", role: "separator", "aria-orientation": "vertical", "aria-label": t("Resize panel"), onPointerDown: startResize }),- leaving || overlay ? null : (0, import_react50.createElement)("div", { className: "bt-panel-grip", role: "separator", "aria-orientation": "vertical", "aria-label": t("Resize panel"), onPointerDown: startResize }),++ leaving || overlay ? null : (0, import_react51.createElement)("div", { className: "bt-panel-grip", role: "separator", "aria-orientation": "vertical", "aria-label": t("Resize panel"), onPointerDown: startResize }),// Over the whole window while dragging: the cursor stays a resize cursor and the// pages underneath (the chat, the guest) see no pointer.- dragging ? (0, import_react_dom8.createPortal)((0, import_react49.createElement)("div", { className: "bt-drag-shield", "aria-hidden": true }), document.body) : null,- hasStrip ? (0, import_react49.createElement)(PanelStrip, { bot, subject: pane.id, view, ids: tabState.ids, active, sides: sideChats, side: pane.side, canBrowse, reading, onView: switchView, actions: panelActions, useBrowserPages }) : null,- view === "browser" && bot ? (0, import_react49.createElement)(BrowserView, { key: `browser:${active}`, bot, tabId: active, leaving, landed: landed && !settling, actions, useBrowserPages, hold }) : view === "side" && sideChat ? (0, import_react49.createElement)("div", { key: `side:${sideChat.id}`, className: "bt-panel-view" }, (0, import_react49.createElement)(SideChatView, { subject: pane.id, chat: sideChat, actions: panelActions })) : (0, import_react49.createElement)(- dragging ? (0, import_react_dom8.createPortal)((0, import_react50.createElement)("div", { className: "bt-drag-shield", "aria-hidden": true }), document.body) : null,- hasStrip ? (0, import_react50.createElement)(PanelStrip, { bot, subject: pane.id, view, ids: tabState.ids, active, sides: sideChats, side: pane.side, canBrowse, reading, onView: switchView, actions: panelActions, useBrowserPages }) : null,- view === "browser" && bot ? (0, import_react50.createElement)(BrowserView, { key: `browser:${active}`, bot, tabId: active, leaving, landed: landed && !settling, actions, useBrowserPages, hold }) : view === "side" && sideChat ? (0, import_react50.createElement)("div", { key: `side:${sideChat.id}`, className: "bt-panel-view" }, (0, import_react50.createElement)(SideChatView, { subject: pane.id, chat: sideChat, roster, actions: panelActions })) : (0, import_react50.createElement)(++ dragging ? (0, import_react_dom8.createPortal)((0, import_react51.createElement)("div", { className: "bt-drag-shield", "aria-hidden": true }), document.body) : null,++ hasStrip ? (0, import_react51.createElement)(PanelStrip, { bot, subject: pane.id, view, ids: tabState.ids, active, sides: sideChats, side: pane.side, canBrowse, reading, onView: switchView, actions: panelActions, useBrowserPages }) : null,++ view === "browser" && bot ? (0, import_react51.createElement)(BrowserView, { key: `browser:${active}`, bot, tabId: active, leaving, landed: landed && !settling, actions, useBrowserPages, hold }) : view === "side" && sideChat ? (0, import_react51.createElement)("div", { key: `side:${sideChat.id}`, className: "bt-panel-view" }, (0, import_react51.createElement)(SideChatView, { subject: pane.id, chat: sideChat, roster, actions: panelActions })) : (0, import_react51.createElement)("div",{ key: `details:${pane.id}:${pane.renaming ? "rename" : ""}:${pane.tab ?? ""}`, className: "bt-panel-view" },- (0, import_react49.createElement)(DetailsDrawer, {- (0, import_react50.createElement)(DetailsDrawer, {++ (0, import_react51.createElement)(DetailsDrawer, {sessionId: pane.id,startRenaming: pane.renaming,startTab: pane.tab,@@@ -19178,7 -19694,7 +20044,7 @@@ var BROWSER_CSS =`;// src/client/overlays.js- var import_react50 = require("react");-var import_react51 = require("react");++var import_react52 = require("react");var import_react_dom9 = require("react-dom");var DIALOG_EXIT_MS = 160;var MENU_EXIT_MS3 = 120;@@@ -19189,8 -19705,8 +20055,8 @@@ function Overlays({ useRoster, useUi, uconst frameSnap = useFrame ? useFrame((value) => value) : { viewport: window.innerWidth, sidebarWidth: FALLBACK_SIDEBAR_WIDTH, collapsedWidth: 0 };const pref = useSidebarPref ? useSidebarPref((value) => value) : "open";const current = useSessions((list) => Object.values(list.byId).find((session) => (session?.retainedBy?.mainView ?? 0) > 0)?.id ?? null);- const previous = (0, import_react50.useRef)(current);- (0, import_react50.useEffect)(() => {- const previous = (0, import_react51.useRef)(current);- (0, import_react51.useEffect)(() => {++ const previous = (0, import_react52.useRef)(current);++ (0, import_react52.useEffect)(() => {if (previous.current === current) return;previous.current = current;if (current) actions.followPanel?.(current);@@@ -19204,8 -19720,8 +20070,8 @@@panel: open ? { view: open.view, yielded: ui2.panelYield === true } : null});const shown = open !== null && layout.panel !== "folded" ? open : null;- const [kept, setKept] = (0, import_react50.useState)(shown);- (0, import_react50.useEffect)(() => {- const [kept, setKept] = (0, import_react51.useState)(shown);- (0, import_react51.useEffect)(() => {++ const [kept, setKept] = (0, import_react52.useState)(shown);++ (0, import_react52.useEffect)(() => {if (shown) {setKept(shown);return void 0;@@@ -19224,17 -19740,17 +20090,17 @@@const [memory, memoryLeaving] = useLinger(ui2.memory && memoryOwner(ui2.memory) ? ui2.memory : null, DIALOG_EXIT_MS);const owner = memory ? memoryOwner(memory) : null;const [menu, menuLeaving] = useLinger(ui2.menu, MENU_EXIT_MS3);- return (0, import_react50.createElement)(- import_react50.Fragment,- return (0, import_react51.createElement)(- import_react51.Fragment,++ return (0, import_react52.createElement)(++ import_react52.Fragment,null,- pane ? (0, import_react_dom9.createPortal)((0, import_react50.createElement)(BotPanel, { pane, leaving: shown === null, room: layout.room, overlay: layout.panel === "overlay", roster, actions, useSessions, useSessionStatus, useActivity, useWork, useBrowserTabs, useBrowserPages, useBrowserHolds }), document.body) : null,- ui2.newChat ? (0, import_react_dom9.createPortal)((0, import_react50.createElement)(NewChat, { key: ui2.newChat, mode: ui2.newChat, roster, actions }), document.body) : null,- ui2.palette ? (0, import_react_dom9.createPortal)((0, import_react50.createElement)(CommandPalette, { key: ui2.palette.token, start: ui2.palette.query, token: ui2.palette.token, roster, actions, useSessions }), document.body) : null,- ui2.exchange ? (0, import_react_dom9.createPortal)((0, import_react50.createElement)(ExchangeDialog, { pair: ui2.exchange, roster, actions }), document.body) : null,- ui2.voice ? (0, import_react_dom9.createPortal)((0, import_react50.createElement)(VoiceMode, { key: ui2.voice, sessionId: ui2.voice, roster, actions, useSessions, useSessionStatus }), document.body) : null,- menu ? (0, import_react_dom9.createPortal)((0, import_react50.createElement)(ContextMenu, { key: `${menu.kind ?? ""}:${menu.id}:${menu.x}:${menu.y}`, menu, roster, actions, leaving: menuLeaving }), document.body) : null,- settings ? (0, import_react_dom9.createPortal)((0, import_react50.createElement)(SettingsDialog, { page: settings.page, id: settings.id, roster, actions, useUpdate, leaving: settingsLeaving }), document.body) : null,- owner ? (0, import_react_dom9.createPortal)((0, import_react50.createElement)(MemoryDialog, { key: owner.id, owner, actions, leaving: memoryLeaving }), document.body) : null- pane ? (0, import_react_dom9.createPortal)((0, import_react51.createElement)(BotPanel, { pane, leaving: shown === null, room: layout.room, overlay: layout.panel === "overlay", roster, actions, useSessions, useSessionStatus, useActivity, useWork, useBrowserTabs, useBrowserPages, useBrowserHolds }), document.body) : null,- ui2.newChat ? (0, import_react_dom9.createPortal)((0, import_react51.createElement)(NewChat, { key: ui2.newChat, mode: ui2.newChat, roster, actions }), document.body) : null,- ui2.palette ? (0, import_react_dom9.createPortal)((0, import_react51.createElement)(CommandPalette, { key: ui2.palette.token, start: ui2.palette.query, token: ui2.palette.token, roster, actions, useSessions }), document.body) : null,- ui2.exchange ? (0, import_react_dom9.createPortal)((0, import_react51.createElement)(ExchangeDialog, { pair: ui2.exchange, roster, actions }), document.body) : null,- ui2.voice ? (0, import_react_dom9.createPortal)((0, import_react51.createElement)(VoiceMode, { key: ui2.voice, sessionId: ui2.voice, roster, actions, useSessions, useSessionStatus }), document.body) : null,- menu ? (0, import_react_dom9.createPortal)((0, import_react51.createElement)(ContextMenu, { key: `${menu.kind ?? ""}:${menu.id}:${menu.x}:${menu.y}`, menu, roster, actions, leaving: menuLeaving }), document.body) : null,- settings ? (0, import_react_dom9.createPortal)((0, import_react51.createElement)(SettingsDialog, { page: settings.page, id: settings.id, roster, actions, useUpdate, leaving: settingsLeaving }), document.body) : null,- owner ? (0, import_react_dom9.createPortal)((0, import_react51.createElement)(MemoryDialog, { key: owner.id, owner, actions, leaving: memoryLeaving }), document.body) : null++ pane ? (0, import_react_dom9.createPortal)((0, import_react52.createElement)(BotPanel, { pane, leaving: shown === null, room: layout.room, overlay: layout.panel === "overlay", roster, actions, useSessions, useSessionStatus, useActivity, useWork, useBrowserTabs, useBrowserPages, useBrowserHolds }), document.body) : null,++ ui2.newChat ? (0, import_react_dom9.createPortal)((0, import_react52.createElement)(NewChat, { key: ui2.newChat, mode: ui2.newChat, roster, actions }), document.body) : null,++ ui2.palette ? (0, import_react_dom9.createPortal)((0, import_react52.createElement)(CommandPalette, { key: ui2.palette.token, start: ui2.palette.query, token: ui2.palette.token, roster, actions, useSessions }), document.body) : null,++ ui2.exchange ? (0, import_react_dom9.createPortal)((0, import_react52.createElement)(ExchangeDialog, { pair: ui2.exchange, roster, actions }), document.body) : null,++ ui2.voice ? (0, import_react_dom9.createPortal)((0, import_react52.createElement)(VoiceMode, { key: ui2.voice, sessionId: ui2.voice, roster, actions, useSessions, useSessionStatus }), document.body) : null,++ menu ? (0, import_react_dom9.createPortal)((0, import_react52.createElement)(ContextMenu, { key: `${menu.kind ?? ""}:${menu.id}:${menu.x}:${menu.y}`, menu, roster, actions, leaving: menuLeaving }), document.body) : null,++ settings ? (0, import_react_dom9.createPortal)((0, import_react52.createElement)(SettingsDialog, { page: settings.page, id: settings.id, roster, actions, useUpdate, leaving: settingsLeaving }), document.body) : null,++ owner ? (0, import_react_dom9.createPortal)((0, import_react52.createElement)(MemoryDialog, { key: owner.id, owner, actions, leaving: memoryLeaving }), document.body) : null);}@@@ -20292,13 -20808,13 +21158,13 @@@ function lineDiff(before, after)}// src/client/learning-card.js- var import_react51 = require("react");-var import_react52 = require("react");++var import_react53 = require("react");var failedAnswers = /* @__PURE__ */ new Map();function ProposalCard({ proposal, initialError = "", onFailure, onResolved, actions }) {- const [busy, setBusy] = (0, import_react51.useState)(false);- const [error, setError] = (0, import_react51.useState)(initialError);- const busyRef = (0, import_react51.useRef)(false);- const titleId = (0, import_react51.useId)();- const [busy, setBusy] = (0, import_react52.useState)(false);- const [error, setError] = (0, import_react52.useState)(initialError);- const busyRef = (0, import_react52.useRef)(false);- const titleId = (0, import_react52.useId)();++ const [busy, setBusy] = (0, import_react53.useState)(false);++ const [error, setError] = (0, import_react53.useState)(initialError);++ const busyRef = (0, import_react53.useRef)(false);++ const titleId = (0, import_react53.useId)();const answer = (approve) => {if (busyRef.current) return;busyRef.current = true;@@@ -20314,58 -20830,58 +21180,58 @@@});};const update = proposal.action === "update";- const rows2 = (0, import_react51.useMemo)(() => lineDiff(update ? proposal.previous?.content : "", proposal.content), [update, proposal.previous?.content, proposal.content]);- const rows2 = (0, import_react52.useMemo)(() => lineDiff(update ? proposal.previous?.content : "", proposal.content), [update, proposal.previous?.content, proposal.content]);++ const rows2 = (0, import_react53.useMemo)(() => lineDiff(update ? proposal.previous?.content : "", proposal.content), [update, proposal.previous?.content, proposal.content]);if (proposal.kind === "agents") {const blocks = proposal.edits.map((edit) => [...(edit.op === "add" ? [] : editLines(edit.old)).map((line) => ({ kind: "removed", line })),...(edit.op === "remove" ? [] : editLines(edit.text)).map((line) => ({ kind: "added", line }))]);- return (0, import_react51.createElement)(- return (0, import_react52.createElement)(++ return (0, import_react53.createElement)("section",{ className: "bt-q bt-learning-card", role: "group", "aria-labelledby": titleId, "aria-busy": busy },- (0, import_react51.createElement)(ProposalHead, { titleId, icon: PencilIcon, title: t("AGENTS.md update") }),- (0, import_react51.createElement)(FileBox, { name: "AGENTS.md", path: proposal.folder, state: proposal.exists === false ? "Added" : "Modified", blocks }),- proposal.edits.map((edit, index) => edit.why ? (0, import_react51.createElement)("p", { className: "bt-learning-why", key: index }, edit.why) : null),- error ? (0, import_react51.createElement)("div", { className: "bt-learning-error", role: "alert" }, error) : null,- (0, import_react51.createElement)(ProposalFoot, { busy, answer })- (0, import_react52.createElement)(ProposalHead, { titleId, icon: PencilIcon, title: t("AGENTS.md update") }),- (0, import_react52.createElement)(FileBox, { name: "AGENTS.md", path: proposal.folder, state: proposal.exists === false ? "Added" : "Modified", blocks }),- proposal.edits.map((edit, index) => edit.why ? (0, import_react52.createElement)("p", { className: "bt-learning-why", key: index }, edit.why) : null),- error ? (0, import_react52.createElement)("div", { className: "bt-learning-error", role: "alert" }, error) : null,- (0, import_react52.createElement)(ProposalFoot, { busy, answer })++ (0, import_react53.createElement)(ProposalHead, { titleId, icon: PencilIcon, title: t("AGENTS.md update") }),++ (0, import_react53.createElement)(FileBox, { name: "AGENTS.md", path: proposal.folder, state: proposal.exists === false ? "Added" : "Modified", blocks }),++ proposal.edits.map((edit, index) => edit.why ? (0, import_react53.createElement)("p", { className: "bt-learning-why", key: index }, edit.why) : null),++ error ? (0, import_react53.createElement)("div", { className: "bt-learning-error", role: "alert" }, error) : null,++ (0, import_react53.createElement)(ProposalFoot, { busy, answer }));}const oldDetail = update && typeof proposal.previous?.description === "string" && proposal.previous.description !== proposal.description ? proposal.previous.description : void 0;- return (0, import_react51.createElement)(- return (0, import_react52.createElement)(++ return (0, import_react53.createElement)("section",{ className: "bt-q bt-learning-card", role: "group", "aria-labelledby": titleId, "aria-busy": busy },- (0, import_react51.createElement)(ProposalHead, { titleId, title: proposal.name, kind: t(update ? "Skill update" : "New skill"), detail: proposal.description, oldDetail }),- (0, import_react51.createElement)(FileBox, { name: "SKILL.md", path: `skills/${proposal.name}`, state: update ? "Updated" : "Added", blocks: [rows2] }),- proposal.why ? (0, import_react51.createElement)("p", { className: "bt-learning-why" }, proposal.why) : null,- error ? (0, import_react51.createElement)("div", { className: "bt-learning-error", role: "alert" }, error) : null,- (0, import_react51.createElement)(ProposalFoot, { busy, answer })- (0, import_react52.createElement)(ProposalHead, { titleId, title: proposal.name, kind: t(update ? "Skill update" : "New skill"), detail: proposal.description, oldDetail }),- (0, import_react52.createElement)(FileBox, { name: "SKILL.md", path: `skills/${proposal.name}`, state: update ? "Updated" : "Added", blocks: [rows2] }),- proposal.why ? (0, import_react52.createElement)("p", { className: "bt-learning-why" }, proposal.why) : null,- error ? (0, import_react52.createElement)("div", { className: "bt-learning-error", role: "alert" }, error) : null,- (0, import_react52.createElement)(ProposalFoot, { busy, answer })++ (0, import_react53.createElement)(ProposalHead, { titleId, title: proposal.name, kind: t(update ? "Skill update" : "New skill"), detail: proposal.description, oldDetail }),++ (0, import_react53.createElement)(FileBox, { name: "SKILL.md", path: `skills/${proposal.name}`, state: update ? "Updated" : "Added", blocks: [rows2] }),++ proposal.why ? (0, import_react53.createElement)("p", { className: "bt-learning-why" }, proposal.why) : null,++ error ? (0, import_react53.createElement)("div", { className: "bt-learning-error", role: "alert" }, error) : null,++ (0, import_react53.createElement)(ProposalFoot, { busy, answer }));}function ProposalHead({ titleId, icon: icon2 = MemoryIcon, title, kind, detail, oldDetail }) {- return (0, import_react51.createElement)(- return (0, import_react52.createElement)(++ return (0, import_react53.createElement)("div",{ className: "bt-q-head" },- (0, import_react51.createElement)("span", { className: "bt-learning-icon", "aria-hidden": true }, (0, import_react51.createElement)(icon2)),- (0, import_react51.createElement)(- (0, import_react52.createElement)("span", { className: "bt-learning-icon", "aria-hidden": true }, (0, import_react52.createElement)(icon2)),- (0, import_react52.createElement)(++ (0, import_react53.createElement)("span", { className: "bt-learning-icon", "aria-hidden": true }, (0, import_react53.createElement)(icon2)),++ (0, import_react53.createElement)("div",{ className: "bt-q-text" },- (0, import_react51.createElement)("p", { className: "bt-q-title", id: titleId }, title),- kind ? (0, import_react51.createElement)("div", { className: "bt-q-detail" }, kind) : null,- oldDetail ? (0, import_react51.createElement)("p", { className: "bt-learning-description bt-learning-old" }, (0, import_react51.createElement)("del", null, oldDetail)) : null,- detail ? (0, import_react51.createElement)("p", { className: "bt-learning-description" }, detail) : null- (0, import_react52.createElement)("p", { className: "bt-q-title", id: titleId }, title),- kind ? (0, import_react52.createElement)("div", { className: "bt-q-detail" }, kind) : null,- oldDetail ? (0, import_react52.createElement)("p", { className: "bt-learning-description bt-learning-old" }, (0, import_react52.createElement)("del", null, oldDetail)) : null,- detail ? (0, import_react52.createElement)("p", { className: "bt-learning-description" }, detail) : null++ (0, import_react53.createElement)("p", { className: "bt-q-title", id: titleId }, title),++ kind ? (0, import_react53.createElement)("div", { className: "bt-q-detail" }, kind) : null,++ oldDetail ? (0, import_react53.createElement)("p", { className: "bt-learning-description bt-learning-old" }, (0, import_react53.createElement)("del", null, oldDetail)) : null,++ detail ? (0, import_react53.createElement)("p", { className: "bt-learning-description" }, detail) : null),- (0, import_react51.createElement)("span", { className: "bt-q-badge bt-learning-status" }, (0, import_react51.createElement)("span", { className: "bt-learning-dot", "aria-hidden": true }), t("Awaiting approval"))- (0, import_react52.createElement)("span", { className: "bt-q-badge bt-learning-status" }, (0, import_react52.createElement)("span", { className: "bt-learning-dot", "aria-hidden": true }), t("Awaiting approval"))++ (0, import_react53.createElement)("span", { className: "bt-q-badge bt-learning-status" }, (0, import_react53.createElement)("span", { className: "bt-learning-dot", "aria-hidden": true }), t("Awaiting approval")));}function ProposalFoot({ busy, answer }) {- return (0, import_react51.createElement)(- return (0, import_react52.createElement)(++ return (0, import_react53.createElement)("div",{ className: "bt-q-foot bt-learning-foot" },- (0, import_react51.createElement)("button", { type: "button", className: "bt-learning-btn bt-learning-decline", disabled: busy, onClick: () => answer(false) }, t("Decline")),- (0, import_react51.createElement)(- (0, import_react52.createElement)("button", { type: "button", className: "bt-learning-btn bt-learning-decline", disabled: busy, onClick: () => answer(false) }, t("Decline")),- (0, import_react52.createElement)(++ (0, import_react53.createElement)("button", { type: "button", className: "bt-learning-btn bt-learning-decline", disabled: busy, onClick: () => answer(false) }, t("Decline")),++ (0, import_react53.createElement)("button",{ type: "button", className: "bt-learning-btn bt-learning-approve", disabled: busy, onClick: () => answer(true) },- (0, import_react51.createElement)(CheckIcon),- (0, import_react52.createElement)(CheckIcon),++ (0, import_react53.createElement)(CheckIcon),t("Approve")));@@@ -20373,43 -20889,43 +21239,43 @@@var COLLAPSE_ROWS = 8;var SIGNS = { added: "+", removed: "−", same: "" };function FileBox({ name, path, state, blocks }) {- const [open, setOpen] = (0, import_react51.useState)(false);- const [open, setOpen] = (0, import_react52.useState)(false);++ const [open, setOpen] = (0, import_react53.useState)(false);const all = blocks.flat();const added = all.filter((row) => row.kind === "added").length;const removed = all.filter((row) => row.kind === "removed").length;const folds = all.length > COLLAPSE_ROWS;const shut = folds && !open;- return (0, import_react51.createElement)(- return (0, import_react52.createElement)(++ return (0, import_react53.createElement)("div",{ className: "bt-learning-file" },- (0, import_react51.createElement)(- (0, import_react52.createElement)(++ (0, import_react53.createElement)("div",{ className: "bt-learning-filehead" },- (0, import_react51.createElement)("span", { className: "bt-learning-name" }, name),- path ? (0, import_react51.createElement)("span", { className: "bt-learning-path" }, path) : null,- (0, import_react51.createElement)("span", { className: "bt-learning-spacer" }),- added > 0 ? (0, import_react51.createElement)("span", { className: "bt-learning-plus" }, `+${added}`) : null,- removed > 0 ? (0, import_react51.createElement)("span", { className: "bt-learning-minus" }, `−${removed}`) : null,- (0, import_react51.createElement)("span", { className: `bt-learning-state bt-learning-state-${state.toLowerCase()}` }, t(state))- (0, import_react52.createElement)("span", { className: "bt-learning-name" }, name),- path ? (0, import_react52.createElement)("span", { className: "bt-learning-path" }, path) : null,- (0, import_react52.createElement)("span", { className: "bt-learning-spacer" }),- added > 0 ? (0, import_react52.createElement)("span", { className: "bt-learning-plus" }, `+${added}`) : null,- removed > 0 ? (0, import_react52.createElement)("span", { className: "bt-learning-minus" }, `−${removed}`) : null,- (0, import_react52.createElement)("span", { className: `bt-learning-state bt-learning-state-${state.toLowerCase()}` }, t(state))++ (0, import_react53.createElement)("span", { className: "bt-learning-name" }, name),++ path ? (0, import_react53.createElement)("span", { className: "bt-learning-path" }, path) : null,++ (0, import_react53.createElement)("span", { className: "bt-learning-spacer" }),++ added > 0 ? (0, import_react53.createElement)("span", { className: "bt-learning-plus" }, `+${added}`) : null,++ removed > 0 ? (0, import_react53.createElement)("span", { className: "bt-learning-minus" }, `−${removed}`) : null,++ (0, import_react53.createElement)("span", { className: `bt-learning-state bt-learning-state-${state.toLowerCase()}` }, t(state))),- (0, import_react51.createElement)(- (0, import_react52.createElement)(++ (0, import_react53.createElement)("div",{ className: shut ? "bt-learning-code bt-learning-shut" : "bt-learning-code" },blocks.map((rows2, blockIndex) => [- blockIndex > 0 ? (0, import_react51.createElement)("div", { className: "bt-learning-gap", key: `gap-${blockIndex}` }) : null,- ...rows2.map((row, rowIndex) => (0, import_react51.createElement)(- blockIndex > 0 ? (0, import_react52.createElement)("div", { className: "bt-learning-gap", key: `gap-${blockIndex}` }) : null,- ...rows2.map((row, rowIndex) => (0, import_react52.createElement)(++ blockIndex > 0 ? (0, import_react53.createElement)("div", { className: "bt-learning-gap", key: `gap-${blockIndex}` }) : null,++ ...rows2.map((row, rowIndex) => (0, import_react53.createElement)("div",{ className: `bt-learning-row bt-learning-${row.kind}`, key: `${blockIndex}-${rowIndex}` },- (0, import_react51.createElement)("span", { className: "bt-learning-num", "aria-hidden": true }, row.number ?? ""),- (0, import_react51.createElement)("span", { className: "bt-learning-sign", "aria-hidden": true }, SIGNS[row.kind]),- (0, import_react51.createElement)("span", { className: "bt-learning-text" }, row.line || " ")- (0, import_react52.createElement)("span", { className: "bt-learning-num", "aria-hidden": true }, row.number ?? ""),- (0, import_react52.createElement)("span", { className: "bt-learning-sign", "aria-hidden": true }, SIGNS[row.kind]),- (0, import_react52.createElement)("span", { className: "bt-learning-text" }, row.line || " ")++ (0, import_react53.createElement)("span", { className: "bt-learning-num", "aria-hidden": true }, row.number ?? ""),++ (0, import_react53.createElement)("span", { className: "bt-learning-sign", "aria-hidden": true }, SIGNS[row.kind]),++ (0, import_react53.createElement)("span", { className: "bt-learning-text" }, row.line || " ")))])),- folds ? (0, import_react51.createElement)(- folds ? (0, import_react52.createElement)(++ folds ? (0, import_react53.createElement)("div",{ className: shut ? "bt-learning-morebar bt-learning-morebar-shut" : "bt-learning-morebar" },- (0, import_react51.createElement)(- (0, import_react52.createElement)(++ (0, import_react53.createElement)("button",{ type: "button", className: "bt-learning-more", "aria-expanded": open, onClick: () => setOpen(!open) },t(open ? "Show less" : "Show all {count} lines", { count: all.length })@@@ -20420,7 -20936,7 +21286,7 @@@function LearningProposals({ turn, dock, sessionId, useRoster, actions }) {const roster = useRoster((value) => value);const facts = useTurnFacts(sessionId, actions);- const [failed, setFailed] = (0, import_react51.useState)({});- const [failed, setFailed] = (0, import_react52.useState)({});++ const [failed, setFailed] = (0, import_react53.useState)({});const bot = roster.byId?.[sessionId];if (!bot || currentPart(bot) !== sessionId) return null;const proposals = roster.learning?.[bot.id] ?? [];@@@ -20447,10 -20963,10 +21313,10 @@@delete next[id];return next;});- return (0, import_react51.createElement)("div", { className: dock ? "bt-learning-stack bt-learning-dock" : "bt-learning-stack" }, cards.map((proposal) => (0, import_react51.createElement)(- return (0, import_react52.createElement)("div", { className: dock ? "bt-learning-stack bt-learning-dock" : "bt-learning-stack" }, cards.map((proposal) => (0, import_react52.createElement)(++ return (0, import_react53.createElement)("div", { className: dock ? "bt-learning-stack bt-learning-dock" : "bt-learning-stack" }, cards.map((proposal) => (0, import_react53.createElement)("div",{ className: "bt-q-inline", key: proposal.id },- (0, import_react51.createElement)(ProposalCard, {- (0, import_react52.createElement)(ProposalCard, {++ (0, import_react53.createElement)(ProposalCard, {proposal,initialError: failed[proposal.id]?.error ?? failedAnswers.get(proposal.id)?.error,onFailure,@@@ -20460,10 -20976,10 +21326,10 @@@)));}function LearningTurnTail(props) {- return (0, import_react51.createElement)(LearningProposals, { ...props, dock: false });- return (0, import_react52.createElement)(LearningProposals, { ...props, dock: false });++ return (0, import_react53.createElement)(LearningProposals, { ...props, dock: false });}function LearningDock(props) {- return (0, import_react51.createElement)(LearningProposals, { ...props, dock: true });- return (0, import_react52.createElement)(LearningProposals, { ...props, dock: true });++ return (0, import_react53.createElement)(LearningProposals, { ...props, dock: true });}var LEARNING_CSS = `.bt-learning-stack{display:flex;flex-direction:column;gap:4px}@@@ -20546,7 -21062,7 +21412,7 @@@ function createSwitchWindow(settle)}// src/client/user-message.js- var import_react52 = require("react");-var import_react53 = require("react");++var import_react54 = require("react");var ui = __toESM(require("@deepseek-ai/dsh-client-ui-primitives"), 1);var canDrawUserMessages = () => typeof ui.projectUserText === "function";function contentParts(content) {@@@ -20578,38 -21094,38 +21444,38 @@@ function userTextParts(text, bots, refereturn parts;}function UserText({ text, bots, referenceLabels, skillNames, references, actions }) {- return userTextParts(text, bots, referenceLabels).map((part, index) => part.bot ? (0, import_react52.createElement)(- return userTextParts(text, bots, referenceLabels).map((part, index) => part.bot ? (0, import_react53.createElement)(++ return userTextParts(text, bots, referenceLabels).map((part, index) => part.bot ? (0, import_react54.createElement)("button",{ key: index, type: "button", className: "bt-umention", title: `@${part.bot.name}`, onClick: () => actions.openSession(part.bot.id) },- (0, import_react52.createElement)(BotMark, { bot: part.bot, size: 16 }),- (0, import_react53.createElement)(BotMark, { bot: part.bot, size: 16 }),++ (0, import_react54.createElement)(BotMark, { bot: part.bot, size: 16 }),part.label- ) : (0, import_react52.createElement)(import_react52.Fragment, { key: index }, ui.projectUserText(part.text, referenceLabels, skillNames, "skill", references)));- ) : (0, import_react53.createElement)(import_react53.Fragment, { key: index }, ui.projectUserText(part.text, referenceLabels, skillNames, "skill", references)));++ ) : (0, import_react54.createElement)(import_react54.Fragment, { key: index }, ui.projectUserText(part.text, referenceLabels, skillNames, "skill", references)));}function Attachments({ attachments, renderMessageImages }) {const compact2 = attachments.length > 1;- return (0, import_react52.createElement)("div", { className: "bt-uattach" }, attachments.map((block, index) => {- return (0, import_react53.createElement)("div", { className: "bt-uattach" }, attachments.map((block, index) => {++ return (0, import_react54.createElement)("div", { className: "bt-uattach" }, attachments.map((block, index) => {if (block.type === "image") {- return renderMessageImages ? (0, import_react52.createElement)(import_react52.Fragment, { key: index }, renderMessageImages({ images: [{ attachment: block.attachment }], align: "end", compact: compact2 })) : null;- return renderMessageImages ? (0, import_react53.createElement)(import_react53.Fragment, { key: index }, renderMessageImages({ images: [{ attachment: block.attachment }], align: "end", compact: compact2 })) : null;++ return renderMessageImages ? (0, import_react54.createElement)(import_react54.Fragment, { key: index }, renderMessageImages({ images: [{ attachment: block.attachment }], align: "end", compact: compact2 })) : null;}const file = block.attachment;const meta = [ui.fileExtension?.(file.name)?.toUpperCase().slice(0, 8), ui.fileSizeText?.(file.bytes)].filter(Boolean).join(" · ");- return (0, import_react52.createElement)(- return (0, import_react53.createElement)(++ return (0, import_react54.createElement)("span",{ key: index, className: "bt-ufile", title: file.name },- ui.FileTypeIcon ? (0, import_react52.createElement)(ui.FileTypeIcon, { path: file.name, className: "bt-ufile-icon" }) : null,- (0, import_react52.createElement)("span", { className: "bt-ufile-text" }, (0, import_react52.createElement)("span", { className: "bt-ufile-name" }, file.name), meta ? (0, import_react52.createElement)("span", { className: "bt-ufile-meta" }, meta) : null)- ui.FileTypeIcon ? (0, import_react53.createElement)(ui.FileTypeIcon, { path: file.name, className: "bt-ufile-icon" }) : null,- (0, import_react53.createElement)("span", { className: "bt-ufile-text" }, (0, import_react53.createElement)("span", { className: "bt-ufile-name" }, file.name), meta ? (0, import_react53.createElement)("span", { className: "bt-ufile-meta" }, meta) : null)++ ui.FileTypeIcon ? (0, import_react54.createElement)(ui.FileTypeIcon, { path: file.name, className: "bt-ufile-icon" }) : null,++ (0, import_react54.createElement)("span", { className: "bt-ufile-text" }, (0, import_react54.createElement)("span", { className: "bt-ufile-name" }, file.name), meta ? (0, import_react54.createElement)("span", { className: "bt-ufile-meta" }, meta) : null));}));}function CopyButton({ text }) {- const [copied, setCopied] = (0, import_react52.useState)(false);- const [copied, setCopied] = (0, import_react53.useState)(false);++ const [copied, setCopied] = (0, import_react54.useState)(false);const copy2 = () => {void navigator.clipboard?.writeText(text).then(() => {setCopied(true);setTimeout(() => setCopied(false), 1e3);});};- return (0, import_react52.createElement)("button", { type: "button", className: "bt-tool", "aria-label": copied ? t("Copied") : t("Copy"), title: copied ? t("Copied") : t("Copy"), onClick: copy2 }, copied ? (0, import_react52.createElement)(CheckIcon) : (0, import_react52.createElement)(CopyIcon));- return (0, import_react53.createElement)("button", { type: "button", className: "bt-tool", "aria-label": copied ? t("Copied") : t("Copy"), title: copied ? t("Copied") : t("Copy"), onClick: copy2 }, copied ? (0, import_react53.createElement)(CheckIcon) : (0, import_react53.createElement)(CopyIcon));++ return (0, import_react54.createElement)("button", { type: "button", className: "bt-tool", "aria-label": copied ? t("Copied") : t("Copy"), title: copied ? t("Copied") : t("Copy"), onClick: copy2 }, copied ? (0, import_react54.createElement)(CheckIcon) : (0, import_react54.createElement)(CopyIcon));}var clock3 = (time) => typeof time === "number" ? new Date(time).toLocaleTimeString(dateLocale(), { hour: "numeric", minute: "2-digit" }) : void 0;function UserMessageCell({ node, sessionId, useRoster, actions, renderMessageImages, openFile, openSkill }) {@@@ -20619,12 -21135,12 +21485,12 @@@const referenceLabels = data.referenceLabels ?? [];const references = openFile && openSkill ? { openFile, openSkill } : void 0;const steering = node.kind === "steering";- const groupTime = roster.roomsById?.[sessionId] && Number.isFinite(data.time) ? messageClock(data.time) : void 0;+ const sentAt = Number.isFinite(data.time) ? messageClock(data.time) : void 0;const { shown, folded, control } = useFold(text, { markdown: false });- const body = (0, import_react52.createElement)(UserText, { text: shown, bots: mentionableBots(roster, sessionId), referenceLabels, skillNames: data.skillNames ?? [], references, actions });- const row = (0, import_react52.useRef)(null);- const [toolsOpen, setToolsOpen] = (0, import_react52.useState)(false);- (0, import_react52.useEffect)(() => {- const body = (0, import_react53.createElement)(UserText, { text: shown, bots: mentionableBots(roster, sessionId), referenceLabels, skillNames: data.skillNames ?? [], references, actions });- const row = (0, import_react53.useRef)(null);- const [toolsOpen, setToolsOpen] = (0, import_react53.useState)(false);- (0, import_react53.useEffect)(() => {++ const body = (0, import_react54.createElement)(UserText, { text: shown, bots: mentionableBots(roster, sessionId), referenceLabels, skillNames: data.skillNames ?? [], references, actions });++ const row = (0, import_react54.useRef)(null);++ const [toolsOpen, setToolsOpen] = (0, import_react54.useState)(false);++ (0, import_react54.useEffect)(() => {if (!toolsOpen) return void 0;const onDown = (event) => {if (!row.current?.contains(event.target)) setToolsOpen(false);@@@ -20640,24 -21156,24 +21506,24 @@@if (!noHover() || event.target instanceof Element && event.target.closest("a,button,input,textarea,select,pre,code,[role=button],[role=link]")) return;setToolsOpen((value) => !value);};- return (0, import_react52.createElement)(- return (0, import_react53.createElement)(++ return (0, import_react54.createElement)("div",{ ref: row, className: "bt-umsg", "data-steering": steering || void 0 },- (0, import_react52.createElement)(- (0, import_react53.createElement)(++ (0, import_react54.createElement)("div",{ className: "bt-ustack" },- attachments.length > 0 ? (0, import_react52.createElement)(Attachments, { attachments, renderMessageImages }) : null,- text !== "" || rest.length > 0 ? (0, import_react52.createElement)(- attachments.length > 0 ? (0, import_react53.createElement)(Attachments, { attachments, renderMessageImages }) : null,- text !== "" || rest.length > 0 ? (0, import_react53.createElement)(++ attachments.length > 0 ? (0, import_react54.createElement)(Attachments, { attachments, renderMessageImages }) : null,++ text !== "" || rest.length > 0 ? (0, import_react54.createElement)("div",{ className: "bt-ubody", title: clock3(data.time), "data-folded": folded || void 0, onClick: tapTools },- control ? (0, import_react52.createElement)("div", { className: "bt-fold-body" }, body) : body,- control ? (0, import_react53.createElement)("div", { className: "bt-fold-body" }, body) : body,++ control ? (0, import_react54.createElement)("div", { className: "bt-fold-body" }, body) : body,control,- rest.map((block, index) => ui.JsonBlock ? (0, import_react52.createElement)(ui.JsonBlock, { key: index, label: t("Content"), payload: block }) : null)- rest.map((block, index) => ui.JsonBlock ? (0, import_react53.createElement)(ui.JsonBlock, { key: index, label: t("Content"), payload: block }) : null)++ rest.map((block, index) => ui.JsonBlock ? (0, import_react54.createElement)(ui.JsonBlock, { key: index, label: t("Content"), payload: block }) : null)) : null,- referenceLabels.length > 0 ? (0, import_react52.createElement)("div", { className: "bt-urefs" }, t("Referenced {labels}", { labels: referenceLabels.join(t(", ")) })) : null,- groupTime ? (0, import_react52.createElement)("div", { className: "bt-utime", title: clockLabel(data.time) }, groupTime) : null- referenceLabels.length > 0 ? (0, import_react53.createElement)("div", { className: "bt-urefs" }, t("Referenced {labels}", { labels: referenceLabels.join(t(", ")) })) : null,- sentAt ? (0, import_react53.createElement)("div", { className: "bt-utime", title: clockLabel(data.time) }, sentAt) : null++ referenceLabels.length > 0 ? (0, import_react54.createElement)("div", { className: "bt-urefs" }, t("Referenced {labels}", { labels: referenceLabels.join(t(", ")) })) : null,++ sentAt ? (0, import_react54.createElement)("div", { className: "bt-utime", title: clockLabel(data.time) }, sentAt) : null),- text === "" ? null : (0, import_react52.createElement)("div", { className: "bt-utools", "data-open": toolsOpen || void 0 }, (0, import_react52.createElement)(CopyButton, { text }))- text === "" ? null : (0, import_react53.createElement)("div", { className: "bt-utools", "data-open": toolsOpen || void 0 }, (0, import_react53.createElement)(CopyButton, { text }))++ text === "" ? null : (0, import_react54.createElement)("div", { className: "bt-utools", "data-open": toolsOpen || void 0 }, (0, import_react54.createElement)(CopyButton, { text })));}var USER_MESSAGE_CSS = `diff --cc ds-bot/src/client/bot-draft.jsindex c54bb601,52e97de0..58d7ec22--- a/ds-bot/src/client/bot-draft.js+++ b/ds-bot/src/client/bot-draft.js@@@ -8,15 -8,14 +8,14 @@@ export function freshBotName(roster, bareturn `${base} ${index}`}- // The form starts on the DSH default model when it is usable, else the first usable- // one. A model whose provider has no key fails every turn, so with none usable the form- // starts on none and the new Bot waits for a pick.+ // The form starts on the team default model from settings when it is served, then+ // the DSH default, else the first one.export function startModel(roster) {- const usable = (roster.models ?? []).filter(model => !model.needsKey)- return (usable.find(model => model.ref === roster.defaultModel) ?? usable[0])?.ref ?? ''- const models = roster.models ?? []- return (models.find(model => model.ref === roster.prefs?.defaultBotModel) ?? models.find(model => model.ref === roster.defaultModel) ?? models[0])?.ref ?? ''++ const usable = (roster.models ?? []).filter(model => model.needsKey !== true)++ return (usable.find(model => model.ref === roster.prefs?.defaultBotModel) ?? usable.find(model => model.ref === roster.defaultModel) ?? usable[0])?.ref ?? ''}-// The model is always sent: the host fixes it on the Bot at creation.+// A chosen model is always sent: the host fixes it on the Bot at creation.export function createPayload({ name, look, image, model, effort, brief }) {const payload = { name, color: look.color, avatar: image ? { shape: look.shape, image } : { shape: look.shape } }if (model) payload.model = modeldiff --cc ds-bot/src/client/i18n.jsindex 864100bb,92e235b2..e9cb80e2--- a/ds-bot/src/client/i18n.js+++ b/ds-bot/src/client/i18n.js@@@ -497,7 -462,7 +498,8 @@@ const ZH ='DS Bot settings': 'DS Bot 设置','Settings pages': '设置页面','Models, providers, and the rest of DeepSeek Harness': '模型、服务商和 DeepSeek Harness 的其他设置',- 'Advanced settings (DeepSeek Harness)': '高级设置(DeepSeek Harness)',+ 'Harness settings': 'Harness 设置',++ 'Open Harness settings': '打开 Harness 设置','Back to Bots': '返回 Bot 列表','Close settings': '关闭设置',@@@ -1067,8 -1068,8 +1111,7 @@@Unit: '单位','Create task': '创建任务','Turn on Automation tasks in DSH': '在 DSH 里打开「自动化任务」',- 'Switch on Automation tasks on the Plugins page in Advanced settings (DeepSeek Harness).': '在「高级设置(DeepSeek Harness)」的插件页启用「自动化任务」。',- 'Open Advanced settings (DeepSeek Harness)': '打开高级设置(DeepSeek Harness)',+ 'Switch on Automation tasks on the Plugins page in Harness settings.': '在 Harness 设置的插件页启用「自动化任务」。',- 'Open Harness settings': '打开 Harness 设置','New task': '新建任务','No scheduled tasks yet.': '还没有定时任务。','No scheduled tasks yet. Add one': '还没有定时任务,去添加',diff --cc ds-bot/src/client/index.jsindex 4dbefa21,1bba75df..61e3d20a--- a/ds-bot/src/client/index.js+++ b/ds-bot/src/client/index.js@@@ -21,8 -21,7 +21,8 @@@ import { QuestionCard, QuestionDock } fimport { AnsweredReply, WidgetDock, WIDGET_CSS } from './widget-cell.js'import { HandoffDock, HANDOFF_CSS } from './handoff-card.js'import { installHeaderNavigation } from './header-navigation.js'- import { AssistantCell, TriggerCell, TurnProcessCell, Nothing, TurnTailCell, ToolCell } from './cells.js'+ import { AssistantCell, TriggerCell, TurnProcessCell, Nothing, CellEmpty, TurnTailCell, ToolCell } from './cells.js'+import { FailureCell, TURN_ERROR_CSS } from './turn-error.js'import { Overlays } from './overlays.js'import { createBotBrowsers, serveBrowserReads } from './bot-browsers.js'import { BROWSER_CSS } from './browser-pane.js'diff --cc ds-bot/src/client/schedules.jsindex 6e686ac9,ca4d0a06..1e5dcc7e--- a/ds-bot/src/client/schedules.js+++ b/ds-bot/src/client/schedules.js@@@ -222,10 -232,10 +232,11 @@@ export function ScheduleSummary({ bot,const view = useSchedules(actions)const tasks = view?.available ? view.tasks.filter(task => task.botId === bot.id && task.status === 'active') : []return h('div', null,- h('div', { className: 'bt-section-title' }, t('Scheduled tasks')),+ h('div', { className: 'bt-section-title' }, tasks.length === 0 ? t('Scheduled tasks') : t('Scheduled tasks · {count}', { count: tasks.length })),tasks.length === 0- ? h('button', { type: 'button', className: 'bt-more', onClick: () => actions.openSettings('schedules', bot.id) }, view?.available === false ? t('Switch on Automation tasks on the Plugins page in Advanced settings (DeepSeek Harness).') : t('No scheduled tasks yet. Add one'))- : h('div', { className: 'bt-task-list' }, tasks.slice(0, 3).map(task => h('button', { key: task.id, type: 'button', className: 'bt-task-line', onClick: () => actions.openSettings('schedules') },+ ? h('button', { type: 'button', className: 'bt-more', onClick: () => actions.openSettings('schedules', bot.id) }, view?.available === false ? t('Switch on Automation tasks on the Plugins page in Harness settings.') : t('No scheduled tasks yet. Add one'))+ : h('div', { className: 'bt-task-list' }, tasks.slice(0, 3).map(task => h('button', { key: task.id, type: 'button', className: 'bt-task-line', onClick: () => actions.openSettings('schedules', `bot:${bot.id}`) },++h(ClockIcon), h('span', { className: 'bt-task-line-title' }, task.title), h('span', { className: 'bt-task-line-when' }, timingText(task))))))}diff --cc ds-bot/src/client/sidebar.jsindex a74a47ac,e2d58d3b..32a79fb4--- a/ds-bot/src/client/sidebar.js+++ b/ds-bot/src/client/sidebar.js@@@ -806,10 -853,9 +876,10 @@@ export function AccountLauncher({ seat],]if (signedIn) groups.push([[accountT('signOut'), SignOutIcon, askSignOut, undefined, true]])+ else if (signedOut) groups.push([[t('Sign in to DeepSeek'), SignInIcon, () => actions.signIn()]])return h(Fragment, null,h('button', { ref: button, type: 'button', className: 'bt-account', 'aria-label': t('Account'), 'aria-haspopup': 'menu', 'aria-expanded': open, onClick: toggle },- h('span', { className: 'bt-you', 'aria-hidden': true }, h(BotMark, { look: MAIN_LOOK, size: 24 }))),+ h('span', { className: 'bt-you', 'aria-hidden': true }, h(GearIcon))),open && box ? createPortal(h('div', { className: 'bt-menu bt-menu-up bt-account-menu', role: 'menu', 'aria-label': t('Account'), style: box },confirm !== null ? h('div', { className: 'bt-confirm', role: 'alertdialog', 'aria-label': accountT('signOut') },h('p', { className: 'bt-confirm-text' }, accountT(confirm === 'running' ? 'signOutRunningDescription' : confirm === 'unknown' ? 'signOutUnknownDescription' : 'signOutDescription')),diff --cc ds-bot/src/host/models.jsindex 068ae16b,dacd0366..48b92c0c--- a/ds-bot/src/host/models.js+++ b/ds-bot/src/host/models.js@@@ -16,32 -33,8 +35,32 @@@ export function install(rt)// A model's thinking levels, resolved once and kept for a short while: they change// only with the provider, which also drops the catalog cache.const reasoningCache = new Map()- ctx.on?.('llm/adapters-updated', () => { catalogCache = { at: 0, value: [] }; reasoningCache.clear(); return forgetChangedRefusals() })- for (const name of ['credentials/reference-updated', 'settings/document-updated']) ctx.on?.(name, () => { catalogCache = { at: 0, value: [] } })+ const dropCatalog = () => { catalogCache = { at: 0, value: [] } }+ // A key set or a sign-in may be the user's fix for a Bot's failed turn (turns.js); a+ // key removed or a sign-out is not. A provider that registers or changes fixes+ // nothing by itself: providers register late at every start.- ctx.on?.('llm/adapters-updated', () => { dropCatalog(); reasoningCache.clear() })++ ctx.on?.('llm/adapters-updated', () => { dropCatalog(); reasoningCache.clear(); return forgetChangedRefusals() })+ ctx.on?.('credentials/reference-updated', async (ref) => {+ dropCatalog()+ if (await inPlace(credentials => credentials.describe(ref))) rt.unblockBots?.({ ref })+ })+ // A sign-in writes the account's record. A sign-out removes it, and so does a token+ // the provider refused, while the turn that failed on it still runs. Other plugins'+ // records (an OAuth token refresh) say nothing about the account.+ ctx.on?.('credentials/record-updated', async (key) => {+ dropCatalog()+ if (String(key) !== ACCOUNT_RECORD) return+ if (await inPlace(credentials => credentials.describeRecord(key))) rt.unblockBots?.({ signedIn: true })+ })+ ctx.on?.('settings/document-updated', dropCatalog)++ // Whether a credential is there after a change. One that cannot be read counts as+ // there, so a fix is not missed.+ async function inPlace(describe) {+ const credentials = ctx.get?.('credentials')+ if (credentials === undefined) return true+ try { return (await describe(credentials))?.configured !== false } catch { return true }+ }// The thinking levels a model serves: `{efforts: [{id, name, description?}],// defaultEffort?}`, or undefined when it has none or the provider cannot say.@@@ -91,24 -81,21 +110,28 @@@if (reasoning !== undefined) entry.reasoning = reasoning}))catalogCache = { at: Date.now(), value: entries }- return entries+ return answerable(entries)}- // The profile default model of DSH as set, served or not.+ // The profile default model of DSH as set, served or not, and able to answer.const defaultRef = () => {const selection = ctx.get?.('agentDefaultModel')?.currentSelection?.()- return selection?.provider && selection?.model ? `${selection.provider}/${selection.model}` : undefined+ if (!selection?.provider || !selection?.model) return undefined+ const ref = `${selection.provider}/${selection.model}`+ return refused.has(ref) ? undefined : ref}- // The profile default model of DSH, when it is served; else the first served model.+ // A model whose provider has no key fails every turn, so no Bot is given one unasked.+ const usableOf = entries => entries.filter(entry => entry.needsKey !== true)+ // By the catalog as last listed, without waiting for a fresh one.+ const isUsable = ref => usableOf(catalogCache.value).some(entry => entry.ref === ref)+ // The profile default model of DSH, when it is served and usable; else the first+ // usable model; else none.function pickDefault(entries) {+ const usable = usableOf(entries)const ref = defaultRef()- return usable.find(entry => entry.ref === ref)?.ref ?? usable[0]?.ref- const list = answerable(entries)++ // Neither a refused route nor one that fails for a missing key is picked.++ const list = answerable(usable)+ return list.find(entry => entry.ref === ref)?.ref ?? list[0]?.ref}const defaultModel = async () => pickDefault(await catalog())@@@ -244,9 -246,33 +283,32 @@@}}+ // A route that refused a request for not being a model endpoint: it stays out of+ // the catalog from now on, the Bots pinned to it move to what they would be given+ // today, and each of them re-selects even when its record looks applied (`force`):+ // its Session may still be on the route, or on another Bot's route in a group.+ async function routeRefused(ref, bot) {+ const served = await servedModels(ref)+ if (!refused.has(ref)) {+ refused.set(ref, served)+ rt.warn('ds-bot: %s is not a model endpoint, so it is not chosen again', ref)+ const entries = await catalog()+ const pinned = Object.values(state.bots).filter(other => other.model === ref || other.appliedModel === ref)+ for (const other of pinned) {+ if (other.model === ref) other.model = pickDefault(entries)+ if (other.appliedModel === ref) delete other.appliedModel+ }+ await rt.save()+ for (const other of pinned) {+ if (other !== bot) await applyModel(other, { force: true }).catch(error => rt.warn('ds-bot: model for %s not applied: %s', other.name, error))+ }+ }+ if (bot !== undefined) await applyModel(bot, { force: true })+ }+Object.assign(rt, {- catalog, cachedCatalog: () => catalogCache.value, cachedDefault: () => pickDefault(catalogCache.value),- defaultRef, defaultModel, defaultEffort, isUsable, resolveModel, desiredModel, reasoningOf, resolveEffort, desiredEffort,- selectSessionModel, applyModel, waitForModel, syncModels, dropCatalog,+ catalog, cachedCatalog: () => answerable(catalogCache.value), cachedDefault: () => pickDefault(catalogCache.value),- defaultRef, defaultModel, defaultBotModel, defaultEffort, resolveModel, desiredModel, reasoningOf, resolveEffort, desiredEffort,- selectSessionModel, applyModel, waitForModel, syncModels, routeRefused,- dropCatalog: () => { catalogCache = { at: 0, value: [] } },++ defaultRef, defaultModel, defaultBotModel, defaultEffort, isUsable, resolveModel, desiredModel, reasoningOf, resolveEffort, desiredEffort,++ selectSessionModel, applyModel, waitForModel, syncModels, routeRefused, dropCatalog,})}diff --cc ds-bot/src/host/roster.jsindex cf022ab2,72796570..1d8cec21--- a/ds-bot/src/host/roster.js+++ b/ds-bot/src/host/roster.js@@@ -411,9 -354,13 +413,10 @@@ export function install(rt).catch(error => rt.warn('ds-bot: profile update for %s not delivered: %s', bot.name, error?.message ?? error))}if (modelChanged) await rt.applyModel(bot, { force: true })- if (moved) void rt.followFolder(bot.id)+ if (moved) void rt.followFolder({ botId: bot.id })- if (bot.model && bot.kickoff !== undefined) {- const held = bot.kickoff- delete bot.kickoff- await rt.save()- sendKickoff(bot, held)- }+ // A new model lifted what blocked the Bot; a new thinking level alone fixes nothing.++ // releaseKickoff itself leaves when the Bot still lacks a model or holds no greeting.+ if (modelChanged && bot.blocked === undefined) await releaseKickoff(bot)return bot}diff --cc ds-bot/src/host/tools.jsindex 0962c61e,814fda44..253ff79d--- a/ds-bot/src/host/tools.js+++ b/ds-bot/src/host/tools.js@@@ -320,11 -330,13 +330,13 @@@ export function install(rt)const workDir = args.work_dir ? await rt.cleanWorkDir(args.work_dir) : undefinedconst name = String(args.name ?? '').trim()await rt.approveFolder(exec, { path: workDir, who: { en: `the new Bot ${name}`, zh: `新 Bot ${name} ` } })- // Without a named model the new Bot takes its creator's: the DSH default may be- // a provider that has no key, and then the new Bot fails on its first reply.+ // Without a named model the team's default applies; without one the new Bot+ // takes its creator's: the DSH default may be a provider that has no key, and+ // then the new Bot fails on its first reply.const creator = callerBot(exec)- const usable = creator?.model && (await rt.catalog()).some(entry => entry.ref === creator.model && !entry.needsKey)- const model = args.model || (usable ? creator.model : undefined)- const served = new Set((await rt.catalog()).map(entry => entry.ref))++ const served = new Set((await rt.catalog()).filter(entry => entry.needsKey !== true).map(entry => entry.ref))+ const fallback = [state.prefs.defaultBotModel, creator?.model].find(ref => ref && served.has(ref))+ const model = args.model || fallbackconst bot = await rt.createBot({ ...args, avatar: avatar === undefined ? undefined : { image: avatar }, model, workDir, effort: args.effort, createdBy: creator?.id })return `Created ${bot.name}${workDir ? `, working in ${workDir}` : ''}. It is greeting the user now.`} catch (error) {diff --cc ds-bot/src/host/turns.jsindex c61910fe,78619e80..04e1dbe3--- a/ds-bot/src/host/turns.js+++ b/ds-bot/src/host/turns.js@@@ -3,19 -3,13 +3,21 @@@//// Turn tracking: which turns were triggered by another Bot, and what they said.import { randomUUID } from 'node:crypto'+ import { carrierKeyOf } from '@deepseek-ai/dsh-scope'import { HANDOFF_ACK, MESSAGE_INLINE_MAX, REFERENCE_KIND, REPLY_KIND, SOURCE_KIND, STEER_CUT } from './constants.js'+ import { cleanText } from './diagnostics.js'import { absoluteLinks } from './links.js'-import { textOf } from './text.js'+import { splitRef, textOf } from './text.js'import { reminderText } from './schedules.js'+// Failures only the user can fix: a key, a sign-in, a balance. They block the Bot+// until it is fixed (`bot.blocked`, for the repair card).+export const BLOCKING_CODES = new Set(['MISSING_CREDENTIAL', 'INVALID_CREDENTIAL', 'AUTH', 'QUOTA', 'ACCOUNT_QUOTA', 'ACCOUNT_SIGN_IN_REQUIRED', 'ACCOUNT_SIGNED_OUT', 'ACCOUNT_TOKEN_INVALID'])+// The ones a key set outside a turn can fix, and the ones a sign-in can (unblockBots).+// A balance only a turn that completes shows fixed, as Retry runs one.+const KEY_CODES = new Set(['MISSING_CREDENTIAL', 'INVALID_CREDENTIAL', 'AUTH'])+const SIGN_IN_CODES = new Set(['ACCOUNT_SIGN_IN_REQUIRED', 'ACCOUNT_SIGNED_OUT', 'ACCOUNT_TOKEN_INVALID'])+// A failed turn's `LlmFailure`, kept to what can be shown and logged. Like DSH's own// error row, an AUTH failure loses its message: providers may echo part of the key.export function turnFailure(error) {@@@ -394,64 -518,18 +526,76 @@@ export function install(rt)})}+ // The facts of a blocking failure stay on its Bot, from any of its Sessions, until a+ // turn of it completes, a change that can fix it (unblockBots), or its model changes+ // (roster.js). Never the message: a provider may echo part of the key. The provider+ // is the failing route's, which is the Session's last request, else the model the+ // Bot runs on.+ const blockBot = (id, session, failure) => {+ const bot = rt.botOf(rt.selfOf(id))+ if (bot === undefined || !BLOCKING_CODES.has(failure.code)) return false+ const provider = session?.requestHeader?.()?.config?.provider ?? splitRef(bot.appliedModel)?.provider+ bot.blocked = {+ code: failure.code,+ ...(failure.status === undefined ? {} : { status: failure.status }),+ ...(failure.requestId === undefined ? {} : { requestId: failure.requestId }),+ ...(provider ? { provider } : {}),+ at: Date.now(),+ }+ void rt.save().catch(() => {})+ return true+ }+ const unblockBot = (botId) => {+ const bot = rt.botOf(botId)+ if (bot?.blocked === undefined) return+ delete bot.blocked+ void rt.save().catch(() => {})+ }++ // A key set (`ref`) or a sign-in may be the user's fix (models.js): the blocks it can+ // fix lift, and a greeting held for one goes out again. A key lifts the key failures+ // of the providers that read it; one whose provider names no key, or that failed on+ // a provider not known, lifts on any key. A host that only reads the team leaves it+ // to the one that holds it.+ function unblockBots({ ref, signedIn = false, keyed } = {}) {+ if (rt.readOnly?.() !== undefined) return+ let refs+ try { refs = ref === undefined ? undefined : rt.keyRefs?.() } catch {}+ const fixes = ({ code, provider }) => (signedIn && SIGN_IN_CODES.has(code))+ || (ref !== undefined && KEY_CODES.has(code) && (refs?.get(provider) ?? ref) === ref)+ || (code === 'MISSING_CREDENTIAL' && provider !== undefined && keyed?.has(provider) === true)+ const lifted = Object.values(state.bots ?? {}).filter(bot => bot.blocked !== undefined && fixes(bot.blocked))+ if (lifted.length === 0) return+ for (const bot of lifted) delete bot.blocked+ void rt.save().catch(() => {})+ for (const bot of lifted) void rt.releaseKickoff(bot).catch(error => rt.warn('ds-bot: greeting of %s not sent again: %s', bot.name, error))+ }++ // The repair card's Retry. A greeting that failed goes out again; otherwise the Bot+ // answers the user's last message, which is not sent again. A greeting on its way, or+ // a turn under way in the Bot's chat, answers already: a turn on top answers twice.+ async function resumeBot(bot) {+ if (await rt.releaseKickoff(bot)) return+ if (rt.greetingOut?.(bot.id) || live.get(rt.chatOf(bot.id))?.turn !== undefined) return+ const code = bot.blocked?.code+ await rt.deliver({+ toId: bot.id,+ role: 'continue',+ text: `Your last turn failed${code ? ` (${code})` : ''} and the user has fixed it. Answer the user's last unanswered message.`,+ })+ }+ ctx.on?.('subagent/start', (info) => {+ const childId = info?.id+ if (typeof childId !== 'string' || childId === '' || stoppedSubagents.has(childId)) return+ const parentId = subagentParent.get(childId)+ ?? ctx.get?.('agents')?.get?.(childId)?.session?.header?.parentSession+ ?? [...live.entries()].find(([, entry]) => [...(entry.calls?.values() ?? [])].some(call => call.name === 'subagent'))?.[0]+ if (parentId !== undefined) noteSubagentStart(parentId, childId, undefined)+ })+ ctx.on?.('subagent/end', (info) => {+ noteSubagentEnd(info?.id)+ if (rt.groupOwners.has(info?.id)) void rt.goalSettled?.(rt.roomOf(rt.groupOwners.get(info.id).roomId)).catch(error => rt.warn('ds-bot: goal settle failed: %s', error))+ })ctx.on('session/event', (session, event) => {const id = session?.id@@@ -615,10 -749,10 +815,10 @@@const content = Array.isArray(event.data.content) ? event.data.content : []const images = content.filter(block => block?.type === 'image' && !block.offloaded).map(block => block.attachment)const files = content.filter(block => block?.type === 'file' && block.attachment !== undefined).map(block => block.attachment)- queueRoomMessage(id, { text: textOf(event.data.content), ...(images.length > 0 ? { images } : {}), ...(files.length > 0 ? { files } : {}) })+ queueRoomMessage(rt.roomOf(id).id, { text: textOf(event.data.content), ...(images.length > 0 ? { images } : {}), ...(files.length > 0 ? { files } : {}) })}const own = rt.chatOwners.get(id)- if (own !== undefined) rt.dropKickoff(own)+ if (own !== undefined) rt.userWrote(own)// Any user message answers or supersedes the open question card and view card.let dropped = falseif (state.questions[id] !== undefined) {@@@ -706,16 -853,15 +919,23 @@@const reason = event.data?.reasonconst failure = reason?.kind === 'error' && !switched ? turnFailure(reason.error) : undefinedif (failure !== undefined) noteTurnFailure(id, failure)+ // A route that is not a model endpoint refuses every generation; the failed+ // Session's own request names it, so it is refused everywhere from now on.+ if (failure?.code === 'HOSTED_ENGINE_ROUTE') {+ const config = session.requestHeader?.()?.config+ const ref = config?.provider && config?.model ? `${config.provider}/${config.model}` : undefined+ if (ref !== undefined) void rt.routeRefused(ref, rt.botOf(rt.selfOf(id))).catch(error => rt.warn('ds-bot: %s still failing: %s', ref, error))+ }const held = rt.groupOwners.has(id) ? rt.takeRoomSteps?.(id) ?? '' : ''if (switched) break+ const owner = rt.chatOwners.get(id)+ if (failure !== undefined) {+ if (blockBot(id, session, failure) && owner !== undefined && info?.role === 'kickoff') rt.holdKickoffAgain(owner)+ } else if (reason?.kind === 'completed') {+ unblockBot(rt.selfOf(id))+ // A turn the user opened, or the Retry that answers the user.+ if (owner !== undefined && (info === undefined || info.role === 'continue')) rt.userAnswered(owner)+ }// A model that writes its tool call as text ends the turn as if it were done,// though nothing ran. It gets one more turn on the same trigger, so a waiting// round or sender gets the real answer; a second time, the text goes on without@@@ -812,5 -998,46 +1072,46 @@@if (entry?.turn !== undefined) entry.cut = { texts: entry.texts.length }}- Object.assign(rt, { live, liveOf, roomWaiters, roomProgress, roomInbox, activityView, workView, roomWorkView, turnsView, steeredView, callDetail, doingOf, stopRoomTurn, releaseBot, unblockBots, resumeBot, markSteerCut })+ // DSH's prompt admission wraps any unexpected failure as 'session/agent-busy' and+ // keeps the real cause in details.reason, which the window never shows and the log+ // never saw (#424). For a Session this team owns, the reason is written to the+ // diagnostics and put into the error the user reads.+ const prompt = ctx.sessionController?.prompt+ if (typeof prompt === 'function') {+ const controller = ctx.sessionController+ const admitted = async function (request, ...rest) {+ try {+ return await prompt.call(this, request, ...rest)+ } catch (error) {+ const id = request?.sessionId+ if (id === undefined || (rt.roomOf(id) === undefined && !rt.isBotSession(id))) throw error+ // The reason can name local paths or carry tokens, so the same cleaning the+ // diagnostics get applies before it reaches the client.+ const reason = typeof error?.details?.reason === 'string' && error.details.reason !== ''+ ? cleanText(error.details.reason, { redact: rt.redactSecrets })+ : undefined+ rt.noteFailure({+ source: 'prompt',+ text: `prompt rejected for ${placeOf(id)}${reason === undefined ? '' : `: ${reason}`}`,+ code: error?.code,+ where: placeOf(id),+ sessionId: id,+ })+ // The gateway passes a RemoteError's code and details on as they are, but+ // wraps a fresh plain Error as 'gateway/internal': the reason is written on+ // the rejection itself, keeping its identity.+ if (reason !== undefined) {+ error.message = `${error?.message ?? 'prompt rejected'} — ${reason}`+ error.details = { ...error.details, reason }+ }+ throw error+ }+ }+ ctx.effect(() => {+ controller.prompt = admitted+ return () => { if (controller.prompt === admitted) controller.prompt = prompt }+ }, 'ds-bot: prompt rejection reasons')+ }+- Object.assign(rt, { live, liveOf, roomWaiters, roomProgress, roomInbox, activityView, workView, roomWorkView, turnsView, steeredView, callDetail, doingOf, stopRoomTurn, releaseBot, markSteerCut, hasSubagents, stopSubagents })++ Object.assign(rt, { live, liveOf, roomWaiters, roomProgress, roomInbox, activityView, workView, roomWorkView, turnsView, steeredView, callDetail, doingOf, stopRoomTurn, releaseBot, unblockBots, resumeBot, markSteerCut, hasSubagents, stopSubagents })}diff --cc ds-bot/test/create-bot.test.jsindex 1a2a1ce6,cdea48ef..1694f62b--- a/ds-bot/test/create-bot.test.js+++ b/ds-bot/test/create-bot.test.js@@@ -12,19 -12,11 +12,22 @@@ test('the form starts on the team defauassert.equal(startModel({ models, defaultModel: 'gone/model' }), 'ollama/ds-flash')assert.equal(startModel({ models, defaultModel: null }), 'ollama/ds-flash')assert.equal(startModel({ models: [], defaultModel: 'cloud/qwen-max' }), '')+ // The team's pick from settings comes first; one that is not served falls through.+ assert.equal(startModel({ models, defaultModel: 'cloud/qwen-max', prefs: { defaultBotModel: 'ollama/ds-flash' } }), 'ollama/ds-flash')+ assert.equal(startModel({ models, defaultModel: 'cloud/qwen-max', prefs: { defaultBotModel: 'gone/model' } }), 'cloud/qwen-max')})+test('the form never starts on a model whose provider has no key, and starts on none when no model is usable', () => {+ const keyless = [{ ...models[0], needsKey: true }, models[1]]+ assert.equal(startModel({ models: keyless, defaultModel: 'ollama/ds-flash' }), 'cloud/qwen-max')+ assert.equal(startModel({ models: keyless, defaultModel: null }), 'cloud/qwen-max')+ const none = models.map(model => ({ ...model, needsKey: true }))+ assert.equal(startModel({ models: none, defaultModel: null }), '')+ assert.equal(startModel({ models: none, defaultModel: 'cloud/qwen-max' }), '')+ // With no model the payload leaves it out, and the host lets the new Bot wait for a pick.+ assert.equal('model' in createPayload({ name: 'A', look: { shape: 'star', color: 'blue' }, model: startModel({ models: none, defaultModel: null }) }), false)+})+test('the payload carries the look, the chosen model, and the brief', () => {const look = { shape: 'star', color: 'blue' }assert.deepEqual(createPayload({ name: 'A', look, model: 'cloud/qwen-max' }), { name: 'A', color: 'blue', avatar: { shape: 'star' }, model: 'cloud/qwen-max' })diff --cc ds-bot/test/diagnostics.test.jsindex 17916668,00d906aa..74f40533--- a/ds-bot/test/diagnostics.test.js+++ b/ds-bot/test/diagnostics.test.js@@@ -263,135 -263,22 +263,151 @@@ test('a failed group turn fails its waiassert.equal(value, null)})+// The failures the repair card is for, as the client reads them from `bot.blocked`.+test('the failures that block a Bot are the ones only the user can fix', () => {+ assert.deepEqual([...BLOCKING_CODES], ['MISSING_CREDENTIAL', 'INVALID_CREDENTIAL', 'AUTH', 'QUOTA', 'ACCOUNT_QUOTA', 'ACCOUNT_SIGN_IN_REQUIRED', 'ACCOUNT_SIGNED_OUT', 'ACCOUNT_TOKEN_INVALID'])+})++test('a failure only the user can fix blocks its Bot with the facts, never the message, until a turn completes', () => {+ const { rt, emit } = turnsHost()+ const fail = (turn, error, session) => {+ emit('b', 'turn/start', { turn }, session)+ emit('b', 'turn/end', { turn, reason: { kind: 'error', error } }, session)+ }+ rt.bots.b.appliedModel = 'deepseek-official/deepseek-v4-flash'+ fail(1, { code: 'AUTH', message: 'bad key sk-12***34', status: 401, requestId: 'r1' })+ const { at, ...facts } = rt.bots.b.blocked+ assert.deepEqual(facts, { code: 'AUTH', status: 401, requestId: 'r1', provider: 'deepseek-official' })+ assert.equal(typeof at, 'number')+ // The route of the request that failed names the provider.+ const account = { id: 'b', requestHeader: () => ({ config: { provider: 'deepseek-account', model: 'deepseek-v4-flash' } }) }+ fail(2, { code: 'ACCOUNT_TOKEN_INVALID', message: '' }, account)+ assert.deepEqual(Object.keys(rt.bots.b.blocked), ['code', 'provider', 'at'])+ assert.equal(rt.bots.b.blocked.provider, 'deepseek-account')+ // A failure a retry can fix, or a stopped turn, leaves the block as it is.+ fail(3, { code: 'SERVER', message: 'busy', status: 503 })+ emit('b', 'turn/start', { turn: 4 })+ emit('b', 'turn/end', { turn: 4, reason: { kind: 'aborted', reason: { kind: 'user' } } })+ assert.equal(rt.bots.b.blocked.code, 'ACCOUNT_TOKEN_INVALID')+ emit('b', 'turn/start', { turn: 5 })+ emit('b', 'turn/end', { turn: 5, reason: { kind: 'completed' } })+ assert.equal(rt.bots.b.blocked, undefined)+})++test('a greeting a key, a sign-in or a balance stopped is held again; one that failed otherwise is not', () => {+ const { rt, emit } = turnsHost()+ const held = []+ rt.chatOwners.set('b', 'b')+ rt.holdKickoffAgain = id => held.push(id)+ rt.userAnswered = () => {}+ const greet = (turn, error) => {+ emit('b', 'turn/start', { turn })+ emit('b', 'user/message', { content: [{ type: 'text', text: '[Bot team setup]\nhi' }], source: { kind: SOURCE_KIND, role: 'kickoff', exchangeId: `k${turn}` } })+ emit('b', 'turn/end', { turn, reason: { kind: 'error', error } })+ }+ greet(1, { code: 'QUOTA', message: 'Insufficient Balance', status: 402 })+ greet(2, { code: 'SERVER', message: 'busy', status: 503 })+ assert.deepEqual(held, ['b'])+})++test('a completed turn the user opened, or a Retry, answers the message a greeting was held for', () => {+ const { rt, emit } = turnsHost()+ const answered = []+ rt.chatOwners.set('b', 'b')+ rt.userAnswered = id => answered.push(id)+ const run = (turn, source) => {+ emit('b', 'turn/start', { turn })+ emit('b', 'user/message', { content: [{ type: 'text', text: 'hi' }], source })+ emit('b', 'turn/end', { turn, reason: { kind: 'completed' } })+ }+ run(1, { kind: 'user' })+ run(2, { kind: SOURCE_KIND, role: 'request', senderSessionId: 'a', exchangeId: 'x1' })+ run(3, { kind: SOURCE_KIND, role: 'continue', exchangeId: 'c1' })+ assert.deepEqual(answered, ['b', 'b'])+})++test('a key lifts the key failures of the providers that read it, a sign-in the account ones, nothing a balance', () => {+ const { rt } = turnsHost()+ const blocked = {+ official: { code: 'AUTH', provider: 'deepseek-official' },+ stepfun: { code: 'MISSING_CREDENTIAL', provider: 'stepfun' },+ unknown: { code: 'INVALID_CREDENTIAL' },+ keyless: { code: 'AUTH', provider: 'ollama' },+ account: { code: 'ACCOUNT_TOKEN_INVALID', provider: 'deepseek-account' },+ lapsed: { code: 'ACCOUNT_SIGNED_OUT', provider: 'deepseek-account' },+ balance: { code: 'QUOTA', provider: 'deepseek-official' },+ accountBalance: { code: 'ACCOUNT_QUOTA', provider: 'deepseek-account' },+ }+ const reset = () => {+ rt.state.bots = Object.fromEntries(Object.entries(blocked).map(([id, facts]) => [id, { id, name: id, blocked: { ...facts, at: 1 } }]))+ }+ const released = []+ rt.releaseKickoff = async (bot) => { released.push(bot.id); return false }+ rt.keyRefs = () => new Map([['deepseek-official', 'DEEPSEEK_API_KEY'], ['stepfun', 'STEPFUN_API_KEY']])+ const still = () => Object.values(rt.state.bots).filter(bot => bot.blocked !== undefined).map(bot => bot.id)++ reset()+ rt.unblockBots({ ref: 'DEEPSEEK_API_KEY' })+ assert.deepEqual(released, ['official', 'unknown', 'keyless'])+ assert.deepEqual(still(), ['stepfun', 'account', 'lapsed', 'balance', 'accountBalance'])++ released.length = 0+ reset()+ rt.unblockBots({ signedIn: true })+ assert.deepEqual(released, ['account', 'lapsed'])++ // With no provider map to read, any key may be the fix.+ released.length = 0+ reset()+ rt.keyRefs = () => { throw new Error('no settings') }+ rt.unblockBots({ ref: 'DEEPSEEK_API_KEY' })+ assert.deepEqual(released, ['official', 'stepfun', 'unknown', 'keyless'])++ // A provider listed with its key again lifts only what its missing key blocked.+ released.length = 0+ reset()+ rt.unblockBots({ keyed: new Set(['stepfun', 'deepseek-official', 'ollama']) })+ assert.deepEqual(released, ['stepfun'])++ released.length = 0+ reset()+ rt.unblockBots()+ assert.deepEqual(released, [])+ assert.equal(still().length, Object.keys(blocked).length)+})++test('Retry adds no turn while a greeting is on its way or a turn runs in the Bot\'s chat', async () => {+ const { rt, emit, delivered } = turnsHost()+ rt.chatOf = id => id+ rt.releaseKickoff = async () => false+ let out = true+ rt.greetingOut = () => out+ await rt.resumeBot(rt.bots.b)+ out = false+ emit('b', 'turn/start', { turn: 1 })+ await rt.resumeBot(rt.bots.b)+ assert.equal(delivered.length, 0)+ emit('b', 'turn/end', { turn: 1, reason: { kind: 'completed' } })+ await rt.resumeBot(rt.bots.b)+ assert.deepEqual(delivered.map(args => args.role), ['continue'])+})++ // #637: the route a refused turn ran on is read from the Session's request header,+ // not from the Bot's record — a group Session may carry another Bot's route.+ test('a turn refused for not being a model endpoint refuses that route', () => {+ const { rt, emit } = turnsHost()+ const calls = []+ rt.routeRefused = async (ref, bot) => { calls.push([ref, bot?.id]) }+ const session = { id: 'b', requestHeader: () => ({ config: { provider: 'external', model: 'default' } }) }+ emit('b', 'turn/start', { turn: 1 }, session)+ emit('b', 'turn/end', { turn: 1, reason: { kind: 'error', error: { code: 'HOSTED_ENGINE_ROUTE', message: 'provider "external" is a hosted loop engine route, not a model endpoint' } } }, session)+ assert.deepEqual(calls, [['external/default', 'b']])+ // An ordinary failure takes no such path.+ emit('b', 'turn/start', { turn: 2 }, session)+ emit('b', 'turn/end', { turn: 2, reason: failed }, session)+ assert.equal(calls.length, 1)+ })+test('issueUrl fills the issue form, keeps the versions when the errors are too long, and falls back to the clipboard', async () => {const { issueUrl } = await import('../src/client/diagnostics.js')const base = 'https://github.com/Fei2411/DS-Bot/issues/new'diff --cc ds-bot/test/install.test.jsindex 74ad3652,2c675347..4291f5d8--- a/ds-bot/test/install.test.js+++ b/ds-bot/test/install.test.js@@@ -38,13 -39,15 +39,16 @@@ test('apply registers listeners and eff'effect ds-bot: state lock','on llm/adapters-updated','on credentials/reference-updated',+ 'on credentials/record-updated','on settings/document-updated',+ 'on subagent/start',+ 'on subagent/end','on session/event',+ 'on subagent/start',+ 'on subagent/end',+ 'on tools/result','on session/event','on tools/execute',- 'effect ds-bot: agent tool restrict retry',- 'on agent/created','effect ds-bot: identity section','prompt bot-identity 640','on agent/pre-step (prepend)',diff --cc ds-bot/test/models-step.test.jsindex 5b23f1ec,00000000..10cff4c8mode 100644,000000..100644--- a/ds-bot/test/models-step.test.js+++ b/ds-bot/test/models-step.test.js@@@ -1,122 -1,0 +1,119 @@@+import { test } from 'node:test'+import assert from 'node:assert/strict'+import { fileURLToPath } from 'node:url'+import { runInNewContext } from 'node:vm'+import { build } from 'esbuild'++// DS Bot's settings.onboarding step that opens DSH's settings on Models. Rendered with a+// stand-in React whose effects run at once, as the mounted step's would.+const { outputFiles } = await build({+ stdin: {+ contents: "export { MODELS_STEP, MODELS_STEP_ORDER, OpenModelsStep } from './src/client/sidebar.js'",+ resolveDir: fileURLToPath(new URL('..', import.meta.url)),+ },+ bundle: true, format: 'cjs', platform: 'browser', write: false, logLevel: 'silent',+ external: ['react', 'react-dom', '@deepseek-ai/dsh-client-ui-primitives'],+})+const frames = []+const react = {+ createElement: (type, props, ...children) => ({ type, props: { ...props, children } }), Fragment: Symbol('Fragment'),+ useEffect: (effect) => { effect() }, useLayoutEffect() {}, useState: initial => [initial, () => {}],+ useMemo: make => make(), useRef: current => ({ current }), useId: () => 'id',+ // The bundled Deep View widgets make a React context when their module loads.+ createContext: value => ({ Provider: 'Provider', value }), useContext: context => context.value,+}+const module = { exports: {} }+runInNewContext(outputFiles[0].text, {+ module, exports: module.exports,+ window: { innerWidth: 1280 },+ requestAnimationFrame: (fn) => { frames.push(fn); return frames.length },+ require: name => (name === 'react' ? react : {}),+})+const { MODELS_STEP, MODELS_STEP_ORDER, OpenModelsStep } = module.exports++function step(props) {+ const calls = []+ const tree = OpenModelsStep({+ stepId: MODELS_STEP,+ complete: () => calls.push('complete'),+ openSection: id => calls.push(['openSection', id]),+ ...props,+ })+ return { tree, calls }+}++test('in the first-run pass the step draws nothing and steps aside at once', () => {+ const { tree, calls } = step({ explicit: false })+ assert.equal(tree, null)+ assert.deepEqual(calls, ['complete'])+})++test('opened by its id, the step opens DSH settings on Models and completes', () => {+ const { tree, calls } = step({ explicit: true })+ assert.equal(tree, null)+ assert.deepEqual(calls, [['openSection', 'models'], 'complete'])+})++test('a shell without openSection still opens its settings and completes the step', () => {+ frames.length = 0+ const { calls } = step({ explicit: true, openSection: undefined })+ assert.deepEqual(calls, ['complete'])+ // The fallback is the plain settings opener, a frame later.+ assert.equal(frames.length, 1)+})++// The shell's own steps are the welcome notice (-100) and the DeepSeek key step (0).+test('the step comes after the shell\'s own onboarding steps', () => {+ assert.equal(MODELS_STEP, 'ds-bot-models')+ assert.ok(MODELS_STEP_ORDER > 0)+})++// The DS Bot settings dialog, drawn once with effects left out: its Advanced settings+// entry is the way to DSH's own Models page.+const dialog = await build({+ stdin: {+ contents: "export { SettingsDialog } from './src/client/settings.js'",+ resolveDir: fileURLToPath(new URL('..', import.meta.url)),+ },+ bundle: true, format: 'cjs', platform: 'browser', write: false, logLevel: 'silent',+ external: ['react', 'react-dom', '@deepseek-ai/dsh-client-ui-primitives'],+})+const still = {+ ...react, useEffect() {}, useCallback: fn => fn, useRef: current => ({ current }),+ useState: initial => [typeof initial === 'function' ? initial() : initial, () => {}],+}+const settings = { exports: {} }+runInNewContext(dialog.outputFiles[0].text, {+ module: settings, exports: settings.exports,+ window: { innerWidth: 1280, matchMedia: () => ({ matches: false }) },+ requestAnimationFrame: () => 0, cancelAnimationFrame() {},+ require: name => (name === 'react' ? still : name === 'react-dom' ? { createPortal: node => node } : {}),+})+const { SettingsDialog } = settings.exports+const walk = (node, match, out = []) => {+ if (Array.isArray(node)) { node.forEach(child => walk(child, match, out)); return out }+ if (!node || typeof node !== 'object') return out+ if (match(node)) out.push(node)+ walk(node.props?.children, match, out)+ return out+}+const textOf = node => (typeof node === 'string' ? node : Array.isArray(node) ? node.map(textOf).join('') : node?.props ? textOf(node.props.children) : '')++function advanced(actions) {+ const calls = []+ const all = {+ closeSettings: () => calls.push('close'), openSettings() {},+ openHarnessSettings: () => calls.push('settings'),+ ...actions(calls),+ }+ const roster = { byId: {}, roomsById: {}, bots: [], rooms: [], models: [], prefs: {} }+ const tree = SettingsDialog({ page: 'general', id: null, roster, actions: all, useUpdate: pick => pick({}) })- const [button] = walk(tree, node => node.type === 'button' && textOf(node) === 'Advanced settings (DeepSeek Harness)')++ const [button] = walk(tree, node => node.type === 'button' && textOf(node) === 'Harness settings')+ return { button, calls }+}+- test('Advanced settings opens DSH settings on Models, or on their first page without that opener', () => {- const models = advanced(calls => ({ openHarnessModels: () => calls.push('models') }))- models.button.props.onClick()- assert.deepEqual(models.calls, ['close', 'models'])++test('Harness settings opens DSH settings', () => {+ const plain = advanced(() => ({}))+ plain.button.props.onClick()+ assert.deepEqual(plain.calls, ['close', 'settings'])+})diff --cc ds-bot/test/roster.test.jsindex ddf0f2f9,d15014c1..db57c15f--- a/ds-bot/test/roster.test.js+++ b/ds-bot/test/roster.test.js@@@ -6,33 -6,15 +6,34 @@@ import { hostname, tmpdir } from 'node:import { join } from 'node:path'import { test } from 'node:test'import { format } from 'node:util'- import { apply } from '../index.js'+ import { createRuntime } from '../index.js'import { fakeContext } from './fake-ctx.js'+// DSH's settings and credentials for a DeepSeek route that takes an API key. A key set+// or removed is announced the way DSH announces it. `records` are the stored records+// (an account sign-in's), announced by the test.+function keyed(ctx, stored, records) {+ return {+ settings: { describe: () => [{ ns: 'llm-deepseek', revision: 0, value: { apiKeyEnv: 'DEEPSEEK_API_KEY' }, user: {}, base: {} }] },+ credentials: {+ describe: async ref => ({ configured: stored.has(ref), writable: true }),+ set: async (ref) => { stored.add(ref); ctx.emit('credentials/reference-updated', ref) },+ unset: async (ref) => { stored.delete(ref); ctx.emit('credentials/reference-updated', ref) },+ describeRecord: async key => ({ configured: records.has(key), writable: true }),+ },+ }+}+// Enough of the dsh services for the roster to make Sessions; kickoff messages are dropped.+// With `keys`, the models' route takes an API key and these are the ones set.+ let rt-function start(team, { models = [], reasoning = {}, archiveError, selection } = {}) {+function start(team, { models = [], reasoning = {}, archiveError, keys, selection } = {}) {const home = mkdtempSync(join(tmpdir(), 'ds-bot-roster-'))if (team !== undefined) writeFileSync(join(home, 'state.json'), JSON.stringify(team))- const ctx = fakeContext()+ const services = {}+ const ctx = fakeContext({ services })+ const records = new Set()+ if (keys !== undefined) Object.assign(services, keyed(ctx, new Set(keys), records))if (selection !== undefined) {const baseGet = ctx.getctx.get = name => name === 'agentDefaultModel' ? { currentSelection: () => selection } : baseGet(name)@@@ -470,293 -512,6 +532,293 @@@ test('a hidden Bot made Main Bot showsassert.equal(toChief(), greeted)})+// A turn in a Bot Session as DSH reports it, to every listener.+const emitIn = (ctx, sessionId, event) => { for (const listener of ctx.listeners.get('session/event')) listener({ id: sessionId }, event) }+function runTurn(ctx, sessionId, turn, message, reason) {+ emitIn(ctx, sessionId, { type: 'turn/start', data: { turn } })+ emitIn(ctx, sessionId, { type: 'user/message', data: message })+ emitIn(ctx, sessionId, { type: 'turn/end', data: { turn, reason } })+}+const typed = text => ({ source: { kind: 'user' }, content: [{ type: 'text', text }] })+const failed = (code, extra = {}) => ({ kind: 'error', error: { code, message: `${code}: sk-12***34 was refused`, ...extra } })+const botIn = async (call, id) => (await call('state', {})).value.bots.find(bot => bot.id === id)++test('a model whose provider has no key is never given to a new Bot', async (t) => {+ const { call, stop, sent, ctx } = start(undefined, { models: ['deepseek-v4-flash'], keys: [] })+ t.after(stop)+ const team = (await call('state', {})).value+ assert.equal(team.models[0].needsKey, true)+ assert.equal(team.defaultModel, null)+ const writer = (await call('create-bot', { name: 'Writer' })).value+ assert.equal(writer.model, undefined)+ // A Main Bot on such a model passes it on to no Bot it creates.+ await call('update-bot', { id: team.mainBotId, model: 'deepseek/deepseek-v4-flash' })- await ctx.registeredTools.get('create_bot').execute({ name: 'Editor', role: 'Editor', instructions: 'Edit.' }, { agent: { id: team.mainBotId } })++ await rt.teamTools.find(tool => tool.name === 'create_bot').execute({ name: 'Editor', role: 'Editor', instructions: 'Edit.' }, { agent: { id: team.mainBotId } })+ await settle()+ const editor = (await call('state', {})).value.bots.find(bot => bot.name === 'Editor')+ assert.equal(editor.model, undefined)+ assert.deepEqual(sent.map(entry => entry.sessionId), [team.mainBotId])+ assert.equal((await botIn(call, writer.id)).waiting, true)++ assert.equal((await call('provider-key', { provider: 'deepseek', value: 'sk-test-ok' })).ok, true)+ assert.equal((await call('state', {})).value.defaultModel, 'deepseek/deepseek-v4-flash')+ assert.equal((await call('create-bot', { name: 'Critic' })).value.model, 'deepseek/deepseek-v4-flash')+})++test('a message the user writes before the first Main Bot has a model is answered once it has one', async (t) => {+ const { call, stop, sent, ctx } = start(undefined, { models: ['deepseek-v4-flash'], keys: [] })+ t.after(stop)+ const chief = (await call('state', { locale: 'zh-CN' })).value.mainBotId+ // The Session's own route has no key either, so that turn fails.+ runTurn(ctx, chief, 1, typed('hello?'), failed('MISSING_CREDENTIAL'))+ await settle()+ let main = await botIn(call, chief)+ assert.equal(main.waiting, true)+ assert.equal(main.blocked.code, 'MISSING_CREDENTIAL')++ // The key lifts the block; the greeting still waits for a model.+ await call('provider-key', { provider: 'deepseek', value: 'sk-test-ok' })+ await settle()+ main = await botIn(call, chief)+ assert.equal(main.blocked, undefined)+ assert.equal(main.waiting, true)+ assert.equal(sent.length, 0)++ await call('update-bot', { id: chief, model: 'deepseek/deepseek-v4-flash' })+ await until(() => sent.length > 0)+ assert.equal(sent.length, 1)+ assert.equal(sent[0].message.source.role, 'kickoff')+ assert.equal(sent[0].message.content[0].text, [+ '[Bot team setup]',+ 'You were just set up as the user\'s Main Bot. The user wrote to you before your model could answer; their message above has no answer yet. Answer it now, and say in one short sentence that you run their Bot team. Write in Chinese (简体中文).',+ 'Where your instructions say otherwise, follow them.',+ ].join('\n'))+})++test('a held greeting goes once a turn answered the user, and a Bot that can answer drops its own', async (t) => {+ const { call, stop, sent, ctx } = start(undefined, { models: ['deepseek-v4-flash'], keys: [] })+ t.after(stop)+ const chief = (await call('state', {})).value.mainBotId+ const writer = (await call('create-bot', { name: 'Writer' })).value+ // DSH's own default route answered the first Main Bot.+ runTurn(ctx, chief, 1, typed('hello?'), { kind: 'completed' })+ emitIn(ctx, writer.id, { type: 'user/message', data: typed('hi') })+ await settle()+ assert.equal((await botIn(call, chief)).waiting, undefined)+ assert.equal((await botIn(call, writer.id)).waiting, undefined)+ await call('update-bot', { id: chief, model: 'deepseek/deepseek-v4-flash' })+ await call('update-bot', { id: writer.id, model: 'deepseek/deepseek-v4-flash' })+ await settle()+ assert.equal(sent.length, 0)+})++test('a greeting that fails on a key is held again and goes out once the key is set', async (t) => {+ const { call, stop, sent, ctx } = start(undefined, { models: ['deepseek-v4-flash'], keys: [] })+ t.after(stop)+ const chief = (await call('state', {})).value.mainBotId+ await call('update-bot', { id: chief, model: 'deepseek/deepseek-v4-flash' })+ await until(() => sent.length === 1)+ runTurn(ctx, chief, 1, sent[0].message, failed('MISSING_CREDENTIAL'))+ await settle()+ const main = await botIn(call, chief)+ assert.equal(main.waiting, true)+ assert.deepEqual(Object.keys(main.blocked).sort(), ['at', 'code', 'provider'])+ assert.equal(main.blocked.provider, 'deepseek')+ // Setting the same model again (or only a thinking level) fixes nothing, so the+ // greeting stays held.+ const same = await call('update-bot', { id: chief, model: 'deepseek/deepseek-v4-flash' })+ await settle()+ assert.equal(same.ok, true)+ assert.equal(sent.length, 1)+ assert.equal((await botIn(call, chief)).waiting, true)++ await call('provider-key', { provider: 'deepseek', value: 'sk-test-ok' })+ await until(() => sent.length === 2)+ assert.equal(sent[1].message.source.role, 'kickoff')+ assert.equal(sent[1].message.content[0].text, sent[0].message.content[0].text)+ const after = await botIn(call, chief)+ assert.equal(after.blocked, undefined)+ assert.equal(after.waiting, undefined)+})++test('a Bot is blocked by the facts of a failure only the user can fix, until it is fixed', async (t) => {+ const { call, stop, ctx } = start(undefined, { models: ['deepseek-v4-flash', 'deepseek-v4-pro'] })+ t.after(stop)+ const chief = (await call('state', {})).value.mainBotId+ await call('update-bot', { id: chief, model: 'deepseek/deepseek-v4-flash' })+ runTurn(ctx, chief, 1, typed('hi'), failed('QUOTA', { status: 402, requestId: 'req-1' }))+ await settle()+ const { blocked } = await botIn(call, chief)+ assert.deepEqual({ ...blocked, at: typeof blocked.at }, { code: 'QUOTA', status: 402, requestId: 'req-1', provider: 'deepseek', at: 'number' })+ // A failure a retry can fix leaves it as it is.+ runTurn(ctx, chief, 2, typed('again'), failed('SERVER', { status: 503 }))+ await settle()+ assert.equal((await botIn(call, chief)).blocked.code, 'QUOTA')++ runTurn(ctx, chief, 3, typed('again'), { kind: 'completed' })+ await settle()+ assert.equal((await botIn(call, chief)).blocked, undefined)++ runTurn(ctx, chief, 4, typed('more'), failed('AUTH', { status: 401 }))+ await settle()+ assert.equal((await botIn(call, chief)).blocked.code, 'AUTH')+ // A provider that registers or changes is no fix; a key is.+ ctx.emit('llm/adapters-updated')+ await settle()+ assert.equal((await botIn(call, chief)).blocked.code, 'AUTH')+ ctx.emit('credentials/reference-updated', 'DEEPSEEK_API_KEY')+ await settle()+ assert.equal((await botIn(call, chief)).blocked, undefined)++ runTurn(ctx, chief, 5, typed('more'), failed('ACCOUNT_SIGNED_OUT'))+ await settle()+ assert.equal((await botIn(call, chief)).blocked.code, 'ACCOUNT_SIGNED_OUT')+ await call('update-bot', { id: chief, model: 'deepseek/deepseek-v4-pro' })+ assert.equal((await botIn(call, chief)).blocked, undefined)+})++test('Retry has the Bot answer the user\'s last message without sending it again, or sends a failed greeting again', async (t) => {+ const { call, stop, sent, ctx } = start(undefined, { models: ['deepseek-v4-flash'] })+ t.after(stop)+ const chief = (await call('state', {})).value.mainBotId+ await call('update-bot', { id: chief, model: 'deepseek/deepseek-v4-flash' })+ await until(() => sent.length === 1)+ runTurn(ctx, chief, 1, sent[0].message, failed('QUOTA', { status: 402 }))+ await settle()+ assert.equal((await call('resume', { botId: 'nobody' })).error.code, 'bot/not-found')+ assert.equal((await call('resume', { botId: chief })).ok, true)+ await until(() => sent.length === 2)+ assert.equal(sent[1].message.source.role, 'kickoff')+ assert.equal(sent[1].message.content[0].text, sent[0].message.content[0].text)++ runTurn(ctx, chief, 2, sent[1].message, { kind: 'completed' })+ runTurn(ctx, chief, 3, typed('Plan my week'), failed('QUOTA', { status: 402 }))+ await settle()+ assert.equal((await call('resume', { botId: chief })).ok, true)+ assert.equal(sent.length, 3)+ assert.equal(sent[2].sessionId, chief)+ assert.equal(sent[2].message.source.role, 'continue')+ assert.equal(sent[2].message.content[0].text, '[Retry after a failed turn]\nYour last turn failed (QUOTA) and the user has fixed it. Answer the user\'s last unanswered message.')+ assert.equal((await botIn(call, chief)).waiting, undefined)+})++// The record a DeepSeek account sign-in writes.+const ACCOUNT_RECORD = 'deepseek-account-platform/default'++test('a sign-in lifts what a lapsed sign-in blocked and sends the held greeting; a sign-out, a key or a provider does not', async (t) => {+ const { call, stop, sent, ctx, records } = start(undefined, { models: ['deepseek-v4-flash'], keys: ['DEEPSEEK_API_KEY'] })+ t.after(stop)+ const chief = (await call('state', {})).value.mainBotId+ await call('update-bot', { id: chief, model: 'deepseek/deepseek-v4-flash' })+ await until(() => sent.length === 1)+ // The provider refuses the token, and its record goes while the turn still runs.+ records.add(ACCOUNT_RECORD)+ emitIn(ctx, chief, { type: 'turn/start', data: { turn: 1 } })+ emitIn(ctx, chief, { type: 'user/message', data: sent[0].message })+ records.delete(ACCOUNT_RECORD)+ ctx.emit('credentials/record-updated', ACCOUNT_RECORD)+ emitIn(ctx, chief, { type: 'turn/end', data: { turn: 1, reason: failed('ACCOUNT_TOKEN_INVALID') } })+ await settle()+ ctx.emit('credentials/record-updated', ACCOUNT_RECORD)+ ctx.emit('credentials/reference-updated', 'DEEPSEEK_API_KEY')+ ctx.emit('llm/adapters-updated')+ await settle()+ let main = await botIn(call, chief)+ assert.equal(main.blocked.code, 'ACCOUNT_TOKEN_INVALID')+ assert.equal(main.waiting, true)+ assert.equal(sent.length, 1)++ records.add(ACCOUNT_RECORD)+ ctx.emit('credentials/record-updated', ACCOUNT_RECORD)+ await until(() => sent.length === 2)+ assert.equal(sent[1].message.source.role, 'kickoff')+ assert.equal(sent[1].message.content[0].text, sent[0].message.content[0].text)+ main = await botIn(call, chief)+ assert.equal(main.blocked, undefined)+ assert.equal(main.waiting, undefined)+})++test('a held greeting goes out again only on a change that can fix its block: never a balance, a key another provider reads or a key removed', async (t) => {+ const { call, stop, sent, ctx, records } = start(undefined, { models: ['deepseek-v4-flash'], keys: ['DEEPSEEK_API_KEY', 'OTHER_API_KEY'] })+ t.after(stop)+ const chief = (await call('state', {})).value.mainBotId+ await call('update-bot', { id: chief, model: 'deepseek/deepseek-v4-flash' })+ await until(() => sent.length === 1)+ runTurn(ctx, chief, 1, sent[0].message, failed('QUOTA', { status: 402 }))+ await settle()+ // A key, a sign-in, a provider registering: none of it tops up a balance.+ records.add(ACCOUNT_RECORD)+ for (const ref of ['OTHER_API_KEY', 'DEEPSEEK_API_KEY']) ctx.emit('credentials/reference-updated', ref)+ ctx.emit('credentials/record-updated', ACCOUNT_RECORD)+ ctx.emit('llm/adapters-updated')+ await settle()+ assert.equal(sent.length, 1)+ assert.equal((await botIn(call, chief)).blocked.code, 'QUOTA')++ // Retry sends it again, and this time the key is refused.+ await call('resume', { botId: chief })+ await until(() => sent.length === 2)+ runTurn(ctx, chief, 2, sent[1].message, failed('AUTH', { status: 401 }))+ await settle()+ ctx.emit('credentials/reference-updated', 'OTHER_API_KEY')+ await ctx.get('credentials').unset('DEEPSEEK_API_KEY')+ await settle()+ const main = await botIn(call, chief)+ assert.equal(main.blocked.code, 'AUTH')+ assert.equal(main.waiting, true)+ assert.equal(sent.length, 2)++ await call('provider-key', { provider: 'deepseek', value: 'sk-test-ok' })+ await until(() => sent.length === 3)+ assert.equal(sent[2].message.source.role, 'kickoff')+ assert.equal((await botIn(call, chief)).blocked, undefined)+})++test('the first Main Bot keeps its greeting when the user writes while a key blocks it, and answers once the key is fixed', async (t) => {+ // The key is set but wrong, so its model counts as usable until a turn fails on it.+ const { call, stop, sent, ctx } = start(undefined, { models: ['deepseek-v4-flash'], keys: ['DEEPSEEK_API_KEY'] })+ t.after(stop)+ const chief = (await call('state', {})).value.mainBotId+ await call('update-bot', { id: chief, model: 'deepseek/deepseek-v4-flash' })+ await until(() => sent.length === 1)+ runTurn(ctx, chief, 1, sent[0].message, failed('AUTH', { status: 401 }))+ runTurn(ctx, chief, 2, typed('hello?'), failed('AUTH', { status: 401 }))+ await settle()+ assert.equal((await botIn(call, chief)).waiting, true)++ await call('provider-key', { provider: 'deepseek', value: 'sk-test-ok' })+ await until(() => sent.length === 2)+ assert.equal(sent[1].message.source.role, 'kickoff')+ assert.match(sent[1].message.content[0].text, /^\[Bot team setup\]\nYou were just set up as the user's Main Bot\. The user wrote to you before your model could answer; their message above has no answer yet\./)+})++test('Retry right after a fix adds no turn while the greeting it released waits for its model, is queued or runs', async (t) => {+ const { call, stop, sent, ctx } = start(undefined, { models: ['deepseek-v4-flash'], keys: [] })+ t.after(stop)+ const chief = (await call('state', {})).value.mainBotId+ await call('update-bot', { id: chief, model: 'deepseek/deepseek-v4-flash' })+ await until(() => sent.length === 1)+ runTurn(ctx, chief, 1, sent[0].message, failed('MISSING_CREDENTIAL'))+ await settle()+ // The route is slow to list, so the greeting the key releases waits for its model.+ const listModels = ctx.llm.listModels+ let open+ const listed = new Promise((resolve) => { open = resolve })+ ctx.llm.listModels = async (id) => { await listed; return listModels(id) }+ await ctx.get('credentials').set('DEEPSEEK_API_KEY', 'sk-test-ok')+ await settle()+ assert.equal((await call('resume', { botId: chief })).ok, true)+ open()+ await until(() => sent.length === 2)+ assert.equal((await call('resume', { botId: chief })).ok, true)+ emitIn(ctx, chief, { type: 'turn/start', data: { turn: 2 } })+ emitIn(ctx, chief, { type: 'user/message', data: sent[1].message })+ assert.equal((await call('resume', { botId: chief })).ok, true)+ emitIn(ctx, chief, { type: 'turn/end', data: { turn: 2, reason: { kind: 'completed' } } })+ await settle()+ assert.deepEqual(sent.map(entry => entry.message.source.role), ['kickoff', 'kickoff'])+})+const takeover = (home, team) => {writeFileSync(join(home, 'state.lock'), JSON.stringify({ pid: process.ppid, host: hostname(), token: 'new-owner' }))if (team !== undefined) writeFileSync(join(home, 'state.json'), JSON.stringify(team))diff --cc ds-bot/test/tool-cells.test.jsindex 21b60f4b,5ac12245..eeb2f468--- a/ds-bot/test/tool-cells.test.js+++ b/ds-bot/test/tool-cells.test.js@@@ -854,15 -994,35 +994,47 @@@ test('a view works its formulas out, drassert.equal(frame.props.title, 'A greeting')})+// The repair card's Retry reaches the Bot as a plugin trigger; the chat shows that it went+// on, never the note to the Bot or the user's message again.+test('a Retry after a failed turn shows as one event line', () => {+ const out = expand(TriggerCell({+ node: { key: 'trigger', kind: 'turn-trigger', location: { turn: { turn: 4 } }, data: { seq: 9, time: 1, content: text$('[Retry after a failed turn]\nYour last turn failed (AUTH) and the user has fixed it.'), source: { kind: 'bot', role: 'continue', exchangeId: 'c1' } } },+ sessionId: chief.id, actions: {},+ useRoster: select => select(team()), useSessions: select => select({ byId: {} }),+ useTurnClock: select => select({}), useUi: select => select({ visits: {}, reactions: {} }),+ }))+ assert.equal(text(out), 'Went on after the failed turn')++})+++ // #718: a folded message's cut code block is drawn by DS Bot, so no copy control+ // exists that holds only the part shown; DS Bot's own is bound to the whole+ // block, and a short block keeps the host's normal rendering and copy.+ test('a folded code block leaves no copy of only its shown part', async () => {+ const inner = Array.from({ length: 40 }, (_, index) => `line ${index + 1}`).join('\n')+ const bubble = (texts) => expand(Bubbles({+ texts, roster: team(), selfId: chief.id, sessionId: chief.id, actions: {},+ useUi: select => select({ reactions: {} }),+ }))+ const copyOf = node => findAll(node, item => item.type === 'button' && typeof item.props?.className === 'string' && item.props.className.includes('bt-fold-copy'))++ markdownTexts.length = 0+ copiedTexts.length = 0+ const out = bubble([`Here:\n\`\`\`js\n${inner}\n\`\`\``])+ // The markdown the host renders holds no fence, so it can draw no copy of the part.+ assert.ok(markdownTexts.length > 0 && markdownTexts.every(given => !given.includes('```')))+ // DS Bot draws the part the preview keeps, and its copy holds the whole block.+ assert.equal(text(find(out, item => item.type === 'pre')), 'line 1\nline 2\nline 3\nline 4\nline 5\nline 6\nline 7\nline 8')+ const [copy] = copyOf(out)+ assert.equal(copyOf(out).length, 1)+ copy.props.onClick()+ await Promise.resolve()+ assert.deepEqual(copiedTexts, [inner])++ // A short block goes to the host whole, with the host's own copy and none of ours.+ markdownTexts.length = 0+ copiedTexts.length = 0+ const short = bubble(['```js\none\n```'])+ assert.ok(markdownTexts.some(given => given.includes('```js')))+ assert.equal(copyOf(short).length, 0)effects = []})