feat(agent): add dsh agent — bridge cc-connect to a running DeepSeek Harness (dsh) web server - #1676
Open
whiteguo233 wants to merge 2 commits into
Open
feat(agent): add dsh agent — bridge cc-connect to a running DeepSeek Harness (dsh) web server#1676whiteguo233 wants to merge 2 commits into
whiteguo233 wants to merge 2 commits into
Conversation
added 2 commits
August 14, 2026 00:55
…h) web server Implements the core.Agent / core.AgentSession interfaces over the dsh typed RPC API (POST /api/session.<method>) and the aggregated WebSocket event stream (GET /api/events.mux): - Sessions are created per-project (work_dir as cwd) and resume automatically; the same session id + cwd is idempotent on the server. - Streaming output: text/reasoning deltas are coalesced into sentence- sized EventText/EventThinking chunks (dsh streams token-by-token) so platform delivery is not word-by-word. - Permission round-trips: approval/requested -> EventPermissionRequest -> POST /api/respond; AskUserQuestion cards map back to option labels. - /stop via session.cancel (AgentSessionCanceller), per-turn timeout_mins watchdog, /model via session.selectModel, /list + cross-project session id validation, cc-connect doctor reachability check. - CC_PROJECT / CC_SESSION_KEY / CC_DATA_DIR are injected into the first prompt of fresh sessions so the in-session cc-connect CLI (cron/timer/ relay) works; ProjectMemoryFile returns <work_dir>/AGENTS.md which dsh natively loads. - Frame-loss protection: the mux stream aggregates every server session, so the socket reader filters to the target session and gives critical frames (turn/end, approval/question requests, stream errors) blocking priority — a flood from other sessions previously dropped turn/end and left the engine stuck after a permission answer. - session.list updatedAt parsed as float64 (dsh reports fractional millisecond timestamps). 16 unit tests (mock dsh server over real WebSocket) + build-tagged smoke test against a live server. Requires a running dsh web server (default http://127.0.0.1:3080).
…wlist
- AGENT_OPTIONS in the project wizard was hardcoded and stale: add dsh
(DSH / DeepSeek Harness) plus the other registered-but-missing agents
(reasonix, kimi, iflow, pi, tmux) so the wizard matches the backend
registry. The project detail page already lists agents from the API.
- web/pnpm-workspace.yaml used a malformed 'onlyBuiltDependencies: esbuild'
scalar; pnpm 10.13+ requires the 'allowBuilds' map. Without the esbuild
postinstall the vite build fails ('esbuild binary not found').
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new agent adapter
agent/dshthat bridges cc-connect to a running DeepSeek Harness (dsh) web server on the same machine, so any cc-connect platform (Feishu, Telegram, WeChat, …) can drive dsh sessions — including the plugin-style Go module published atdsh-external/dsh-cc-connect.What it does
POST /api/session.createwith the projectwork_diras cwd; same session id + cwd is idempotent server-side, so cc-connect restarts resume the same dsh conversation automatically.GET /api/events.mux); text/reasoning deltas are coalesced into sentence-sized chunks (dsh streams token-by-token) so IM delivery isn't word-by-word.approval/requested→EventPermissionRequest(Feishu Allow/Deny buttons) →POST /api/respond;question/requested→ AskUserQuestion cards with answers mapped back to option labels./stopviasession.cancel(AgentSessionCanceller), per-turntimeout_minswatchdog,/modelviasession.models/selectModel,/list+ cross-project session-id validation,cc-connect doctorreachability check.CC_PROJECT/CC_SESSION_KEY/CC_DATA_DIRinjected into the first prompt of fresh sessions so in-session cron/timer/relay CLI calls work;ProjectMemoryFile()returns<work_dir>/AGENTS.md(dsh natively loads it), so relay/cron instructions land in the model context.turn/end, approval/question requests, stream errors) blocking priority — without this a busy Web GUI flood could dropturn/endand leave the engine stuck after a permission answer.Changes
agent/dsh/— new adapter (client.goRPC/WebSocket wire,session.goAgentSession + event mapping,dsh.goAgent + optional interfaces,aggregator.godelta coalescing) with 16 unit tests (mock dsh server over a real WebSocket) plus asmoke-tagged integration test against a live servercmd/cc-connect/plugin_agent_dsh.go—//go:build !no_dshregistrationMakefile—dshadded toALL_AGENTSconfig.example.toml— dsh project example (bilingual)CHANGELOG.md— Unreleased entryweb/src/pages/Projects/ProjectList.tsx— add dsh (+ other registered-but-missing agents) to the new-project wizard's hardcodedAGENT_OPTIONS(the detail page already lists agents from the API)web/pnpm-workspace.yaml— fix malformed esbuild allowlist (onlyBuiltDependencies: esbuildscalar →allowBuilds: { esbuild: true }); without itvite buildfails on pnpm 10.13+Verification
go vet ./agent/dsh/,CGO_ENABLED=0 GOOS=linux go build ./...(CI platform),go test -race ./agent/dsh/— all greenwebbuild (tsc && vite build) — greendsh webserver (session create → prompt → streamed reply) — passedNotes
dsh webserver on the same machine (defaulthttp://127.0.0.1:3080); config fieldbase_urloverrides.go build ./...currently fails onorigin/mainitself (daemon/check_linger_other.gohas//go:build !linuxwhiledaemon/launchd.gohas//go:build darwin, redeclaringCheckLinger). Unrelated to this PR; the linux build (CI) is green. Happy to fix it separately if desired.