diff --git a/content/en-US/recipes/dsh-qoder-cloud-agents-en/assets/cloud-mode-switch.png b/content/en-US/recipes/dsh-qoder-cloud-agents-en/assets/cloud-mode-switch.png new file mode 100644 index 0000000..4c10175 Binary files /dev/null and b/content/en-US/recipes/dsh-qoder-cloud-agents-en/assets/cloud-mode-switch.png differ diff --git a/content/en-US/recipes/dsh-qoder-cloud-agents-en/assets/cloud-reply.png b/content/en-US/recipes/dsh-qoder-cloud-agents-en/assets/cloud-reply.png new file mode 100644 index 0000000..744a49c Binary files /dev/null and b/content/en-US/recipes/dsh-qoder-cloud-agents-en/assets/cloud-reply.png differ diff --git a/content/en-US/recipes/dsh-qoder-cloud-agents-en/assets/environment-picker.png b/content/en-US/recipes/dsh-qoder-cloud-agents-en/assets/environment-picker.png new file mode 100644 index 0000000..5497a3e Binary files /dev/null and b/content/en-US/recipes/dsh-qoder-cloud-agents-en/assets/environment-picker.png differ diff --git a/content/en-US/recipes/dsh-qoder-cloud-agents-en/assets/follow-up.png b/content/en-US/recipes/dsh-qoder-cloud-agents-en/assets/follow-up.png new file mode 100644 index 0000000..ff98c9f Binary files /dev/null and b/content/en-US/recipes/dsh-qoder-cloud-agents-en/assets/follow-up.png differ diff --git a/content/en-US/recipes/dsh-qoder-cloud-agents-en/index.md b/content/en-US/recipes/dsh-qoder-cloud-agents-en/index.md new file mode 100644 index 0000000..cfb3d8c --- /dev/null +++ b/content/en-US/recipes/dsh-qoder-cloud-agents-en/index.md @@ -0,0 +1,145 @@ +--- +schema_version: 1 +slug: dsh-qoder-cloud-agents-en +title: "Delegate Tasks to Qoder Cloud Agents from DeepSeek Harness in Cloud Mode" +summary: "Install a DeepSeek Harness plugin to run every Cloud Mode turn in a Qoder Cloud sandbox, keep follow-ups in the same sandbox, and fetch pushed changes locally. For developers connecting a local Agent client to cloud execution." +type: recipe +category: build-deploy +tags: + - session + - sandbox + - credential + - github +author: + name: Anchen + github: anchenqlw +locale: en-US +cover: ./assets/cloud-mode-switch.png +translation_of: dsh-qoder-cloud-agents +--- + +> Translated from the original Chinese recipe by Anchen. This English version was translated with AI assistance. + +## Goal and use case + +[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh) is a local Agent client built around an “everything is a plugin” architecture. This Recipe uses the open-source plugin `dsh-qoder-cloud-agents` to run dsh sessions directly in the managed sandboxes provided by Qoder Cloud Agents: + +- Turn on Cloud Mode when starting a new session, and every turn in that session is executed by the cloud Agent. Tool calls and responses stream back to the conversation in real time. +- Keep typing to ask follow-up questions; everything stays in the same cloud sandbox, including changes from previous turns. +- When the workspace is a Git repository, the plugin mounts `origin` in the cloud. The cloud Agent pushes changes to a new branch, and you bring them back locally with `git fetch`. + +Use this approach when a task needs to run for a long time and you do not want to occupy your local machine; when you need a clean, reproducible execution environment; or when you want to use Qoder Cloud's managed sandboxes directly from the familiar dsh interface. + +The plugin also provides a subagent tool `subagent_qoder_cloud_agents`: in a regular session, DeepSeek can delegate a subtask to the cloud and receive the result when it finishes. This article focuses on Cloud Mode. + +For each cloud execution turn, dsh sends only your newly entered text (plus the repository and branch details on the first turn) to Qoder Cloud. The cloud Agent reads and writes the repository in the sandbox and pushes the branch, while events stream back to dsh in real time over SSE. + +```mermaid +sequenceDiagram + participant U as dsh session + participant P as Cloud Mode plugin + participant Q as Qoder Cloud Agents + participant G as Git repository + U->>P: Send task + P->>Q: Create Session and mount origin + Q->>G: Clone repository + Q-->>P: Stream tool calls and replies over SSE + P-->>U: Display in the conversation in real time + Q->>G: Push qoder-cloud-agents branch +``` + +## Steps + +### Step 1: Install the plugin and configure tokens + +Prepare Node.js 22+, DeepSeek Harness 0.2.x, and a Qoder personal access token (PAT) created under Settings → Personal Access Tokens on [qoder.com](https://qoder.com). + +Build the installation package from the Demo source and add it to dsh's `web` profile. The path must be absolute: + +```bash +cd demos/dsh-qoder-cloud-agents +npm ci +npm pack +dsh plugin --profile web add "$PWD/dsh-qoder-cloud-agents-0.1.0.tgz" +``` + +Write the token to `~/.dsh/.env`. `QODER_GIT_TOKEN` is used by the cloud to clone private repositories and run `git push`. It can be omitted for public repositories and read-only tasks: + +```bash +echo 'QODER_PAT=pt-' >> ~/.dsh/.env +echo 'QODER_GIT_TOKEN=' >> ~/.dsh/.env +chmod 600 ~/.dsh/.env +``` + +Prepare a repository token according to the platform hosting the repository: + +| Repository host | Value for `QODER_GIT_TOKEN` | Is `gitUsername` also required? | +|---|---|---| +| GitHub | Fine-grained PAT with Contents read/write permission, or classic PAT with the `repo` scope | No | +| GitLab.com, Gitee, and other generic Git hosts | Personal access token for that platform (GitLab requires `read_repository` and `write_repository`) | Yes | + +For generic Git hosts, also set the username in `~/.dsh/profiles/web/cordis.patch.yml`: + +```yaml +- id: qoder-cloud-agents + name: dsh-qoder-cloud-agents + config: + gitUsername: your-git-user +``` + +Finally, restart dsh: stop `dsh web` with `Ctrl+C` in its terminal, then run `dsh web` again. dsh reads plugins and tokens only at startup. + +### Step 2: Enable Cloud Mode for a new session + +In the workspace list on the left, select a local Git repository and run `git push` first: the cloud can only access commits that have been pushed. Click **New session**, then turn on the **Cloud Mode** switch at the far right above the input box. The mode label on the left will change to **Cloud Mode**. + +![New session page: Cloud Mode switch at the far right above the input box](./assets/cloud-mode-switch.png) + +Enter the task as usual and send it. On first use, a dialog asks you to select a Qoder environment. Normally choose the managed cloud environment (for example, Default). The choice is saved to the profile; later, use `/qoder-cloud-agents env` to view and switch environments. + +![First use: Qoder environment picker](./assets/environment-picker.png) + +### Step 3: Run in the cloud and stream results back + +The cloud Agent's responses appear in the conversation. Expand **Completed** → **Completed analysis** to see the cloud session, repository, branch, and every tool call. + +![Cloud response: tool calls and results](./assets/cloud-reply.png) + +Continue typing to ask a follow-up; it runs in the same cloud sandbox: + +![Follow-up: still in the same cloud sandbox](./assets/follow-up.png) + +### Step 4: Bring the branch back locally + +The cloud changes are pushed to a new branch named `qoder-cloud-agents/<8 random characters>`, and the branch name appears in the response: + +```bash +git fetch origin && git checkout qoder-cloud-agents/xxxxxxxx +git log --oneline -3 +``` + +For the complete configuration options, subagent tool and slash command documentation, cleanup steps, and safety notes, see the Demo README. + +[View the Demo source](https://github.com/QoderAI/cloud-agents-cookbook/tree/main/demos/dsh-qoder-cloud-agents) + +## Verification + +Check each item: + +- The bottom-right of the Cloud Mode session's input box shows **Cloud Mode (Qoder Cloud Agents)**. The mode is fixed after the session sends its first message. +- **Completed analysis** in the response shows the cloud session ID, repository URL, result branch, and tool calls such as `› Bash: git push …`. +- The response to the second follow-up confirms that it is still in the same sandbox and that the result was pushed to the same branch. +- After running `git fetch` locally, `git log --oneline -3` shows the cloud commits. +- Run `npm test` in the Demo directory. All 35 unit tests pass; they use a local mock gateway and do not consume credits. + +Common issues: + +| Symptom | Resolution | +|---|---| +| The Cloud Mode switch is not visible | dsh was started before the plugin was installed. Restart dsh. The switch appears only on the **New session** page. | +| Error: `no Qoder PAT` | `QODER_PAT` was not written to `~/.dsh/.env`, or dsh was not restarted afterward. | +| The cloud reports that the repository directory does not exist | A private repository is missing `QODER_GIT_TOKEN`, or the token is invalid or lacks access to the repository. | +| Error: `needs an account name` | A generic Git host has `QODER_GIT_TOKEN` configured but no `gitUsername`. | +| The cloud cannot see recently written code | Run `git push` first. The cloud can only access commits that have been pushed. | + +Every cloud execution consumes Qoder credits. The author's hands-on test used about 5.8 credits for one small read-only task plus one follow-up. When you no longer need the setup, archive the cloud session in the Qoder console, delete result branches you do not need, and revoke tokens you no longer use.