deepseek-harness
deepseek-ai
DeepSeek Harness: Everything is a Plugin.
PROJECT TOPICS
PROJECT README
Adds destructive "clear session history" affordances to the dsh web GUI, each behind an are-you-sure dialog that shows exactly what will be deleted:
Session logs live under $DSH_HOME/sessions/<project-key>/<session-id>/. The
plugin deletes those directories through the host's own session persistence
backend (locate() resolves each session's directory, no slug reimplementation),
so what disappears from disk is exactly what the sidebar lists. Effects:
$DSH_HOME/storages/workspace.json), so its row disappears from the
sidebar. A clear-all removes every workspace registration. Any
still-running session that belonged to a removed workspace moves to the
Ungrouped bucket, matching the app's own Delete workspace behavior.session.list and skips ids without a summary.The plugin is home-agnostic by construction: it never resolves a path itself
(no ~/.dsh literal, no home lookup), and every path it touches comes from
host services whose wiring is $DSH_HOME-derived (dshHomePath('sessions')).
Verified against a harness booted with a custom DSH_HOME: previews read that
home's sessions, a clear removed them, and the default home stayed untouched.
Every action shares one rule:
parentSession chains): deleting a log underneath its writer would leave a
recreated, headerless file. The dialog reports the kept count.The dialog states the kept count before the user acknowledges.
None of the three surfaces declares a plugin slot. The workspace and session
row menus belong to ui-workspace's browser and the New Session button to the
sidebar shell, so the browser half integrates at the DOM level:
workspace.sessionIds at the group-relative
row index, mirroring the sidebar's own render order (skip archived and
summary-less ids), and double-checks the session title before acting. An
ungrouped row matches by title among sessions no workspace owns.Every hook degrades to a no-op on a template mismatch (unknown locale, restructured DOM) rather than breaking the sidebar. Both shipped locales (English and 简体中文) are matched.
The dialog is the harness's own RiskConfirmation primitive (checkbox-gated),
hosted on the plugin's private React root. All calls round-trip through the
Typert remote (/api/clearSessionHistory/*):
preview(input) / clear(input) → workspace scope
{ workspaceTitle, titleOccurrence } (empty title = every workspace);
returns { targets, kept } / { deleted, targets, kept, removed }.previewSession(input) / clearSession(input) → single session
{ sessionId }; preview reports whether the log is deletable, clear
returns { deleted, targets, kept, removed } and never removes a workspace.Workspace titles are resolved through workspaceRegistry (registry display
order), matching the order the sidebar renders them.
dsh plugin --profile web add /path/to/deepseek-harness-plugins/clear-session-history
Restart the GUI. Verify:
curl -s -o /dev/null -w "%{http_code}\n" \
http://127.0.0.1:3080/plugins/dsh-clear-session-history/client.js # 200
workspaceRegistry.delete(), and only after a fully successful clear (every
targeted log gone), so a partial failure never orphans sessions.pnpm test (node half against stubbed services + temp sessions root):
scope matching, running/subagent keep rules, occurrence resolution, unknown
workspace soft failure, workspace-registration removal (per-workspace and
clear-all), partial-clear keeps the workspace, single-session delete
(cold deletes, attached-but-idle deletes and archives to hide, running
agent refused, unknown id fails, workspace never removed), degenerate
locate() refusal, missing-service failure.
node tests/client-session-flow.mjs (built client bundle under the harness
checkout's jsdom): drives the real pointerdown → session-menu → Delete
session → id-resolution path against a simulated grouped sidebar and asserts
the dialog acts on the resolved session id.
Live probe against a running instance (non-destructive):
curl -s -X POST http://127.0.0.1:3080/api/clearSessionHistory/preview \
-H 'content-type: application/json' \
-d '{"type":"client-request","rpcId":"probe","method":"clearSessionHistory/preview",
"payload":{"args":{"input":{"workspaceTitle":"","titleOccurrence":0}}}}'
The returned targets count matches find ~/.dsh/sessions -mindepth 2 -maxdepth 2 -type d | wc -l (minus sessions whose agent is running at that
moment, reported as kept).
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: 无有效分类标签。