A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Keep Docker startup focused on persistent deployment
klarkxy03459c6e88a3
diff --git a/docker/Dockerfile b/docker/Dockerfileindex e969817d..e84c13d6 100644--- a/docker/Dockerfile+++ b/docker/Dockerfile@@ -13,14 +13,12 @@ RUN corepack enable \&& npm config set registry "$NPM_REGISTRY" --global \&& COREPACK_NPM_REGISTRY="$NPM_REGISTRY" pnpm config set registry "$NPM_REGISTRY" --global \&& npm install -g "@deepseek-ai/dsh@${DSH_VERSION}" \- --allow-scripts=@deepseek-ai/dsh-subprocess-local,node-pty,koffi,@google/genai,protobufjs \- && pnpm --version > /pnpm-version+ --allow-scripts=@deepseek-ai/dsh-subprocess-local,node-pty,koffi,@google/genai,protobufjsCOPY ds-bot/ /src/ds-bot/# ds-bot has no build step at install (client.js is committed), so pack it as-is# and let `dsh plugin add` set up the web profile from dsh's own template.-# The tgz is kept for reinstalls into existing volumes at container start.RUN cd /src/ds-bot \&& npm pack --pack-destination /tmp \&& mv /tmp/ds-bot-*.tgz /tmp/ds-bot.tgz \@@ -38,17 +36,9 @@ RUN apt-get update \COPY --from=build /usr/local/ /usr/local/COPY --from=build /opt/dsh-template /opt/dsh-template-COPY --from=build /tmp/ds-bot.tgz /opt/ds-bot/ds-bot.tgz-COPY --from=build /pnpm-version /opt/ds-bot/pnpm-versionCOPY --chmod=0755 docker/entrypoint.sh /usr/local/bin/entrypoint.shCOPY docker/docker.patch.yml /opt/ds-bot/docker.patch.yml-# pnpm as a plain global install (same version the build used) so plugin-# updates work offline for the node user — corepack would re-download it.-# The build stage's npmrc (with NPM_REGISTRY) came over with /usr/local.-RUN rm -f /usr/local/bin/pnpm /usr/local/bin/pnpx \- && npm install -g "pnpm@$(cat /opt/ds-bot/pnpm-version)"-ENV DSH_HOME=/data \DSH_PERMISSION_MODE=danger-full-accessdiff --git a/docker/README.md b/docker/README.mdindex 55a37824..52653794 100644--- a/docker/README.md+++ b/docker/README.md@@ -142,8 +142,12 @@ UI, which writes the same config.profiles, settings and the login cookie key (`.credentials.yaml`).- `/workspace` (`WORKSPACE_DIR`) is the team workspace where the Bots work.-**Backup**: stop the container, then copy `DATA_DIR`. Restore by putting the-folder back and starting again.+A rebuild reuses the persisted data and workspace. Keep their container+destinations `/data` and `/workspace` unchanged when you rebuild or move the+host directories; the team records those destinations, not the host paths.++**Backup**: stop the container, then copy both `DATA_DIR` and `WORKSPACE_DIR`.+Restore by putting both folders back and starting again.On every start, entries in `/data` with a different owner or group are assignedto `PUID`/`PGID`, including existing profiles and restored files. This scans the@@ -159,25 +163,12 @@ docker compose build # or: docker build -f docker/Dockerfile -t ds-bot:local .docker compose up -d```-DSH itself lives in the image and updates on rebuild. The plugin lives in the-profile inside the data volume, so the entrypoint compares the installed ds-bot-version with the image's on every start and reinstalls it into the web profile-when they differ — a new image updates an existing volume automatically.-Rebuilds with the same ds-bot version skip the reinstall; to force a fresh-profile, stop the container and delete `DATA_DIR/profiles/web` (not the whole-data dir). The image is built and tested with dsh `0.2.0-rc.2`, the version+A rebuild changes the image and the DSH it contains. An existing persisted+profile is reused, and the entrypoint does not manage plugin upgrades. The+image is built and tested with dsh `0.2.0-rc.2`, the versionDS Bot is verified with; a `DSH_VERSION` build arg exists, but other releasesare untested and newer ones change how the server binds.-## Importing an existing team--To move a team from a dsh you already run: stop this container, then copy-`bot/`, `sessions/` and `storages/` from the old `DSH_HOME` (`~/.dsh`) into-`DATA_DIR` — but not `profiles/`, which the image seeds itself. The ds-bot-README's "Move to another computer" caveat applies: workspace paths are stored-as absolute paths, so this is safest between two Linux deployments (the-container's workspace is always `/workspace`).-## Limits- No Bot browser / `read_browser` tool: those exist in dsh Desktop only.@@ -192,6 +183,7 @@ After building the image, run `node docker/test.mjs ds-bot:local` from therepository root. The test uses isolated, network-disabled containers andtemporary Docker volumes, with no host directory mounts or model calls. Itchecks entrypoint permissions, first start, UID/GID changes, restored files,-workspace ownership, offline plugin reinstall and web startup. All test-containers and volumes are removed when it finishes. CI builds the image from-the Linux checkout and runs this test as part of the required Test result check.+workspace ownership and web startup. All test containers and volumes are+removed when it finishes.+CI builds the image from the Linux checkout and runs this test as part of the+required Test result check.diff --git a/docker/entrypoint.sh b/docker/entrypoint.shindex acc08f17..aa5cbf99 100644--- a/docker/entrypoint.sh+++ b/docker/entrypoint.sh@@ -25,16 +25,6 @@ if [ -z "$(ls -A /workspace)" ]; thenchown node:node /workspacefi-# Keep an existing volume's ds-bot in step with the image. A failed reinstall-# is logged but never blocks the start — the old plugin keeps working.-installed_ver=$(jq -r .version /data/profiles/web/node_modules/ds-bot/package.json 2>/dev/null || echo missing)-image_ver=$(jq -r .version /opt/dsh-template/profiles/web/node_modules/ds-bot/package.json)-if [ "$installed_ver" != "$image_ver" ]; then- echo "entrypoint: ds-bot $installed_ver -> $image_ver, reinstalling into the web profile"- HOME=/home/node gosu node dsh plugin --profile web add /opt/ds-bot/ds-bot.tgz \- || echo "entrypoint: ds-bot reinstall failed; continuing with $installed_ver" >&2-fi-# This dsh release accepts only 127.0.0.1 for --host, so an overlay binds all# interfaces instead; the container's publish rule is the network boundary.# DSH_LISTEN_PORT only matters with network_mode: host — published portsdiff --git a/docker/test.mjs b/docker/test.mjsindex 09748069..c905c0f7 100644--- a/docker/test.mjs+++ b/docker/test.mjs@@ -17,7 +17,7 @@ function docker(args, { allowFailure = false } = {}) {maxBuffer: 1024 * 1024,})if (!allowFailure && (result.error || result.status !== 0)) {- throw new Error(`docker ${args[0]} failed: ${result.error?.message ?? result.stderr}`)+ throw new Error(`docker ${args[0]} failed (${result.status}): ${result.error?.message ?? result.stderr}\nstdout:\n${result.stdout}\nstderr:\n${result.stderr}`)}return result}@@ -95,15 +95,6 @@ try {checkDataOwner(1234, 1235)console.log('PASS: group-only migration and restored files with mixed ownership')- shell(`- node -e 'const fs = require("node:fs"); const path = "/data/profiles/web/node_modules/ds-bot/package.json"; const pkg = JSON.parse(fs.readFileSync(path)); pkg.version = "0.0.1"; fs.writeFileSync(path, JSON.stringify(pkg))'- `)- startHelp(1234, 1235)- shell(`- test "$(jq -r .version /data/profiles/web/node_modules/ds-bot/package.json)" = "$(jq -r .version /opt/dsh-template/profiles/web/node_modules/ds-bot/package.json)"- `)- console.log('PASS: offline plugin reinstall after migration')-const server = `${name}-web`containers.add(server)docker([