A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Add a persistent Windows source launcher
klarkxyf33b83bad6a6
diff --git a/.gitignore b/.gitignoreindex 35d16bbb..5d1199dc 100644--- a/.gitignore+++ b/.gitignore@@ -18,6 +18,9 @@ node_modules/# Extra patterns for scripts/scan.mjs that must not be named in the repository..scan-extra+# Persistent data for start.ps1 (profiles, credentials, chats and Bot files).+/.ds-bot-local/+# Local Docker deployment data./docker/data//docker/workspace/diff --git a/README.md b/README.mdindex 93af6d42..e9bd0b9e 100644--- a/README.md+++ b/README.md@@ -27,6 +27,10 @@ The desktop app brings its own DSH, so you don't need to install DSH first. DownAt 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.+**Desktop app from source (Windows)**++With Node.js 22.19 or later and npm installed, run `.\start.ps1` in PowerShell from this checkout. It prepares and launches the current source, keeping your Bots, chats and model settings in `.ds-bot-local/` between runs. See [source startup](app/README.md#run-from-source-windows).+**As a plugin in DSH**First install DSH and set up at least one model in it. DS Bot uses the models from DSH.diff --git a/README.zh.md b/README.zh.mdindex 7be981df..712a7455 100644--- a/README.zh.md+++ b/README.zh.md@@ -27,6 +27,10 @@ DeepSeek Bot(简称 DS Bot)是一个基于 [DeepSeek Harness](https://github第一次打开时,App 会问数据和 Bot 的文件放在哪里,并可以从你的 dsh 复制 Bot 团队(只读取你的 dsh,不改它)。在 App 的设置里配好模型就能用。Windows 版和 Linux 的 AppImage 会自动更新;macOS 版和 Linux 的 deb 有新版本时会提示你下载。+**从源码启动桌面应用(Windows)**++安装 Node.js 22.19 或以上版本及 npm 后,在仓库目录用 PowerShell 运行 `.\start.ps1`。脚本自动准备并启动当前源码,Bot、聊天记录和模型配置持久保存在 `.ds-bot-local/`,重启后继续使用。见[源码启动说明](app/README.md#run-from-source-windows)。+**作为 dsh 插件**先装好 dsh,并在 dsh 里配好至少一个模型。ds bot 直接使用 dsh 里的模型。diff --git a/app/README.md b/app/README.mdindex 0bc00879..5254ff07 100644--- a/app/README.md+++ b/app/README.md@@ -23,6 +23,20 @@ npm installs `ds-bot` from `../ds-bot` as a copy of its package files (`install-On macOS, Electron's default `userData` directory for `productName` "DeepSeek Bot" is `~/Library/Application Support/DeepSeek Bot`.+## Run from source (Windows)++From the repository root, run in PowerShell (Node.js 22.19 or later and npm required):++```powershell+.\start.ps1+```++The launcher builds the plugin, installs dependencies when they change, refreshes the app's copy of the plugin when its source changes, and starts the desktop app. The first run downloads dependencies and Electron; later runs reuse them. Configure real model providers in the app's Settings.++Data persists across starts under the gitignored `.ds-bot-local/` in the repository: `data/` holds profiles, model settings, credentials, Bots and chats; `workspace` holds the Bots' files; `shell/` holds window and browser storage. The launcher does not clear these folders or import another team's data. Back up this directory before removing the checkout. Close the app before updating dependencies or launching changed source.++Use `.\start.ps1 -DataRoot <folder>` for a different data root (relative paths are resolved against the repository root). The launcher always uses `data/`, `workspace` and `shell/` inside that root. It does not use the installed app's data or the user's `~/.dsh`. `-PrepareOnly` installs and builds without opening a window. If script execution is blocked, use `pwsh -NoProfile -ExecutionPolicy Bypass -File .\start.ps1`; this applies only to that process.+## First start and importAt its first start the app asks, in system dialogs, for the data location (`~/.ds-bot` by default) and the team workspace (`~/DeepSeek 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.diff --git a/start.ps1 b/start.ps1new file mode 100644index 00000000..ba4485c3--- /dev/null+++ b/start.ps1@@ -0,0 +1,97 @@+#Requires -Version 5.1+[CmdletBinding()]+param(+ [string]$DataRoot = (Join-Path $PSScriptRoot '.ds-bot-local'),+ [switch]$PrepareOnly+)++$ErrorActionPreference = 'Stop'+$repo = [IO.Path]::GetFullPath($PSScriptRoot)+$plugin = Join-Path $repo 'ds-bot'+$appDir = Join-Path $repo 'app'+if (-not [IO.Path]::IsPathRooted($DataRoot)) { $DataRoot = Join-Path $repo $DataRoot }+$DataRoot = [IO.Path]::GetFullPath($DataRoot)+$node = (Get-Command node -ErrorAction Stop).Source+$npm = (Get-Command npm.cmd -ErrorAction Stop).Source++function Invoke-Npm {+ param([string]$Directory, [string[]]$Arguments)+ Push-Location $Directory+ try {+ & $npm @Arguments+ if ($LASTEXITCODE -ne 0) { throw "npm $($Arguments -join ' ') failed (exit $LASTEXITCODE)." }+ } finally { Pop-Location }+}++function Get-SourceHash {+ param([string[]]$Paths)+ [string[]]$normalized = @($Paths | ForEach-Object { [IO.Path]::GetFullPath($_).Replace('/', '\').ToLowerInvariant() })+ [Array]::Sort($normalized, [StringComparer]::Ordinal)+ $lines = foreach ($path in $normalized) {+ "$path $((Get-FileHash -LiteralPath $path -Algorithm SHA256).Hash)"+ }+ $sha = [Security.Cryptography.SHA256]::Create()+ try {+ [BitConverter]::ToString($sha.ComputeHash([Text.Encoding]::UTF8.GetBytes(($lines -join "`n")))).Replace('-', '')+ } finally { $sha.Dispose() }+}++function Install-IfChanged {+ param([string]$Directory, [string]$Hash, [string]$RequiredFile)+ $stamp = Join-Path $Directory 'node_modules/.source-launcher.sha256'+ if ((Test-Path -LiteralPath $RequiredFile) -and (Test-Path -LiteralPath $stamp) -and ([IO.File]::ReadAllText($stamp).Trim() -eq $Hash)) {+ Write-Host "Dependencies ready: $(Split-Path $Directory -Leaf)"+ return+ }+ Write-Host "Installing dependencies: $(Split-Path $Directory -Leaf)"+ Invoke-Npm $Directory @('ci', '--include=dev', '--no-fund', '--no-audit')+ if (-not (Test-Path -LiteralPath $RequiredFile)) { throw "Installation is incomplete: $RequiredFile" }+ [IO.File]::WriteAllText($stamp, $Hash)+}++$envNames = @('DS_BOT_HOME', 'DS_BOT_WORKSPACE', 'DS_BOT_SHELL_DATA', 'ELECTRON_RUN_AS_NODE')+$savedEnv = @{}+foreach ($name in $envNames) { $savedEnv[$name] = [Environment]::GetEnvironmentVariable($name, 'Process') }+try {+ & $node --version+ if ($LASTEXITCODE -ne 0) { throw 'Node.js could not start.' }+ $pluginHash = Get-SourceHash @((Join-Path $plugin 'package.json'), (Join-Path $plugin 'package-lock.json'), (Join-Path $plugin '.npmrc'))+ Install-IfChanged $plugin $pluginHash (Join-Path $plugin 'node_modules/esbuild/package.json')+ Write-Host 'Building the plugin from this checkout...'+ Invoke-Npm $plugin @('run', 'build')++ # The desktop app installs a copy of the plugin. Hash npm's package file list so new+ # or removed source files also refresh that copy, even when its version is unchanged.+ $packJson = Invoke-Npm $plugin @('pack', '--dry-run', '--json', '--ignore-scripts')+ $package = @((($packJson -join "`n") | ConvertFrom-Json))[0]+ if (-not $package.files) { throw 'npm did not return the plugin package file list.' }+ $appFiles = @((Join-Path $appDir 'package.json'), (Join-Path $appDir 'package-lock.json'), (Join-Path $appDir '.npmrc'))+ $appFiles += @($package.files | ForEach-Object { Join-Path $plugin $_.path })+ $appHash = Get-SourceHash $appFiles+ Install-IfChanged $appDir $appHash (Join-Path $appDir 'node_modules/electron/package.json')++ $electron = Join-Path $appDir 'node_modules/electron/dist/electron.exe'+ if (-not (Test-Path -LiteralPath $electron)) {+ Write-Host 'Downloading the Electron runtime...'+ & $node (Join-Path $appDir 'node_modules/electron/install.js')+ if ($LASTEXITCODE -ne 0) { throw 'Electron download failed.' }+ if (-not (Test-Path -LiteralPath $electron)) { throw 'Electron executable is still missing.' }+ }++ $env:DS_BOT_HOME = Join-Path $DataRoot 'data'+ $env:DS_BOT_WORKSPACE = Join-Path $DataRoot 'workspace'+ $env:DS_BOT_SHELL_DATA = Join-Path $DataRoot 'shell'+ Remove-Item Env:ELECTRON_RUN_AS_NODE -ErrorAction SilentlyContinue+ foreach ($path in @($env:DS_BOT_HOME, $env:DS_BOT_WORKSPACE, $env:DS_BOT_SHELL_DATA)) {+ [void][IO.Directory]::CreateDirectory($path)+ }+ Write-Host "Persistent data: $DataRoot"+ if ($PrepareOnly) { Write-Host 'Ready. Run start.ps1 to open DeepSeek Bot.'; return }+ Write-Host 'Starting DeepSeek Bot. Configure model providers in Settings; close the window to stop.'+ Invoke-Npm $appDir @('start')+} finally {+ foreach ($name in $envNames) {+ if ($null -eq $savedEnv[$name]) { Remove-Item "Env:$name" -ErrorAction SilentlyContinue }+ else { [Environment]::SetEnvironmentVariable($name, $savedEnv[$name], 'Process') }+ }+}