rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:TCOTC/dsh-plugin-default-workspace
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
A small DSH plugin that pins the no-context fallback Workspace of new Sessions to one folder, chosen in the Settings dialog, and keeps the provisional New Session row out of the Workspace list until its composer holds input.
DSH chooses the Workspace of a new Session from context, never from configuration:
| Situation | Stock DSH behavior | With this plugin |
|---|---|---|
| A Session holding a conversation is open in some folder | the new Session stays in that folder | unchanged |
| The app opens on a saved Session holding a conversation | that Session is restored | unchanged |
| An explicit target is passed (a workspace row's +, add workspace) | that target is used | unchanged |
| Nothing to go on: no saved selection, a saved Session that no longer exists, or a saved/current empty New Session (nothing ever sent) | the most recently active Workspace | the folder chosen in Settings |
| The Session you are viewing is archived | the main selection is cleared and the app drops to its choose a Workspace hero | a new Session in that Session's own Workspace, or the chosen folder when it had no Workspace |
An empty New Session is not "already conversing in another folder": DSH marks a
Session blank (SessionSummary.blank) until its first turn starts, and that
flag is what decides the last-but-one row above. Clicking a workspace row and
typing still starts the conversation in that folder; the folder only takes over
once there is a conversation in it.
Archiving is the one case where the folder that comes back is not the chosen
one: the conversation is gone but the project is not, so archiving a Session in
D:\CodeProjects\Moltenfrost leaves you in Moltenfrost with a fresh New
Session. A Session that belonged to no Workspace has no folder of its own to
keep, so it falls back to the chosen folder — the same rule as the row above.
Only clearing a main Session is honoured this way; archiving any other row
navigates nothing, exactly as before.
The Host owns no setting for this. The only "default workspace" concept in DSH
(workspaceRegistry.initializeDefault, <Documents>\deepseek-harness\default-workspace)
is created once on a pristine install and requires an empty Workspace registry
and empty Session history, so it cannot be repointed on an installation that
already has Sessions.
Stock DSH draws the selected blank Session in the Workspace list right away: the row is labeled New Session and exists before anything was typed into it. On an app that opens on an empty New Session, that is a row in the sidebar the moment the window appears.
This plugin keeps that one row out of the list until the composer holds something:
While a turn is being submitted the draft clears before the Session stops being blank, so the row keeps its state for that moment instead of blinking out between the two events; the Session's first turn then releases the rule for good.
Only the current blank Session is affected; every other blank Session is already hidden by DSH, and a Session becomes an ordinary row at its first turn, at which point this policy releases it. The Session itself, its unsent draft, and every navigation rule are untouched: the policy hides the row, it never changes which Session the list contains. Choosing Follow DSH on the settings page releases the row as well.
The hide rule is a stylesheet keyed by Session id, not a change applied to the row. That ordering is the point: a row hidden after the list has laid it out would make the rows below jump down and then back up — clicking New Session would visibly bounce the list. Two things make the ordering hold:
connectBlank, the moment the id
is known and before replaceMain makes its row visible — this is what covers
the first click, when the id is new and no rule exists for it yet;A blank that is already the main selection is not pre-hidden (reopening the blank you are looking at keeps its row exactly as it was), and the stylesheet is rewritten only when the decision changes. The row keeps no extra attributes, and a page that never matches the id (older DSH, a different list) simply shows the stock row.
Settings carries one page from this plugin, Default folder, as its own
navigation tab (settings.section, order 30 — after the shipped sections):
uiWorkspace.pickDirectory(). A folder the Workspace
registry does not know yet is registered first, exactly like
Add workspace… (uiWorkspace.workspaces.create({ path })), so a picked
folder is immediately usable;dsh.default-workspace.settings and is read at every routing decision, so it
applies to the next New Session with no reload and no re-apply.With nothing stored, the compiled-in DEFAULT_WORKSPACE_PATH still applies, so
an installation that never opens the page behaves exactly as it did before. A
stored folder that is not registered has no effect and the stock rule stays in
charge — this plugin never invents a Workspace.
The preference lives in the browser, not in the Host user-settings document: the
policy this plugin installs is browser-side, and a Host-backed field would make
the host half depend on the framework's schema package, which a plugin mounted
from a bare file:///… path cannot resolve. See Why localStorage below.
| Path | Role |
|---|---|
package.json |
Package manifest: host half plus the dsh.client declaration and exports["./client"] the Client module system scans |
lib/index.js |
Host half — deliberately empty; the policy and its Settings page are browser-side |
lib/client.js |
Browser half — wraps uiWorkspace.startSession, uiWorkspace.restoreSelection, and uiWorkspace.clearMain, contributes the Default folder Settings page, and keeps the provisional New Session row out of the list until its composer has input |
test/interception.test.mjs |
Maintenance check: runs the real browser bundle against a fake uiWorkspace and asserts every rule above, the Settings page included |
test/blank-row.test.mjs |
Maintenance check: runs the same bundle against a fake document and asserts the New Session row visibility rules |
test/host-integration.test.mjs |
Maintenance check: asks the running Host whether it composes and serves this plugin's browser half |
test/probe-report.mjs |
Reads the decision trace the browser half writes into the page's localStorage |
CHANGELOG.md |
Release notes |
LICENSE |
MIT |
The browser half wraps three navigation entry points on the uiWorkspace
service instance. The two navigation wrappers delegate to the stock method for
every case they do not own; the third wraps the clear that ends an archive.
Every wrapper swallows its own failures back into the stock flow, so the worst
case is exactly the stock behavior.
The row policy is separate from those wrappers and reads the facts the Workspace
list and the composer already publish — data-row-key="session:<id>" on a row,
data-composer-input on the editable surface, and data-composer-chip on a
typed reference — plus the Session list's own retainedBy.mainView and blank
fields. Its only write is one stylesheet keyed by Session id, and a failure
leaves the row exactly as stock drew it.
The Host settings document edits fields a plugin declares with .volatile() in
its exported Config schema, which comes from @deepseek-ai/schemastery. A
plugin mounted as a file:///… Loader row resolves its own imports relative to
its directory, so that bare specifier is unreachable without shipping a
node_modules next to the plugin. The preference is therefore browser-local,
which is also where the policy lives. The cost is that it is per browser origin
and invisible to the Host configuration file; the benefit is a plugin with no
dependencies at all.
Each one was learned against the live app rather than from documentation; the
traces from test/probe-report.mjs are what pinned them down.
inject. With inject: ["uiWorkspace"] the plugin never
applied at all — no error, no console line, just a page where the policy did
not exist. The service does not exist yet when the entry is applied
(the trace shows apply → waiting → installed 247 ms later), so the
browser half polls ctx.get("uiWorkspace") every 50 ms instead of waiting.this.ctx.layout.beginNavigation(); doing that from here throws
cannot get property "layout" without inject — which made the primary path
fall back to the stock flow. Supersession is now checked against
mainReference, and test/interception.test.mjs runs against a service whose
ctx has no layout at all, so this cannot regress unnoticed.blank, not "exists", decides. A saved Session that still exists but
never received a turn is an empty New Session, and must not pin its folder.
DSH's SessionSummary.blank carries exactly that fact.uiWorkspace.watchNavigation restores a selection exactly once, at
startup; afterwards it only watches for one thing — a main Session that has
become archived — and its reaction to that is clearMain(), which drops the
main reference and the persisted selection and leaves the stock hero
standing. Wrapping startSession and restoreSelection therefore misses
archiving completely, and a page that archives its main Session sits on
"choose a Workspace" until the user navigates by hand. The trace proves it:
the two startSession decisions that recovered the app are 20 seconds apart,
with nothing at all recorded in between. clearMain is the only choke point
every archive route passes through — the row action, the shortcut, the
stop-and-archive dialog, another plugin, and the watcher's own
clearArchivedCurrent — so that is what gets wrapped, and it reads the
Session's Workspace before delegating, because the clear is what erases the
identity that names it.connectBlank wrapper — the one moment the id exists before replaceMain
renders the row. The first click is the interesting one, because that is
the only time the id is new.The plugin is mounted by one patch in the profile's user patch layer,
%USERPROFILE%\.dsh\profiles\desktop\cordis.patch.yml. The patch dialect
(@deepseek-ai/cordis-plugin-include) is id-targeted, so adding a new
top-level row means a patch with no id and an insert list — a bare
- id: <new id> patch matches nothing and is skipped with a warning:
- insert:
- id: default-workspace
name: file:///C:/Users/<you>/.dsh/plugins/dsh-plugin-default-workspace/lib/index.js
The absolute file: name keeps the plugin out of the profile's pnpm-managed
node_modules, so installing or updating other plugins cannot prune it (the
loader's own anchorInsertedPluginNames is what turns a ./… name into a
file URL relative to the patch file, so an absolute one is also fine).
Reload rules when editing this plugin:
cordis.patch.yml is hot-reloaded: the profile HMR watcher
re-applies the patch layer through reconcileProfilePatches, which mounts or
unmounts this entry live. No restart needed.lib/client.js reaches the running Host's Client module graph
immediately: a new bundle revision is composed and served (proven by
test/host-integration.test.mjs, which derives the revision from the file's own
metadata). The page, however, does not re-fetch it on its own — the Electron
HTTP cache showed no new bundle fetch after boot — so a page reload or app
restart is what loads the new half, and with it the Settings page.POLICY_VERSION whenever the wrapped policy changes, otherwise a page
that already installed the old wrapper treats the new half as a no-op.$node = "$env:USERPROFILE\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies\node\bin\node.exe"
$plugin = "$env:USERPROFILE\.dsh\plugins\dsh-plugin-default-workspace"
# the interception rules, against a fake uiWorkspace service
& $node "$plugin\test\interception.test.mjs"
# the New Session row rules, against a fake document
& $node "$plugin\test\blank-row.test.mjs"
# the live Host actually composed and serves the browser half
& $node "$plugin\test\host-integration.test.mjs"
# what the page actually did: policy versions installed, branch per decision
& $node "$plugin\test\probe-report.mjs"
In the GUI:
probe-report.mjs must show blank-row decisions
with the Session id in "hidden" and then an empty "hidden".probe-report.mjs must show a clearMain
decision with "branch":"keep". Archive a Session from Ungrouped instead:
that one must land in the chosen folder ("branch":"default"). With Follow
DSH selected, archiving the Session you are viewing must drop you to the
stock hero — the interception is off along with the rest of the policy.- insert: patch from cordis.patch.yml (the HMR watcher
unmounts the entry live; otherwise restart).%USERPROFILE%\.dsh\plugins\dsh-plugin-default-workspace.dsh.default-workspace.settings key
from the app's localStorage (the page's Follow DSH choice is stored there
too).cordis.patch.yml if you want one.The browser half depends on private members of the stock uiWorkspace service
(workspaces.list, workspaces.create, pickDirectory, sessions,
selection, mainReference, lifetime, connectWorkspace, connectBlank,
openWorkspace, replaceMain, clearMain), on
the Session summary's blank flag, and — for the Settings page — on the
settings.section slot type and the slots/locale services. The row policy
adds the stock Workspace browser's data-row-key="session:<id>" row marker and
the composer's data-composer-input / data-composer-chip markers. A DSH update
may rename any of them; the navigation wrappers then fail closed into the stock
behavior (a console warning appears in the renderer, and the trace records
interception-failed), the page either disappears or reports
settings-page-failed, and the row policy records blank-row-failed and leaves
the row as stock drew it (an id that no longer matches leaves the row visible).
Re-run the checks above after an update: a failure names the rule that broke.
DEFAULT_WORKSPACE_PATH and DEFAULT_WORKSPACE_ID in lib/client.js are now
only the initial default, used while nothing is stored; the live value is the
stored preference. Bump POLICY_VERSION with any policy change so the installed
page replaces the wrapper instead of keeping it.
MIT — see LICENSE.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。