dsh-bili-scroll
c1overzz
DSH 插件:每天替你刷一轮 B站,读字幕挑出值得的、写一份日报,值得的 @ 你
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:qichuang321/dsh-web-terminal
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
A terminal dock merged into the DSH web GUI: hideable, split-screen with the chat (it owns the shell's real bottom band, so the columns shrink instead of being covered), and integrable with terminal-designed TUI plugins.
┌─────────────────────────────┐
│ session header [终端] │ ← toggle (conversation.session.header.utilities)
├─────────────────────────────┤
│ conversation (chat) │ ← keeps its own scrollport, stays mounted
├─────────────────────────────┤ ← shell.bottom slot
│ [Shell] [Panel] × │ ← dock tab bar
│ xterm.js terminal / TUI │ ← full-emulation ConPTY
└─────────────────────────────┘
shell.bottom, a shipped slot
whose rendered height is subtracted from the three columns. No DOM injection,
no padding hacks. Height is draggable (120–900 px) and persisted in
localStorage (dsh.webTerminal.v1).registerView API so plugins can add
their own views.dsh plugin --profile desktop add link:D:\Deepseek Harness\dsh-web-terminal
# restart the GUI, then use the header toggle or Ctrl+`
The bundle patch inserts the host half (lib/index.js: node-pty PTY + WebSocket
bridge + webTerminal registry) and the client half (lib/client.js: the dock
component).
| Piece | File | Notes |
|---|---|---|
| Plugin entry (host) | src/index.ts |
webServer inject, routes + webTerminal service under ctx.effect, Config schema drives the settings page |
| Routes + WS terminal | src/routes.ts |
loopback fence, WebSocketServer({noServer:true}), 1MB/512KB backpressure |
| PTY layer | src/pty.ts |
node-pty direct (^1.1.0, prebuilt win32-x64 ConPTY), TERM/COLORTERM env, powershell.exe default |
| Shared protocol | src/protocol.ts |
frame types + WT_API paths + clamps |
| TUI registry | src/tui-registry.ts |
webTerminal.registerView(def) extension seam |
| Client entry | src/client/index.ts |
registers into shell.bottom + conversation.session.header.utilities, `Ctrl+`` |
| Dock UI | src/client/dock.tsx |
xterm + FitAddon, tabs, drag resize, TUI channel |
| TUI channel | src/client/tui-channel.ts |
window CustomEvent channel |
| Demo adapter | src/examples/* |
one dom view (demo:panel, proves the CustomEvent channel) |
window.__ModuleLoader__.load({ id: 'dsh-web-terminal', factory(require) { … } }).require() — never an inlined second copy (two React instances break
hooks and the shell's renderer). @xterm/* is not in that table and stays
bundled.apply(ctx) only registers slots/effects; keep the factory free of side
effects./api/dsh-web-terminal/*, loopback-fenced)server→client: {type:'ready',view,cols,rows} | {type:'output',data}
| {type:'title',title?} | {type:'exit',code,error?}
client→server: {type:'input',data} | {type:'resize',cols,rows}
Host side — any DSH plugin registers a view inside its own ctx.effect:
const webTerminal = ctx.get('webTerminal')
ctx.effect(() => webTerminal?.registerView({
id: 'my-plugin:my-tui', // namespaced 'pluginId:viewId'
label: 'My TUI',
order: 10,
spawn: ({ cols, rows, env }) => ({
command: 'npx',
args: ['--yes', 'my-tui'],
shell: true, // run through the default Windows shell
env: { ...env, MY_FLAG: '1' },
}),
}), 'my-plugin: tui view')
Client side — the browser half of the same plugin:
import { dispatchRegister, dispatchUnregister, onTuiEvent, TUI_EVENTS } from 'dsh-web-terminal/client'
ctx.effect(() => {
dispatchRegister({ id: 'my-plugin:my-tui', label: 'My TUI', kind: 'pty' })
return () => dispatchUnregister('my-plugin:my-tui')
}, 'my-plugin: tui client')
Events: adapter→dock register / unregister; dock→adapter ready (re-register,
self-heal), activate ({id,container} — dom views render here), deactivate,
view-state ({id,state:'running'|'exit'|'error',code?,error?}).
sec-fetch-site and
Origin checks) — LAN-exposed dsh web deployments must not serve these.input/resize are accepted,
cols/rows clamped.ctx.effect disposer); no fs access from the browser.node-pty never sets TERM from the name option on Windows — the plugin
sets TERM=xterm-256color/COLORTERM=truecolor explicitly in the env.kill(signal) throws on Windows — bare kill() only; Ctrl+C is \u0003.powershell.exe (pwsh if installed, cmd.exe last resort).
cmd.exe may need chcp 65001 for UTF-8 TUI output.convertEol:false).pnpm install # node-pty ^1.1.0 prebuilt win32-x64 — no compiler needed
pnpm build # tsc typecheck + tsdown → lib/index.js + lib/client.js
0.2.x (shell.bottom slot era). The 0.1 line mounted the dock
into the conversation column with DOM injection; that path is gone.CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: 无有效分类标签。