Repository navigation
feat(dsh): add DeepSeek Harness support - #58
Merged
Merged
Conversation
M2-1 of the DSH integration plan. The companion plugin (agent-notify-dsh) writes one normalized JSON line to stdin; this package turns it into the shared notify.Message the dispatcher already understands. Event mapping, matching the plugin's payload.ts contract: SessionStart -> session_start (focus capture only, never notifies) ApprovalRequest -> permission_required (the core gain over DSH's own bridge) UserQuestion -> input_required Stop -> run_completed RunFailed -> run_failed Field names deliberately reuse the Claude Code dialect (hook_event_name / session_id / cwd / tool_name) so both ends share one vocabulary instead of inventing a second one. Body construction follows the sibling hooks packages: tool and reason are truncated so a phone notification cannot be blown up by a long payload, and a missing tool name degrades to a readable placeholder rather than producing "工具 需要授权". Blank-only fields are treated as absent. An unknown event name is an error rather than a zero-value Message: a silent zero would enter dispatch with an empty agent and hide version drift between the plugin and the binary. Handle() still logs and returns nil, so a hook can never fail the agent that fired it. Verified: go build ./..., go vet, gofmt clean, 27 test cases in the package.
M2-2 of the DSH integration plan. DSH is the first agent here that is not configured by editing a hooks file. Its plugin is an npm package that DSH's loader resolves from a profile's dsh.profile.bundles list, so the Integration interface maps onto package management instead of file editing: SettingsPath -> <DSH_HOME>/profiles/<profile>/package.json Install -> dsh plugin --profile <p> add agent-notify-dsh Uninstall -> dsh plugin --profile <p> remove agent-notify-dsh IsHookInstalled -> is the package name present in bundles? Writing the profile manifest or node_modules directly was rejected: pnpm and DSH's plugin-manager own that bookkeeping, and a hand-written change would race their lockfile (plan §4.2). DetectInstalled uses three signals rather than a bare LookPath, because DSH is commonly run from a source checkout with no global binary: 1. AGENT_NOTIFY_DSH_BIN points at dsh 2. dsh is on PATH 3. the DSH home directory exists (installed but not currently on PATH) Two guardrails: the desktop profile is refused up front with a readable reason instead of letting DSH's own rejectElectronProfile surface an opaque pnpm error, and a missing dsh binary yields an error naming the override variable rather than a bare "not found". A missing or corrupt profile manifest reports (false, nil) rather than an error: "not installed yet" and "unreadable" lead to the same next action, so neither should escalate. Verified: go build ./..., go vet, gofmt clean, plus 9 adapter tests and 21 install-path tests (spawned commands are stubbed; no test runs pnpm or hits the network).
M2-3 of the DSH integration plan. Adds agent.dsh and notify.dsh, the default event set, and the entry in NotifyConfig.All(). DSH defaults to all four notification events, unlike Codex's two: the native plugin subscribes to approval/request and user-questions/request directly, so permission_required and run_failed are actually reachable. That reach is the whole reason this integration exists instead of reusing DSH's bundled Claude Code bridge, which silently drops both. session_start stays out of the list because it only drives click-to-focus window capture, never a notification. Three enumeration points had to move together, and a fourth is easy to miss: AgentConfig.DSH the install/enable target NotifyConfig.DSH the per-agent events and channels NotifyConfig.All() the read-only walk used by freeze and friends Load()'s ensureEvents the backfill for channel-only setup All() has a live guard test. Verified by mutation: dropping DSH from All() fails TestNotifyConfigAllCoversEveryAgent with an explicit message about the field-count mismatch, so the omission cannot reach review. Two new regression tests cover the DSH addition specifically: a pre-DSH config file must inherit Default() values rather than Go zero values (the click_to_focus accident this loader was previously fixed for), and the default event set must match the four events the plugin can actually emit. Verified: go build ./..., go vet ./..., gofmt clean, full config package green.
M2-4 and M2-5 of the DSH integration plan, committed together because the
display name and its asset are only meaningful as a pair: the asset guard
test asserts every agent with a display name also has a PNG on disk.
Display name is "DeepSeek Harness" - the full product name fits a
notification title, and the DSH brand guidelines permit naming a project's
relationship to the harness truthfully.
The logo is an original mark, not DeepSeek's: their brand guidelines ask
against reusing official material in ways that suggest endorsement. It is a
rounded badge with a terminal prompt, matching both the sibling logos
(64x64 RGBA) and what this integration actually reports on. dsh.png maps
through agentLogoFilename's default branch, so no mapping case was needed.
Adding dsh to supportedAgents activates two guards that were silently passing
before, because an agent missing from that list is simply not checked:
TestEverySupportedAgentHasLogoAsset the release archive only packs
assist/logo/agentlogo/*.png by glob, so
a missing file degrades every
notification to the generic icon with
no build failure. opencode.png once
shipped missing for exactly this reason.
TestSupportedAgentsAllHaveDisplayName catches a title rendering the raw
internal name.
Verified by mutation: hiding dsh.png fails the asset guard by name, and the
full notify package is green with the file restored.
M2-6 of the DSH integration plan. buildSenders resolves the per-agent notify config from msg.Agent, and an unmatched agent falls through to the ClaudeCode default. Without a dsh branch the plugin's events would be filtered against Claude Code's event list, so a user who enabled only DSH would silently receive nothing. Two tests cover both directions: dsh events reach cfg.Notify.DSH rather than the default branch, and an event the user did not subscribe to still produces no sender. Verified by mutation - deleting the branch makes the routing test fail with "returned 0 senders, want 1". Verified: go build ./..., gofmt clean, agenthooks package green.
M2-7 of the DSH integration plan. Adds the user-facing `agent-notify dsh` command group and the hidden `handle-dsh-hook` entry the plugin spawns. handle-dsh-hook follows the sibling handlers exactly: read config, resolve state and log paths, parse stdin, dispatch. Parse failures are logged and return nil, because a hook must never fail the agent that fired it. print-hooks deliberately does NOT emit a settings JSON the way other agents do. DSH has no hook config file to write - installation is a package-manager action - so emitting one would invent a file that nothing reads. Instead it reports the profile, the registration manifest, the exact commands that would run, and whether the plugin is currently registered: what a user actually wants to confirm before installing. iinstall-hooks/uninstall-hooks route through DshIntegration, and both expose -scope only to reject anything but user with a clear message, since DSH plugins live in a profile and have no project-scoped location. The install plan's display commands are covered by tests because they are meant to be copy-pasted. A first version dropped the `plugin` subcommand and printed `dsh --profile web add ...`; the assertion compares the displayed string against the argv actually executed so the two cannot drift again. Verified end to end with the built binary: `dsh print-hooks` renders the plan under an isolated HOME, and piping a real ApprovalRequest payload into `handle-dsh-hook` reaches dispatch - the state log records "no sender enabled for event=permission_required", which only happens after a successful parse and mapping. Verified: gofmt clean, go vet ./..., go build ./..., full suite green (20 packages).
M2-8 of the DSH integration plan. Wires DSH into the interactive flow: the agent menu, event options, channel and event readers, the configure dispatch, the disable path, and the display name. Five switch statements in flow.go and four spots in service.go had to move together - each is a place where a missing case silently falls through to the Codex default. The event menu offers all four events. Codex's two-event default would hide permission_required, which is precisely what this integration exists to deliver: the native plugin reaches approval/request and user-questions/request directly, while DSH's bundled Claude Code bridge drops both without a warning. configureDSH installs through DshIntegration rather than writing a file, and always resolves the user scope: DSH plugins live in a profile and have no project-level location. It deliberately does not pass the resolved binary path through, because the plugin locates agent-notify at its own runtime - the same place the npx launcher and `make local` both use. One existing test needed updating rather than fixing: TestService_NoAgentsDetected asserts the wizard errors when nothing is installed, and it stubs every integration to detectInstalled=false. DSH was the missing stub, so on a machine with ~/.dsh present the test correctly saw one detected agent and failed. That is the test doing its job - the stub list just had to grow with the agent list. Verified: gofmt clean, go vet ./..., go build ./..., full suite green (all 20 packages), including a new end-to-end wizard test that runs the real flow and asserts the DSH config, enabled flag and recorded install path.
M2-9 of the DSH integration plan.
Wires DSH into both halves of the diagnostics: the detection/result fields and
the two rendered tables. Wiring only one half is the easy mistake here - the
service builds an agent-status table and a channel table independently, so an
agent with detection but no rendering simply never appears in the report.
Two DSH-specific notes on the checks:
- Installation means the package name appears in the profile's bundles list,
since DSH records a plugin registration in a manifest rather than a command
string.
- There is no hookBinaryMissing equivalent. Every other agent stores the
agent-notify path at install time, so doctor can detect a dangling one; the
DSH plugin resolves the binary at its own runtime instead, so there is no
stored path to go stale.
The row label is "DSH", not "DeepSeek Harness": both tables use %-12s columns
and the 16-character name broke the borders. DSH is the abbreviation the
harness's own brand guidelines recommend for naming, so it stays recognisable.
A test pins the label length so a future edit cannot reintroduce the overflow.
Verified: gofmt clean, go vet ./..., go build ./..., full suite green (20
packages), and the rendered report checked by hand under an isolated HOME -
the DSH row appears in both tables with correct column alignment.
M2-10, the last step of the DSH integration plan's M2 milestone.
DSH was missing from a set of enumeration points that each fail quietly:
channel_apply.go channel-menu init stores credentials per agent, so a
DSH-only user got them written nowhere and the
channel never turned on
clean_targets.go `clean` would never uninstall the DSH plugin
actions_*.go (6 files) the "prefill from an existing credential" helpers
walk agents in order; a DSH-only user was prompted
from scratch every single time
actions.go the config view had no DSH row
menu.go the TUI banner and the clean-reset block
send.go `send --agent dsh` did not resolve, and the error
listing valid agents omitted it
send.go also accepts `deepseek-harness` as an alias, matching the existing
open-code / oh-my-pi aliases.
Two guard tests caught this change rather than letting it through, which is
exactly what they are for:
TestHookCleanupTargetsCoversAllAgents asserted the exact agent list
and failed the moment DSH
joined it
TestHookCleanupTargetsAlwaysIncludesBothScopes failed because DSH is the
only agent with no project
scope
The second is handled explicitly rather than by tolerating the error: the test
now asserts DSH really does refuse a project scope and skips it with a comment
explaining why, so a future agent that also cannot resolve one is not silently
absorbed into the same exemption.
The row label is "DSH" for the same %-12s column reason as the doctor tables.
Verified end to end with the built binary under an isolated HOME: the TUI
banner lists DSH, `send --agent dsh` and the `deepseek-harness` alias both
deliver, `dsh print-hooks` renders the plan, and the unknown-agent error names
dsh. gofmt clean, go vet ./..., go build ./..., full suite green (20 packages).
The plan this implementation was executed against, committed so the M0
findings and M1-M4 breakdown have a tracked home rather than living only in
the conversation.
It is worth recording which of its own assumptions the implementation
overturned, because a reader following it today would otherwise re-derive the
wrong answers:
M0-1 the plan expected a parent/root field on Agent. There is none -
ownership lives in the registry's private entry.owner and is
observable only through ctx.agents.roots().
M0-4 the plan hedged on whether a patch entry could take a path specifier.
Unnecessary: the whole DSH package set is published to npm, so the
plugin installs as an ordinary package.
M0-5 the plan treated a missing `dsh` on PATH as an obstacle to design
around. There is an official npm CLI, and DetectInstalled uses three
signals so a source checkout also works.
M1 the plan provisionally placed the plugin at packages/dsh-plugin/ inside
this repo. It became a separate repository (agent-notify-dsh) so the
npm package and the Go binary can version independently.
The plan's two central warnings both held: the silent event-vs-surface
mismatch between DSH's bundled Claude Code bridge and agent-notify's events,
and the waterfall delegation risk that the listener tests now guard.
The plan still opened with "计划(未开工)" (planned, not started), which is no longer true: the Go-side M2 work is on main and the plugin half ships as the separate agent-notify-dsh repository. Leaving the stale status on a public fork misrepresents the state to anyone reading it cold. Also drops a machine-specific absolute path from the research baseline line - it named a local checkout location that means nothing to other readers. Verified: go build ./..., gofmt clean, 20 packages pass.
The DSH integration shipped without user-facing documentation: neither README mentioned the harness at all. The plan's M3-7 called for exactly this and it was never done, which would have made the DSH pull request unreviewable - an agent that appears in the event matrix of the code but nowhere in the docs. Adds DSH to the intro agent list, a DSH column in the supported-events matrix (the table is the first thing a reader scans to answer "does my agent work"), and the install-location list in both English and Chinese. The per-agent note records why this integration uses a native Cordis plugin rather than DSH's bundled Claude Code hook bridge: that bridge only recognises SessionStart and Stop, so PermissionRequest and Notification are dropped silently - and a pending authorization is the notification that matters most.
CLAUDE.md is the guide an agent reads before touching this repo, and it still described seven agents. A contributor following it would not know dshhooks exists, that DSH installs through a package manager rather than a config file, or why the integration does not use the Claude Code hook bridge. Also corrects the note claiming docs/ is gitignored - it is tracked, which is where the DSH integration plan lives.
wanfanggreat
added a commit
to wanfanggreat/agent-notify-dsh
that referenced
this pull request
Oct 5, 2026
The README still opened with "插件侧已完成,上游 Go 侧尚未交付" - plugin done, upstream Go side not delivered - and told the reader that handle-dsh-hook was unimplemented and that installing the plugin alone would produce nothing. Both halves are now built. The Go side landed as the M2 work: 20 packages green, linux/darwin/windows builds and vets clean, with per-event fixtures under testdata/dsh-hooks/. The new wording is deliberately precise rather than simply optimistic. The Go side is COMPLETE but not yet MERGED upstream - it is open as hellolib/agent-notify#58 - so the README names both ways to get the receiving end (build from the PR branch, or wait for the merge) instead of implying the released binary already speaks DSH. Claiming otherwise would send someone to a 404 on `agent-notify dsh print-hooks` and look like the same silent-failure trap this project already documents twice. The "install the plugin alone and get no notifications" warning is kept: it remains true against any binary predating the DSH support, which is exactly the situation anyone on a released version is in today. It is now framed as one of two paths rather than as the only outcome. Both documented commands were run against the installed binary to confirm they exist and print their help, not just read out of the source.
hellolib
self-requested a review
October 6, 2026 08:52
clean walks every agent, and DSH is the only one whose Uninstall needs an external binary. On machines without dsh on PATH (or without the plugin registered) every clean run printed a spurious 'failed to clean DeepSeek Harness hooks' line. Skip early when the profile manifest does not contain agent-notify-dsh, matching the no-op semantics of the other integrations.
wanfanggreat
added a commit
to wanfanggreat/agent-notify
that referenced
this pull request
Oct 9, 2026
Brings the fork level with hellolib/agent-notify, which had moved on while we were working on our own DSH branch. Two upstream commits: the squash of our PR hellolib#58 (421e47b) and a maintainer follow-up replacing the DSH logo (ed28421). Three conflicts, all resolved in favour of upstream because upstream's versions supersede ours rather than compete with them: - assist/logo/agentlogo/dsh.png - the maintainer redrew it (2008 -> 654 bytes). Theirs is the canonical asset now. - internal/dshhooks/settings.go - the maintainer added an IsInstalled guard so Uninstall is a no-op for a profile that never registered the plugin. Without it every `clean` reports a failure on machines with no dsh binary. - internal/dshhooks/settings_test.go - the test that pins that behaviour. The DSH implementation itself needed no reconciliation: upstream's 421e47b is a squash of the same ten commits, so both sides carried equivalent code and git auto-merged it. Our fork-only work - the Feishu chat_id fix and the tester wiring - is untouched, and the docs now carry upstream's versions of the README/CLAUDE.md DSH sections. Verified: gofmt clean, go build and go vet clean, 20 packages pass.
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.
What this adds
DeepSeek Harness (DSH) support as the eighth agent, alongside Claude Code, Codex, OpenCode, ZCode, Grok, Droid and OMP. All four notification events are supported:
permission_requiredinput_requiredrun_completedrun_failedDSH also gets its own logo, config section, wizard entry, doctor line and
handle-dsh-hooksubcommand, following the same shape as the existing agent packages (internal/dshhooks/).Why a plugin instead of the Claude Code hook bridge
DSH ships
@deepseek-ai/dsh-hooks-claude-code, which reads an unmodified Claude Codehooks.json. That looked like the obvious integration route, but it only recognises seven events —SessionStart,UserPromptSubmit,PreToolUse,PostToolUse,Stop,SubagentStart,SubagentStop. This tool writes five, and the intersection is justSessionStart+Stop:PermissionRequest→ silently discardedNotification→ silently discardedPostToolUseFailure→ silently discardedSo the bridge would have delivered
run_completedand nothing else — losing the pending-authorization alert, which is the notification users most need. Worse, it fails silently: the hooks file is accepted, nothing warns, and the user concludes the integration is broken for no visible reason.This PR therefore uses the native path: a small Cordis plugin (
agent-notify-dsh) that subscribes to the harness's own extension points and spawnsagent-notify handle-dsh-hookdetached, so the agent is never blocked.agent/createdsession_start(focus capture only)approval/requestpermission_requireduser-questions/requestinput_requiredagent/turn-stoppingrun_completedagent/errorrun_failedOnly root agents are reported; subagent events are filtered via
ctx.agents.roots()to avoid notification spam.Install
Because DSH has no JSON hook file,
internal/dshhooks/settings.gomanages an npm package rather than a config file:agent-notify dsh print-hooksemits the same plan, which the setup wizard uses. The profile resolves fromDSH_HOME/AGENT_NOTIFY_DSH_PROFILE.Testing
gofmtandgo vetclean.linux,darwinandwindows(the CI matrix).testdata/dsh-hooks/, one per event.config.All()failsTestNotifyConfigAllCoversEveryAgent; removing the dispatch branch fails the routing test; hidingdsh.pngfails the asset guard.Notes for review
internal/config/config.goaddsdshwithenabled: false, matching the convention that new agents start disabled until the wizard enables them.docs/dsh-integration-plan.mdis the design record. It documents four assumptions that field testing disproved, so a future reader does not repeat them.docs/CONTRACT.mdin the plugin repo; both were only findable by running the plugin against a real harness.Out of scope
The plugin package is versioned separately and released independently, mirroring how the OpenCode plugin and the OMP extension already work. This PR contains only the Go side.