Foreword¶
DeepSeek Harness (DSH) Web Plugin: Hotkey Configuration Platform.
Turn “each plugin intercepting the keyboard and maintaining its own settings” into a registry service ctx.hotkeys. Any plugin can register “action → handler” pairs through ctx.hotkeys.registerAction(...). The default key, trigger scope, and description of an action are declared by the plugin. Explicit user key remapping is persisted centrally on the platform. The settings page and the /hotkeys command provide unified configuration.
Core Features¶
- Registry service
ctx.hotkeys. - Register actions via
ctx.hotkeys.registerAction. - Action descriptor: id, title, description, group, scope, defaultKey, handler.
- Supported scopes: global, input, question-card, command-palette, custom.
- Returning false from the handler passes the event through.
- User bindings are persisted in the
localStoragekeydsh.hotkeys.v1. - Unified configuration in the settings page (DSH Settings → Hotkeys).
- Command
/hotkeys.
Installation¶
dsh plugin --profile web add dsh-hotkeys-platform
Restart dsh web after installation.
Typical Usage¶
export const inject = ['hotkeys']
export function apply(ctx: Context): void {
ctx.effect(() =>
ctx.hotkeys.registerAction({
id: 'my-plugin:send-message',
title: () => t('发送'),
description: '发送当前消息',
group: '消息',
scope: 'input',
defaultKey: 'Control+Enter',
handler: (event, h) => {
h.dispatchEnter(h.target ?? event.target)
},
})
)
}
Key Notes¶
ctx.hotkeysis optional: The platform is optional; skip it if it cannot be read; do not directly accessctx.hotkeysoutsideinject.- Wrap with
ctx.effect:registerActionreturns a disposer; when the fiber unmounts (HMR/disabling), the registration is automatically revoked; otherwisealready registeredis thrown on next activation. - Namespaced
id:my-plugin:xxxis recommended to avoid conflicts. - Scope:
globalfor anywhere,inputfor text areas,question-cardfor question cards,command-palettefor the command menu,customfor custom decision logic. - Handler returns false: indicates the key event is not consumed and is passed through to DSH native behavior.
Architecture and Host Capabilities¶
The architecture is isomorphic to dsh-better-sidebar: the platform provides ctx.provide('hotkeys', service), while business actions are registered by consumer plugins (eating our own dog food), with equivalent capabilities.
The platform does not provide host capabilities (read/write files, etc.). If a hotkey action needs to trigger a host-side capability (e.g., execute a command or archive a session), your plugin should provide its own host route, and simply use fetch in the handler.
Configuration¶
- Settings page: DSH Settings → Hotkeys. Supports visual editing and recording.
- Command: Type
/hotkeys. - Three-state key binding: unchanged (uses defaultKey) / recorded (user binding) / disabled (even the default is turned off).
Status¶
In development and not yet usable.
Link¶
https://github.com/whitewatercn/dsh-hotkeys-platform