# 006 Deployment Use this guide to install, configure and operate dsh-superagent. It covers accounts, startup checks, upgrades and troubleshooting, building on [001 Domain model](001-domain.md) through [005 Panel](005-panel.md). ## What runs - **A dedicated DeepSeek Harness profile**, called `superagent` in this guide. Create it from the Web profile template. It loads the bundle and serves its panel on `127.0.0.1`. Keep it separate from the profile you work in: the plugin changes process-wide `PATH` and git settings, and its process needs independent restarts and upgrades. - **An agent GitHub account.** The agent comments, pushes branches and opens pull requests as this account, through a GitHub CLI signed in only as that account. - **Optional:** a Feishu bot for chat requests. Plugin configuration holds the state directory and machine limits. Use the panel for everything else: Sources for the repository and accounts, Policy for allowed lists, and Execution for worker directories and commands. ### Permissions and isolation The bundle defines `dsh-superagent-worker` for Executors and `dsh-superagent-router` for the main Session. They appear in the DeepSeek Harness preset list but are intended only for dsh-superagent. Do not select them for personal Sessions or disable their configuration rows. The application needs them to create and resume its Sessions. Opening a blank managed Session in the Web UI can select the profile's default preset. dsh-superagent restores its role-specific preset before the first turn. Both presets run with `danger-full-access` as the operator's OS user and read messages from subscribed Threads. Account wrappers choose the agent's credentials by default; they do not isolate the process. A worker can execute programs by path and read the operator's home directory. For isolation, use a dedicated OS account containing only the agent's credentials. ## Prerequisites - Node.js 22.19+ or 24+, pnpm, git 2.32+, Python 3.8+ and tmux - GitHub CLI (`gh`) 2.48 or later. Source CLI fields must point to `gh` or `lark-cli` wrappers; the host relies on their subcommands and output formats. - A repository on github.com; GitHub Enterprise Server is not supported. To create a checkout per Ticket, keep a local clone from which the prepare command can add worktrees. Install `git-lfs` if that repository uses Git LFS. - A model provider configured for DeepSeek Harness. dsh-superagent uses the profile's default model unless the Eval or Execution settings name another. - For Feishu: `lark-cli` (tested with 1.0.90) and a Feishu or Lark app with a bot ## Accounts ### Agent GitHub account 1. Create a GitHub user account for the agent and give it write access to the repository. A GitHub App cannot be the agent, because dsh-superagent reads the account's notifications. 2. Give it a GitHub CLI that uses only its own credentials: ```sh mkdir -p ~/.local/bin cat > ~/.local/bin/gh-agent <<'EOF' #!/bin/sh GH_CONFIG_DIR="$HOME/.config/gh-agent" exec gh "$@" EOF chmod +x ~/.local/bin/gh-agent gh-agent auth login gh-agent api user --jq .login ``` Sign in as the agent account; the last command prints its login. dsh-superagent reads the login the same way. ### Feishu bot (optional) 1. Create a self-built app with the bot capability. Grant it the permissions to receive message events, read and send chat messages, and read chat members, then publish the app version. 2. Give the bot its own `lark-cli` configuration, restricted to the bot identity, and a wrapper: ```sh LARKSUITE_CLI_CONFIG_DIR="$HOME/.lark-cli-dsh-superagent" lark-cli config init --app-id --app-secret-stdin LARKSUITE_CLI_CONFIG_DIR="$HOME/.lark-cli-dsh-superagent" lark-cli config strict-mode bot --global cat > ~/.local/bin/lark-bot <<'EOF' #!/bin/sh export LARKSUITE_CLI_CONFIG_DIR="$HOME/.lark-cli-dsh-superagent" exec lark-cli "$@" EOF chmod +x ~/.local/bin/lark-bot ``` The first command reads the app secret from standard input. Use a separate configuration directory: `lark-cli` allows one profile per app id, and your personal configuration may already contain a user login for that app. The host refuses a CLI that can act as a user. It reads the app id, Feishu/Lark brand and bot `open_id` from the bot configuration. Both configurations share the keychain entry for the app secret. To remove only the bot configuration, delete its directory; do not run `lark-cli config remove`, which would affect the shared secret. ## Install Run this block once, on a machine that has no `superagent` profile yet: ```sh npm install -g @deepseek-ai/dsh@0.2.1-rc.3 git clone dsh-superagent && cd dsh-superagent pnpm install && pnpm build dsh superagent --from-default-profile web --dump-config > /dev/null dsh plugin --profile superagent add "link:$PWD" ``` The pinned version above is public; other versions must satisfy `engines.dsh` in `package.json`. The fourth command creates `~/.dsh/profiles/superagent` from the DeepSeek Harness Web template. The fifth installs this bundle. Set `DSH_HOME` to relocate the default `~/.dsh` directory. Run the profile-creation command only for a new installation. If the profile already exists, that command replaces it and deletes its `cordis.patch.yml`, including machine configuration. Do not use it for upgrades. ## Machine configuration Copy [examples/profile.cordis.patch.yml](../examples/profile.cordis.patch.yml) to `~/.dsh/profiles/superagent/cordis.patch.yml`, replacing that file, and replace every ``. For Feishu, also enable the `dsh-superagent-feishu` entry there. The `webserver` entry sets the panel's port. | Key | Required | Meaning | | --- | --- | --- | | `stateDir` | yes | Absolute path: the database, the lock, the command shims in `worker-bin`, the agent's git configuration and, by default, the Ticket directories in `work`. Back it up before upgrades | | `promptMaxChars`, `admissionContextMaxPages`, `admissionContextTimeoutMs` | no | The largest saved prompt configuration, and how many Thread pages one assessment reads within what time | After the first start, edit machine limits in **Settings → Deployment** or the DeepSeek Harness Plugin Manager. Changes apply without restart. `stateDir` cannot be changed there. Invalid values or unknown configuration keys prevent startup; the log identifies the key. ## Start and stop ```sh scripts/dsh-superagent start scripts/dsh-superagent status ``` `start` runs `dsh --profile superagent` in tmux session `dsh-superagent`, or `dsh-` for another profile. It waits up to one minute for the runtime to become ready or report a setup requirement. On a first run it prints the missing setup information. It refuses duplicate instances, including ones started outside this script. `stop` and `restart` request graceful shutdown and wait up to five minutes for Executors. They never force-kill the process or touch other tmux sessions. `status` prints process ids, health and setup problems. For a different profile or port, use `--profile` and `--url`, or set `DSH_SUPERAGENT_PROFILE` and `DSH_SUPERAGENT_URL`. `status`, `start` and `restart` exit with one of four codes: | Code | Meaning | | --- | --- | | 0 | The service runs normally | | 1 | It does not run, runs twice, does not answer, or its runtime reports an error; a restart may fix it | | 2 | It runs, but a part other than the runtime, such as a Source or a Policy sync (`sync:`), reports an error; a restart does not fix it | | 3 | It runs and waits for setup; a restart does not fix it | A Source that is still starting counts as normal operation. So does a Feishu bot that setup could not check. `status` returns failed parts and their details under `errors`, and setup requirements under `setup`. `start` and `restart` print those problems as lines; they exit 1 if the service never comes up. Only an intentional `stop` pauses automatic recovery. Each profile stores logs and control files under `.artifacts/`: - Startup logs: `dsh-superagent---