English | 中文
dsh-split-workspaces
A local DSH plugin bundle: it tiles several workspaces side by side and stacked in the
main panel of the Harness Web UI, one workspace conversation per pane. Splitters can be
dragged to resize, title bars can be dragged to swap two panes' positions, and the pane
that currently holds focus is marked by a brand-coloured title bar.
What it adds
- One row of icons in the sidebar (two tiled squares, right next to the Plugins icon);
clicking it switches the main area to the multi-workspace tiled panel.
- The panel itself: at the top are the title and
Add workspace, below is the
board — every pane has its own title bar (workspace name and path, the Open directory
icon, the Replace workspace icon, the Split icon, mode selector, session selector,
close), and inside the pane it
reuses the shared conversation.content Factory (the embedded variant), mounted under an
explicit SessionProvider binding, so each pane is a complete conversation (transcript,
input box, streaming output).
- A per-pane conversation view strip: above each pane's conversation area, the panel lists
every registered
conversation.view — by default just "Chat"; with the Git panel installed it
becomes "Chat / Git". "Trajectory" stays in the main conversation and is never listed in a
tiled pane. The strip only reads the framework's registry and copies no plugin UI: clicking
Git renders the Git plugin's own panel. Each pane picks independently and defaults to Chat;
with no extra view plugins (or only Chat) the strip is not rendered at all, so the pane
behaves exactly as before.
- Save layout / auto-restore: the save icon in the top-right saves only the current panel
mode's part: tile mode writes the board (split directions, ratios, pane order, focus) and
each pane's session/Agent preset; dispatch mode writes the dispatch graph (edges + notes).
The other part keeps its last save and is never cleared by this action. The record does not
store the panel mode: a page reload always starts in tile mode.
The saved record lives in the Host's
$DSH_HOME/storages/pane_layout.json.
The first time the tiled panel is opened after a page reload — or after the desktop app
restarts on a different port — it restores that snapshot;
switching panels within the same page keeps the live layout. Missing workspaces, sessions,
presets, or graph endpoints are dropped or cleared silently — never an error. The model itself
is persisted per session by DSH, so restoring the session restores the model; no second
model snapshot is forced onto it.
- The
Open directory icon (the folder to the right of the workspace name): clicking it
hands that pane's workspace directory to the system file manager (Linux xdg-open,
macOS Finder, Windows Explorer). It does not implement this machinery itself; instead it
reuses the two methods of the already-installed Session remote namespace
(@deepseek-ai/dsh-api-session-controller): canOpenWorkspacePath() first answers
"can this deployment hand a path to the desktop" (a Linux container with no graphical
environment answers false, which is exactly what "there is no file manager in front of
you" means), and then openWorkspacePath({ path }) validates in the composite
filesystem that this path really is a directory the Host can open, and opens it according
to the operating system's association — a directory's association is the file manager.
So "which command to use to open it" has only one implementation and one set of
validations, and this plugin does not have to add a row on the Host or make users restart.
Availability is a deployment-level fact and is asked only once; a directory that is not in
the Host mapping, a file manager that will not start, a deployment with no session
service, or no graphical environment at all are each spelled out in the pane's own error
line (the localised reason first, the Host's original text appended as detail).
- The
Replace workspace icon (one per pane title bar, between Open directory and
Split): puts another workspace, or another session of the same workspace, into that
pane. The menu has two steps: the first is New workspace… (reusing the very same folder
picker and registration) plus all workspaces (including those already tiled in other
panes; tiled ones are marked open), in sidebar order. The second step lists that
workspace's sessions; the first row is always New session, followed by its existing
sessions. Choosing an existing session keeps the place: the layout tree, splitter ratios
and neighbours do not move by a single byte, and the pane is switched atomically to "new
workspace + that session" with the session pinned (the same session may be open in another
pane too). New session reuses a blank session in that workspace that no other pane has
pinned, or creates one; the pane's staged Agent mode is kept. Already-tiled workspaces are
candidates because "another session of the same workspace" is a legitimate use; to exchange
two panes' places, drag a title bar, which does not reopen any conversation. It is one icon
per pane rather than one button in the panel header so that "which pane?" never has to be
asked.
- Every row of the
Switch session dropdown carries its own delete button (the trash
icon at the end of the row): it permanently deletes that row's session, which need not
be the one this pane is currently showing. That is exactly why it is per row instead of one
button at the bottom of the menu: the menu is a list of sessions, and the one a user wants
to clear is usually a different row — a single bottom button would first make them
reason about "which one does it delete?". Deletion itself is not implemented here: this
plugin hands "which row, under what name" to the confirmation dialog that
dsh-session-delete already ships (the sessionDeleteUi service that plugin's Client half
publishes with ctx.provide; this plugin resolves it lazily with ctx.get at click
time, the same pattern as the MCP policy service). So the confirmation, the "a running
session has to be stopped first" branch, and the Session-list bookkeeping all exist exactly
once. After a successful deletion this plugin lets go of every pane pinned to that
session (the same session can be displayed in several panes — a following pane
automatically picks the workspace's most recently updated real conversation): a following
pane falls back to the newest remaining real conversation in its workspace, while a pane
whose session the user picked by hand goes back to its "pick a session / new session" empty
state. Without dsh-session-delete the button is still there and says so in the pane's
error line instead of pretending the deletion happened.
- How tiling works:
Add workspace always attaches the new pane to the right edge of
the whole board; the split menu on each pane's title bar has two steps: the first step
picks a direction (left, right, up, down), the second step picks the workspace to put
into the new pane. Picking a direction does not split immediately, nor does it casually
open another pane for the current pane's own workspace — the point of tiling is to spread
different workspaces out. So any combination can be assembled, for example "two side
by side on top, one below" = first split A downwards (pick C), then split A to the right
(pick B). Besides listing the existing workspaces, the second step also has a
New workspace… row for picking a brand-new directory directly. One icon button plus two
menu steps saves more title-bar width than four buttons in a row.
- Drag to resize: between panes there is a draggable splitter; a left-right layout is
dragged left-right, a top-bottom layout is dragged up-down. Double-clicking the splitter
restores the even balance, and after focusing the splitter the arrow keys fine-tune it
(hold Shift for a bigger step). The ratio is stored as "a percentage of the container", so
the layout ratio is unchanged after the window is resized.
- Drag the title bar to swap positions: press and hold a pane's title bar (except the
buttons, dropdowns and menu panels inside it), drag it onto another pane and release,
and the two panes swap positions. During the drag only the drop-target pane lights up with
an accent-coloured ring and the dragged pane fades out; the swap happens only on
release; releasing over empty space does nothing. What it swaps is positions, not
contents: each pane's workspace, session and preselected mode all travel with it, so the
highlight and the keyboard caret also follow the dragged pane to its new position (after a
swap the caret waits one frame before being placed back into its input box, for the same
reason as "closing a pane waits one frame"). A press that moves less than 4 pixels still
counts as a single click (lighting up the pane, handing over the caret), so the title
bar remains the "click once to focus" handle. There is no Esc to cancel, no dragging to an
edge to split, and no keyboard swap — those are all extra semantics beyond "swap only on
release".
- Focus highlight: whichever pane you press the mouse in or Tab into becomes the current
focus — only its entire title bar is a blue gradient with white text (workspace name,
path, mode/session triggers and buttons all turn white together), while the pane itself
keeps the same thin border as the other panes, with no highlight ring and no outer glow;
when the focused pane is closed, focus automatically goes to the pane that takes its place.
- The keyboard caret follows the highlight (an invariant that must hold in both
directions): when a pane lights up, the caret also enters its input box; conversely, when
the user clicks on a control inside a pane (title-bar buttons, dropdowns, the copy
button in a message, links, the input box itself), the caret stays there and is never
stolen. Losing the first half produces very hard-to-self-diagnose bugs — you click into the
right pane's message area, think you are talking to it, and the characters you type go
somewhere else; losing the second half destroys the title bar's keyboard accessibility and
its popup menus. When the user has just drag-selected a piece of text, nothing is touched
at all (
focus() wipes that selection out entirely, see pitfall 5). When the current pane
is closed, the pane that replaces it takes over the caret after the next reflow (it is
remounted; the reason is likewise in pitfall 5). When a pane has no typeable input box (no
session yet, or the host is inert), only the highlight switches and the caret is left
alone. A popup menu is rendered through a portal into document.body with
position: fixed: the pane is overflow:hidden, so a menu left inside it gets clipped as
soon as the pane narrows (the preset / switch-workspace / split / MCP / SKILL menus all share
this). It is clamped horizontally to the viewport, flips above the trigger when there is no
room below, and scrolls internally; the tradeoff is that it may cover a neighbouring pane.
The two ends of the gradient are mixed from the blue accent colour and a static
black token (color-mix), which both produces the dark-to-light blue in the design and
raises the white text's contrast above 4.5:1 — pure accent colour with white text is only
3.3:1, which looks blurry. The offline tests compute the contrast of each end of the
gradient and fail immediately below 4.5:1. The buttons on the focused title bar (the split
icon, the mode/session dropdowns, close) use a black darkening on hover / when
expanded, rather than a white wash: white text on "the pale grey-blue produced by washing
white 24% over it" is only 3.5:1 and just looks like a grey patch with the text smeared on
it; with a black base, hover is black 50% (the base still shows a hint of blue) and
expanded is pure black, giving the same white text 11:1 and 21:1 respectively, and the
offline tests compute each end the same way.
Alt+arrow keys moves focus: pressing Alt+←/→/↑/↓ gives focus to the pane at
the corresponding position in that direction, and sends the keyboard caret into its
input box as well (so you can type immediately after switching, without ever touching the
mouse). The direction is decided by the panes' rectangles, not by the layout tree's
nesting: a candidate must lie entirely beyond that direction and must overlap on the
perpendicular axis; nearer wins → more overlap wins → better-centred wins. So in "top row
A|B, bottom row C|D", A with Alt+↓ can only reach C (D does not overlap A's row at all),
and in the three-in-a-row "A | X | B", A with Alt+→ reaches the adjacent X first rather
than skipping over it. Pressing again at the far edge does nothing (it does not wrap
around to the opposite side): cycling would make people lose their bearings among a screen
full of panes. These four key bindings are also registered in the framework's shortcut
roster, so they show up in Settings → Shortcuts and can no longer be assigned to
another command.
- The dropdown menu panel's background uses the "raised surface"
--dsw-alias-bg-layer-2 (dark #2c2c2e / light #fff), not --dsw-alias-bg-overlay —
the latter is a mid grey #61666b in the dark theme, leaving white text on the panel at only
5.6:1 and secondary text ("current", "This session has already started…") at only
3.9:1. After changing the background they are 13.3:1 and 9.3:1 respectively in the dark
theme. Relatedly, menu items' hover was changed from bg-layer-2 to currentColor 8%:
the panel is itself bg-layer-2, so using it as the hover background is the same as
nothing happening when you press.
- An independent Agent mode selector per pane (Standard / PTC / Minimal / Cordis, plus
custom presets): it uses the same Host roster as creating a new task from the sidebar
(
remote.agentPresets.list), and shows both the mode the pane's current session is running
in and the mode preselected for the next session.
- An MCP tool switch shared per workspace (the
MCP / MCP n dropdown in the title bar):
which MCP servers' tools are visible to this workspace. Its semantics are the opposite of
the mode selector's — modes are stashed per pane and take effect per session, while MCP
visibility is a host policy applied by session cwd, so every session in the same workspace
shares one selection. The roster and tool counts come from the Host
(remote.mcpWorkspace.list, server names discovered from mcp__<server>__*); ticking calls
set, and the Host re-mounts the tool restriction and persists it immediately. A workspace
with no saved selection starts with nothing ticked, i.e. no MCP tools at all.
- A SKILL switch shared per workspace (the
SKILL / SKILL n dropdown in the title bar):
which skills from the skill library are visible to this workspace. It has the same shape as
the MCP switch (both are per-workspace host policies); the difference is that its items come
from scanning the skill directory itself, so every row can carry the skill's description —
without it you cannot sensibly choose. An empty directory, a missing directory and a broken
skill file are each explained in the popover: a blank panel would leave people guessing
whether they never created a file or the plugin is not active. The directory is owned by
Settings → Skills; this block only reads it and only writes one workspace's selection, and
when the skill plugin's client half is not mounted the button is not rendered at all.
- Design mode + task dispatch: a second panel mode that draws each session as a card
and connects them with arrows into a directed tree — the graph is the authorization. Sessions
with outgoing arrows get agent-scoped
dispatch_task, report_task, and control_task tools:
dispatch_task hands work to another session, one target or several in parallel, with
wait: all | any | none; report_task asks a target for a read-only report based on its
own model-visible history, without changing the target, creating a goal, or producing a
delivery conclusion; control_task stops a task in flight or wakes a paused goal, without
dispatching a new task. Each result also lists the remaining idle targets as a reminder to keep
distributing, and a delivered task must be reviewed before that target can take a new one.
See the dedicated section below.
- The
Add workspace dropdown lists "workspaces that are not tiled yet" and also supports
creating a workspace from the folder picker (uiWorkspace.pickDirectory(), or through
the preload bridge under Desktop). The same "pick a directory → register a workspace"
implementation also serves New workspace… in the split menu's second step, so there is
only one picker and one failure handling in both places.
Design mode: draw the delegation tree as arrows
The panel has two modes: tile (the default, everything described above) and design.
Design mode lets you drag sessions from the left-hand picker onto the canvas and connect
them with arrows into a directed tree — the arrow direction is the delegation direction, and
deleting an arrow revokes the authorization. There is no second configuration: the graph is the
permission.
- Draw one: drag from the dot on a card's right edge onto another card.
- Delete one: click the small cross at the arrow's midpoint.
- Sessions, not panes: the same session opened in two panes still has one card, and
closing a pane never deletes an arrow. Only deleting the session drops its edges.
- Candidates grouped by workspace: the canvas no longer tiles every session. A left-hand
picker groups sessions by workspace (groups sorted alphabetically, collapsed by default);
open a workspace to list its session cards, then drag one onto the canvas (or click it) to add
it. Added sessions disappear from the left-hand list and come back only after being removed
from the canvas. A dragged card first waits in the canvas's left-hand "unwired" column with a
dashed border; it joins the tree on the right only after an arrow is drawn, and drops back to
unwired when that arrow is deleted. Sessions that belong to no registered workspace go into an
"unknown workspace" group at the end.
- Wire after dropping: on the canvas, drag from a card's right-edge light dot onto another
card to create a relation; the × at the top-right of an unwired card removes it from the canvas.
- Trees stack as whole blocks: when several disconnected trees exist, each tree is laid out
on its own and the next tree starts below the previous tree's bottom edge, so arrows and
notes from different trees never interleave.
- Colour by origin: cards from the same workspace and arrows from the same source session
share one neon colour; every connection carries a highlight flowing towards the arrowhead.
Two invariants keep it a tree: no cycles, and at most one parent per session. Both are
enforced by a pure function (validateEdge) before the edge is added.
The dispatch_task tool
A session with outgoing arrows gets an agent-scoped copy of dispatch_task (it shadows
the global one) whose description lists the available targets.
| Parameter |
Meaning |
task |
Task body. The target cannot see A's history, so background and verifiable acceptance criteria belong here. Omit it when waiting for a previous dispatch. When the target is already running, a task means a correction: stop its current round, resend the correction as a fresh user message, and restart the target (no new goal) |
targets |
Array of targets. Each item may be an index, full title, title fragment, or session id. Required when more than one target is available; omitted with no task, it means "keep waiting on everything still running" |
wait |
all (default) / any (return when the first target reaches a terminal state — complete, failed, or paused; the rest stay running) / none (do not wait) |
reviews |
Review the previous delivery: array of { target, verdict: accepted \| rejected, note? }. Mutually exclusive with task — review and dispatch are separate calls; rejected requires a note. See "After delivery" below |
The call returns a batch: { status, results, stillRunning, note }, where results holds one
{ target, status, deliverable, reply, progress, interruptedBy, note } per target in request
order. Only a deliverable: true reply is a conclusion. Text from running / blocked /
paused / interrupted goes into progress, explicitly marked as a draft that later rounds may
overturn; interruptedBy: "user" means the user stopped the target.
What happens: split new dispatches, continuations and corrections → preflight every new
target's idleness (one busy target rejects the whole new batch) → create a goal on the
target session via goals.create (so it keeps working across rounds instead of replying once) →
wait according to wait → shape the results. A call waits at most 5 minutes at a time and
returns running with progress (deliverable: false); the model calls again with no arguments
to keep waiting. A call that sends task to a running target stops that round, resubmits the
correction as a normal user message and restarts the goal; it returns redirected.
wait: 'none' returns immediately with dispatched (or redirected for a correction) and keeps
a background watcher that records the conclusion. Because a dispatch must not be forgotten, the
owner is nudged once per turn at agent/turn-stopping — injected into the next step, so the same
turn continues one more step and collects the result instead of requiring user input.
On-demand report: report_task
progress is a cheap passive draft. When A suspects the direction is wrong, or is about to
correct / review, it can call report_task and ask the target session's read-only reporter
a specific question:
| Parameter |
Meaning |
targets |
Targets to report on, at most 8; each target gets its own model request, all in parallel |
ask |
What to answer, which evidence to quote, and how to separate facts / self-report / inference / unknown |
The reporter reads the target's model-visible history (session.deriveMessages()), adds the
current goal objective and ask, and makes one independent model request. It is read-only:
it does not interrupt the target, create a goal, touch pending / reviews, or inject anything
into the target; it does not depend on any external side-query plugin or command.
It returns { status, results, note }, with one
{ target, status, report, goalPhase, asOf, truncated, note } per target. A single target times
out after 60 seconds; a timeout or failure only affects that target.
Limits: it only sees the model-visible history (tool output outside the window or never
committed to history is invisible), the report is another model's summary rather than ground
truth, and it does not change dispatch state — it cannot replace dispatch_task for collecting
results or reviews for reviewing.
Stop and wake: control_task
dispatch_task hands work out; control_task stops a task in flight and wakes a paused one. It
only controls — it never dispatches a new task or collects a result.
| Parameter |
Meaning |
action |
stop = abort the current task and pause; resume = wake the paused original goal |
targets |
Targets to control, at most 8; index, full title, title fragment, or session id |
stop:
- the same low-level action as the pane's stop button:
agent.cancel({ kind: 'hook' }) aborts the
current turn, and keepInbox: true keeps the user's queued input;
- the order is
disarm → cancel → wait for the agent to really go idle → pause. Do not pause
first: when goal-round-driver sees a pause while the agent is still running, it cancels with
aborted.user, and A would misread the stop as a user takeover;
- success returns
status: "paused" and closes the ticket as "not delivered"; the goal will not
start another round;
- it waits at most 30 seconds. On timeout it returns
status: "stopping", not paused: the
goal is already disarmed, but the current turn is not confirmed finished; the ticket stays with
the background watcher, and a later stop call can confirm (or collect with dispatch_task).
stopping must not be treated as stopped;
- if the goal finished first, it returns
complete; collect it with dispatch_task;
- it only stops tasks this session dispatched (a
pending ticket, or a goal prefixed with
[任务分派]); it does not kill background processes or subagents the target started.
resume:
- calls
goals.resume on the same goal: no task text is re-sent and no new goal is created;
the target continues from the original objective with its history intact;
- on success it opens a fresh dispatch ticket; use
dispatch_task (no task) to wait for the
result;
- it refuses
complete (collect and review first), blocked (policy stop), user-stopped goals
(ask the user first), goals not created by dispatch, and targets still winding down (the agent
is still running).
Status words: paused / stopping / resumed / running / complete / blocked / failed.
deliverable is always false — control is not delivery.
After delivery: review before the next dispatch
Once a target really delivers (deliverable: true), it enters "awaiting review". Without a
recorded review verdict, the next dispatch to the same target is rejected outright; other
targets are unaffected — the gate is per target, not global.
Review is a separate call with reviews (an array):
| Field |
Meaning |
target |
Target to review: index, title fragment, or session id |
verdict |
accepted or rejected |
note |
Review evidence; required when rejecting — name the missing evidence and what you expect |
accepted clears the pending review and the completed goal; the bar disappears, and the target
can take a new task.
rejected also clears both; follow up with dispatch_task + task carrying the specific gaps
(a correction if the target is still running). A rejection without note is refused.
- Review and dispatch must be separate calls: sending
task together with reviews is rejected.
- Only
complete counts as a delivery; failed / blocked / paused / interrupted do not
require review and do not block the next dispatch.
- The pending-review state is persisted (
~/.dsh/storages/pane_dispatch_reviews.json), so the gate
survives a Host restart. The conclusion itself stays in the target session's history, so A can
still go back and review it; removing the arrow clears the record.
- The completed goal is the final source of truth for review, not just the ledger. The
background watcher writes the review record as soon as the goal turns
complete, instead of
waiting for A to collect the result. If the ledger is lost between delivery and persistence,
reviews backfills it from the completed goal; and before goals.create, a fresh dispatch
checks the target's current goal and refuses to overwrite a completed dispatch goal that has
not been reviewed.
The "Mark reviewed" action on the goal bar
A complete goal is no longer hidden: it stays on the GoalBar as Awaiting Review with a check
icon (tooltip "Mark reviewed"). Clicking it calls the existing goals.clear, and only then does
the goal disappear. It applies to user-created goals and dispatch-created goals alike.
- A model
reviews verdict also clears the completed goal, so the bar disappears.
- If the human clicks first, the goal is already gone; the next dispatch treats that as reviewed
and releases the pending-review record instead of blocking.
- The UI comes from the core patch
patches/dsh-goal-awaiting-review: re-run
./apply-dsh-patches.sh after a DSH upgrade and refresh the browser. No Host restart.
- A refresh/restart does not hide it again: the
complete goal is in the session event log and is
replayed by the projection; the review record is persisted too. If the conclusion was not
collected before a restart, adoptOrphanGoals backfills a review record for the completed goal
so the bar and the dispatch gate agree.
- Boundary: creating a new goal (
/goal or goals.create) replaces a complete goal, which
skips the review. That is existing goal-domain semantics; this plugin does not change it.
Boundaries worth knowing
- Multiple targets run in parallel, each with its own waiter; results come back in request
order. The tool never guesses "probably all of them" — name them when there is more than one.
- Prefer distributing, and results name the idle targets. The tool description makes
delegation the default: when targets are idle and the work splits into independent chunks,
list several targets in one
targets array rather than dispatching one and waiting. The
owner cannot see idleness in the tool description (that would change every round and kill the
prompt cache), so each dispatch/batch result appends the other idle targets — excluding
this batch, targets still running, and targets whose earlier result is uncollected. A sees the
remaining capacity in the same turn instead of stopping after one dispatch.
- Review before the next dispatch. A real delivery puts the target in "awaiting review"; a
new dispatch to it is refused until a verdict is recorded. This is per target, so other idle
targets keep working. Both verdicts clear the state;
rejected requires a note. The state is
persisted to disk and survives a Host restart; removing the arrow clears it.
- One task per target at a time. A
task sent to a running target is a correction, not a
second task: it first disarms automatic continuation, stops the current round (the same
underlying action as the UI stop button: abort the turn, keep the inbox), resubmits the
correction as a normal user message, then resumes the goal — restarting it if the stop paused
it. No new goal is created and the call returns redirected. The cancellation cause is
hook, not user: aborted.user means "the user took over", and a plugin correction must not
masquerade as the user (otherwise A's own watcher would report interrupted). Do not mix
corrections and new dispatches in one call.
- A user stop is reported as
interrupted. A turn/end with aborted.user closes the
dispatch immediately (interruptedBy: "user", deliverable: false) — this covers both a
stopped goal round (goal becomes paused) and a stopped ordinary round (goal stays active
but automatic continuation is disarmed). A may continue with work that does not depend on the
target, but must not correct it behind the user's back.
- Blocked / paused targets stay reusable.
goals.create only replaces a complete goal,
so a blocked or paused one is cleared first (keeping its tombstone and history) and the
result says so.
- Uncollected results are never overwritten. Dispatching again while a result is still
unclaimed is refused with "the previous result has not been collected yet".
- Delivery asks for evidence, A reviews it. The target is told to break the objective into
checkable items, attach evidence to each, and not to declare completion without it; A must
verify against the acceptance criteria and re-dispatch with the specific gaps when it falls
short. This is prompt-level only — completion is still self-assessed by the executor.
- A Host restart does not orphan dispatched work.
pending lives in memory while the goal
lives in DSH's goal service and survives a restart; when the two drift apart, a resume would be
answered with "you never dispatched that" even though the work is done. So before resuming we
reclaim the dispatch by matching the fixed [任务分派] objective prefix: still-running goals
are watched again, finished ones are reported honestly as "the conclusion could not be
recovered, read it in that session". Nothing is persisted for this — the goal is the source of
truth, and a corrupted store file cannot break it. The cost: a goal that finished before the
restart keeps its conclusion only in the session history.
- A restart leaves an active goal
active, but disarmed — not running. DSH only flips the
process-local activation to disarmed; the durable phase stays active and the
goal-round driver will not resume it on its own. The UI calls this state "paused" (that is
phase.active.disarmed). The plugin therefore classifies phase + activation + agent.status:
active + disarmed + idle is paused (stopped after a restart); only active + armed or an
agent that is actually running counts as running. Without this, A waits forever on a
running that will never finish.
Pitfalls we hit while building this
None of these were architecture problems — they were boundary problems, and two of them had
green tests because the fixture was written to match the bug.
| Pitfall |
Symptom |
Root cause |
| Blocked reason rendered as an error code |
users saw round-limit instead of the actual sentence |
blockedReason is { code, message }; the code read explanation, got undefined, and fell back to the code. The fixture copied the wrong field, so nothing failed |
wait: none faked success on old deployments |
returned dispatched while nothing was delivered |
the background watcher needs the goal service; without it the branch did nothing but still reported success |
| A blocking continuation swallowed the conclusion |
the task finished but A got an empty result, permanently |
the watcher has been listening since dispatch; a blocking wait starts "now". When both settled together the code took the latter (possibly empty) and discarded the former |
| State unreadable after a session restart |
a finished goal waited the full 24-hour fallback before being recorded as unknown |
goals.get() validates that the agent is live; the closed-over reference dies with the session, so every read threw and was treated as "not readable yet" |
| Un-dispatchable after a target blocks |
once B was blocked, A could never dispatch again |
goals.create only replaces a complete goal; blocked / paused must be cleared first |
| Conclusion and terminal state split across two windows |
the watcher had the text but could not hand it over |
the watcher used to re-subscribe every 5 minutes; the text arrived in one window and the terminal state in the next. A single long-lived subscription removed it |
| Orphaned results after a Host restart |
the work finished, but resuming answered "you never dispatched that"; the end-of-turn nudge counted the same empty table and stayed silent |
pending lives only in memory, so a restart zeroes it while the target's goal keeps running. Neither side recognises the dispatch any more. Fixed by not persisting it: reclaim on demand from the [任务分派] goal prefix — the goal is the source of truth |
| A new arrow invisible to the owner until reload |
the model could not name the new target until Ctrl+R |
the scoped tool's description was computed as a string at registration time; DSH re-reads definition.description whenever it assembles the prompt, so making it a getter reflects binding changes on the next step |
A sees running forever after a restart |
the target is already stopped and the bar says "paused", but dispatch_task keeps reporting running |
only goal.phase was read; a restart only disarms activation and leaves phase=active. Classifying phase + activation + agent.status fixes it |
| A new dispatch bypassed a pending review |
the bar says "awaiting review", reviews says none, so A dispatched |
the gate only read the review ledger; delivery had not been recorded and a restart cleared pending. The completed goal is now the source of truth: record at delivery, backfill from the goal, and check it before createGoal |
The common thread: the same fact was stored twice without saying which copy is authoritative.
After the fixes the rule is: the background watcher starts at dispatch time, always sees more,
and is authoritative; a blocking wait is only "what this one call happened to see".
Behaviour details
Dispatch FX
When dispatch_task actually starts delivering, the tile board plays a teal-and-gold
effect:
- the source pane's border pulses;
- a small, bright meteor (7 px white core, 120 px gold glow, 96 px two-layer tail) flies
in a straight line from the source pane center to a random point inside each
target pane (20 % inset); no trail line is drawn;
- multiple targets launch serially: the next one starts only after the previous one
lands; about 2.4 s per flight;
- the source and target pane borders flash strongly for 1.2 s (3 px stroke + 56 px glow).
The flash is a separate overlay box, so the pane's own styling cannot hide it;
- on impact the target pane does three things at the same time: its border flashes,
the whole pane shakes, and it is covered by a translucent white flash that fades out
over about 1.2 s, like a small shell hitting the pane;
- if the target pane is not tiled, the point flies to the nearest board edge;
- if the source pane is not tiled, the point enters from the board edge;
- if neither endpoint is tiled, nothing plays;
- if the whole tile board is not on screen, nothing plays;
- under
prefers-reduced-motion: reduce the point is skipped and only the border pulses
remain.
The Host exposes paneDispatch.pullVisual: the queue lives in memory only (last 64
events), is never persisted and never reaches the model. The client polls it every 300 ms;
the first poll only records the watermark, so historical dispatches are not replayed. It is
visual only — delivery, waiting and reviews are unchanged.
- Opening the board for the first time seeds it: the workspace containing the current session
comes first, and another one is added, so it opens as two panes side by side rather than an
empty area.
- How a pane decides which session to show:
- Following panes (those spread out by
Add workspace) follow that workspace's most
recently updated real conversation;
- once a session is chosen manually (or a new one is created), the pane is pinned to that
session;
- A freshly split pane starts empty and prompts "Pick an existing session for this
pane, or start a new one" — so two panes will not inexplicably show the same
conversation. Which workspace it shows is what the split menu's second step selected.
- Blank sessions never enter the list: a session that exists but has never been sent a
message (
blank: true on the Host) does not appear in the Switch session menu and is not
followed as a workspace's "latest session" — otherwise a few stray clicks on New session
would pile up a row of identically named "New session" entries. This follows the same idea
as the native DSH sidebar ("only the currently selected blank session is visible"), just
taken further: the menu's first item already is New session, so a placeholder row adds
nothing. The one exception is Design mode's left-hand session picker: blank sessions are
listed there (and can be wired into the graph) because "create the target first, wire it,
then dispatch work into it" is a real workflow; a blank node is also kept when the graph is
saved and restored.
New session reuses a blank session first: when this workspace already has a blank
session that no other pane is pinned to, the pane switches to it right away (still applying
the pane's staged mode) instead of asking the Host to create another empty record; only when
there is nothing to reuse does it really create one. So repeated clicks on New session
return to the same empty session instead of leaving a trail of unused shells in the Host's
session table and on disk.
- The candidates in the split menu's second step: it lists all workspaces, but those
not yet tiled come first (the primary intent of splitting is to spread another workspace
out), while those already tiled in other panes come later with the hint on the right
changed to
open (the rest show the path). Keeping already-tiled workspaces is
deliberate: opening the same workspace in two panes to see two sessions is a legitimate
use, and after all workspaces are tiled there is still some workspace left to choose for
splitting. The Back row shows the currently selected direction on its right, so the
second step also shows which way this split is going.
Replace workspace uses workspaceCandidates (all workspaces, sidebar order, with an
open flag), while the panel's Add workspace keeps unopenedWorkspaces (only the
not-yet-tiled ones). They are deliberately no longer the same list: replace must support
"another session of the same workspace", so already-tiled workspaces must appear; adding a
workspace to the board has no reason to add one that is already there. When no workspace
exists at all, the first step still says "no workspaces yet". After choosing a workspace,
the second step's first row is always New session; choosing an existing session calls
replaceWorkspaceWithSession, which swaps workspace and session in one publish (with no
flash of the new workspace's latest session). To exchange two panes' places, use the
title-bar drag; it does not reopen conversations.
New workspace… in the second step: it is present even when no workspace has ever been
registered, so the board can still grow its first pane. Clicking it opens the folder picker,
and the chosen directory is registered as a workspace and switched into the new pane
directly; if the user cancels, nothing happens, and if the picker itself cannot be opened
the pane states "The folder chooser could not open" rather than a vague add failure. The
direction is captured into a local variable before the menu closes — closing the menu
resets splitDirection, so by the time the picker returns it can no longer be read.
- The split menu is a controlled popup menu (the
Popover's open + onOpenChange):
only this way can it be reset from the outside. Picking a direction, choosing a workspace,
clicking elsewhere, pressing Esc — any of these closes it and resets the menu back to the
first step, otherwise the next time it opens it would be stuck on the previously chosen
direction. The offline tests have one assertion each for the two paths "after choosing a
workspace" and "after closing by clicking elsewhere".
- Each pane separately holds a
ctx.sessions.retain(..., { source: 'splitWorkspaces' })
reference, so the sidebar's main selection is unaffected and multiple sessions can be open
at the same time.
- Dragging to swap positions does not reopen sessions: what is swapped is the key of two
leaves in the layout tree, while the pane records (workspace, session reference,
preselected mode) do not change a single field, so the
useSessionReference effect of
either pane does not re-run even once — as long as the reference is not released, the
conversation's history and local state stay entirely intact. This path only holds for
splits at the same level (React only moves things by key between sibling nodes); a
cross-level swap still rebuilds those two subtrees, see pitfall 6.
- The pane list and layout tree are kept in the plugin (not in React state), so switching
back to the Conversation panel and back again does not lose them; only a page refresh
resets them.
- Mode selection is per pane: while the session is still blank the selection takes effect
immediately (
remote.agentPresets.select); once the session has run a turn the Host
refuses to change the label, so the selection is stashed, marked next session in the
menu, and applied the next time that pane creates a new session. The reason for the
refusal is shown on the pane and does not affect session creation.
- A deployment with no preset registry attached gets
gateway/invocation-unavailable; the
board keeps working as usual in that case, it simply does not show the mode selector.
Add workspace does not casually create a session, nor does it switch the main panel away.
- The scope of the focus keys is "this panel is on screen", not "focus is inside a pane":
the listener is attached at the document's capture phase, and when the panel is not shown
(the board root node's marker is absent) it does nothing at all, so cases like having
clicked the board's empty area or having just switched over with the sidebar icon — where
focus sits on
body / the sidebar — still work. This one was reported back by a user from
real testing, see pitfall 4 below. When an overlay (menu / dialog) covers the board, or
when focus is in an input box outside the board, everything is let through: those keys
belong to someone else (the key recording in "Settings → Shortcuts" happens inside an
overlay). After switching, the keyboard caret follows into the target pane's input box;
when the target pane has no session yet and no editable input box, only the highlight
switches and the caret is not stolen from the previous pane.
- Caret ownership when the mouse lights up a pane: handing over the caret is attached to
click (not pointerdown), and two kinds of landing points are given up — landing
points that are controls (buttons / links / menu items / input boxes / editable areas), and
the case where the user has just drag-selected a piece of text (the selection is not
collapsed). The former is so as not to interrupt "the user is operating that control", the
latter because focus() measurably wipes that selection out entirely. Both were measured
in a real browser, see pitfall 5. Tab-ing into a pane only switches the highlight and
does not move the caret: Tab's landing point is the browser's territory, and the title-bar
buttons and the other focusable elements in the conversation area must all remain
Tab-reachable.
The six pitfalls we hit (read this before changing this code)
-
Focus used the wrong colour token. --dsw-alias-brand-primary is a near-white
neutral fill in the dark theme (--dsw-static-neutral-bluish-50); using it as the
focused title bar's background together with white text gives white on white. The blue
accent colour is --dsw-alias-brand-primary-new-colorprimary-new-color (light #4176e6 /
dark #5686fe), with the static --dsw-static-deepseek-500 as fallback — do not fall
back to that neutral fill. Two assertions in the offline tests guard this. In addition,
white text directly on the pure accent colour is only 3.3:1, so both ends of the gradient
must be mixed with black to deepen the blue.
-
Optional children in the title bar must carry a key. React matches sibling nodes
without keys by position: once a child that "sometimes exists and sometimes does not" —
such as the focus marker or the mode selector — appears/disappears, the positions shift,
and React reuses the very button the user just pressed the mouse on as a different
control, so the click lands on the wrong handler. The real symptom was "clicking Split down turns into Split right". Now the title bar, the error line and the conversation
body all carry fixed keys, and the offline tests check "all keys present and unique" and
"the title bar structure is exactly identical before and after a focus switch".
-
Why the focus keys are Alt, and why they must be attached at the capture phase. This
group of keys has to work inside the input box too, and Chromium's contenteditable has
already taken all the common arrow-key combinations: Shift+←/→ selects character by
character, Shift+↑/↓ selects line by line, Ctrl+←/→ moves the caret word by word,
Ctrl+↑/↓ jumps to the start/end of a paragraph, Ctrl+Shift+←/→ selects word by word.
So Shift or Ctrl alone combined with an arrow key would kill a high-frequency operation
inside the input box. Ctrl+Alt+arrow keys looks like a way out, but in practice the
desktop environment has taken it (GNOME/Unity's
switch-to-workspace-{left,right,up,down} is exactly Ctrl+Alt+arrow keys, eaten at the
window manager level so the page never receives it). Only Alt+arrow keys has no
native meaning inside the input box and is not taken by the desktop, at the smallest
cost; its only entanglement is Alt+←/→ forward/back in the browser — which is why the
handling must be attached at the capture phase and call preventDefault() (plus
stopPropagation(), so the input box does not treat it as a caret operation a second
time). AltGraph (which on some layouts equals Ctrl+Alt) and an in-progress IME
composition are always let through, never stealing keys from the input method.
-
The keyboard handling cannot be attached to the board node. The first version attached
it to the board root node's onKeyDownCapture, on the grounds that "only the capture
phase can get the event before the input box does" — which is true, but it also hid a
wrong assumption: that the event target is always inside the board. In practice, after
clicking the board's empty space focus lands on document.body, and when you have just
switched over with the sidebar icon focus is still on the sidebar button; in both cases
the event does not flow through the board node (synthetic events are dispatched only along
the target's ancestor chain), so none of the keys responded — what the user saw was "the
Alt+arrow keys only work when focus is inside the input box". Now the listener is
attached at the capture phase on document (still earlier than the input box), and it
uses the board root node's marker to tell whether the panel is on screen: the main panel
is rendered by key, so when you switch to another panel the board unmounts and the marker
disappears with it, and the handling naturally stops working without any extra
bookkeeping.
-
"Lighting up a pane hands over the caret" involves two behaviours only a real browser
can answer. The offline tests' fake document cannot emulate the browser's default
actions; these three were all measured with headless Chrome + CDP trusted mouse
input (node tools/browser-probe.mjs re-runs the first two one by one; it does not need
a DSH service):
- It cannot be attached to
pointerdown: when single-clicking a non-focusable element
(a message paragraph is one), the default action of mousedown wipes the current focus
to body — a caret produced by calling focus() inside pointerdown is erased by that
very step right afterwards. Only attaching to click keeps it (click has no default
action that changes focus afterwards).
- It cannot focus unconditionally: calling
focus() on a contenteditable inside
click wipes out entirely a selection that was just dragged out (measured: the
selection goes from ectable text here straight to empty and collapsed). That amounts
to abolishing "select a message and copy it", so as long as the selection is not
collapsed, nothing is touched. On a single click, the earlier mousedown has already
cleared the old selection, so it will not be permanently broken because a stale
selection happens to be left somewhere on the page.
- Closing a pane waits one frame: the pane that takes over focus was originally nested
in the split level that got collapsed, and after the layout tree collapses React cannot
find the original subtree by key and can only rebuild it — focusing immediately would
only focus an old input box that is about to be thrown away, and the caret would be gone
as soon as the reflow finishes. Waiting one frame (
requestAnimationFrame, falling back
to setTimeout in environments without it) before focusing lands it on the input box
that really exists and will keep existing.
-
Swapping two panes' positions can only be done by "swapping keys", and React only moves
things between sibling nodes. Three implementations of the same effect existed, and only
the third is correct:
- Swapping the workspaces / sessions in the two pane records: both sides'
useSessionReference effects re-run, and DSH's session-reference contract is "the last
release tears down the session's local scope and history" — both conversations get
reopened for nothing.
- Swapping whole leaves in the layout tree: structural sharing breaks down and the
whole path is rebuilt, so React cannot find the original subtree by key and can only
unmount and rebuild it — likewise reopening for nothing.
- Swapping only the
key of two leaves in the layout tree (the model's swapLeaves,
the store layer's swapPanes): the split levels and ratios and the pane records do not
change a single field. So in React's eyes this is merely "two siblings at the same level
exchanged keys", and it moves those two subtrees as a whole, without releasing the
session references even once.
The third also depends on one precondition: a leaf pane must be a direct child of the
split div. Originally each child also had a placeholder div wrapped around it (the ratio
was written on it), and React's key matching only happens under the same parent node — one
level in between and it cannot match, so the swap silently degrades into a rebuild. Now
the ratio is written on the pane's own flexGrow and the placeholder div is kept only for
the subtree.
A cross-level swap (when the two parties are not in the same split level) is still a
rebuild. Swapping A and C in A | (B/C), React cannot move a subtree under a different
parent node and can only unmount and rebuild; measured, that pane flashes "Opening
session…" (for small local sessions headless Chrome measured 50~245 ms across several
runs, three to fifteen-odd frames), and the pane's scroll position and expanded tool
output are also reset. A same-level swap (any two panes at the same level or adjacent
levels) has none of these costs — which is the precondition for daring to offer
"drag to swap positions"; the real-browser probe measures the two cases separately and
reports them honestly: node tools/swap-probe.mjs. If one day the cross-level swap should
also be spared this, the session reference's lifecycle would have to change (a
reference to the same session shared among several panes, with the last release deferred
by one task so that the unmount + remount within the same reflow cancel out), and the
loss of scroll and expanded state caused by the rebuild itself would still be unavoidable
— the cost is not small and the gain is only a few dozen milliseconds, so it is left
undone for now.
Per-pane content tint
Each pane's conversation area gets a translucent, tinted gradient so the panes are easy to
tell apart at a glance:
- The colour follows the session: it is derived from the session id, so a refresh, a
restored layout, or dragging panes around never changes which colour belongs to which
conversation. Empty panes use the workspace id.
- No repeats on one screen: if a pane's preferred colour is taken, it walks the palette
to the next free slot; with more than eight panes colours are reused.
- Content area only: the title bar, view tabs and borders keep the regular sci-fi look.
The gradient is painted on
.dshSplitWs_paneBody; the conversation root keeps a 44% dark
veil so the colour reads as tinted glass rather than a flat block.
- Text stays legible: the tint only appears in background gradients, and tertiary text is
lifted from
#6f8aa0 to #839db2. At each colour's brightest point the contrast is at
least 10.6:1 for body text, 6.2:1 for secondary text and 4.6:1 for tertiary text (WCAG AA).
test/tint-contract.mjs checks every colour.
Font and message reveal
- The tile panel's header, buttons and menus use ZCOOL KuaiLe; conversation
bodies keep the system font (both the main view and the tile panel), as do the sidebar
and settings. The files live in
fonts/ (SIL OFL 1.1, license text in fonts/OFL.txt)
and are served by the Host half at /split-workspaces-fonts. If the font is unavailable
— no system install and no font route — it falls back through Noto Sans CJK SC /
Noto Sans SC / PingFang SC / Microsoft YaHei / the system default.
- Chinese and full-width punctuation use a 710 KB simplified-Chinese subset; Latin letters,
digits and half-width punctuation use a 5 KB Latin subset, split by
unicode-range.
Code blocks keep the monospace font.
- Line-by-line body reveal: in every conversation (main view and tile panel), only the
assistant body (
assistant-step, excluding the reasoning process) is animated. Each
Markdown block — paragraph, list item, heading, quote, code block, table — fades in and
rises 6 px over 2 s. Soft wraps inside one paragraph remain one block (a CSS animation
cannot split browser-laid-out lines). User messages, tool-call rows and reasoning steps
stay static; streaming reuses existing blocks, so only new blocks reveal.
- The animation is disabled under
prefers-reduced-motion: reduce.
Files
The source is split into several files by responsibility (all far under 800 lines). DSH's
browser module system supports in-package code blocks: the entry requests files in the
same directory with require.async('./client.xxx.js'), and the host serves them at
/plugins/<package name>/client.xxx.js?rev=<version>, so the entry does not have to carry
the whole implementation.
client.js — entry: loads the code blocks (styles / dictionaries / model / layout / presets /
conversation views / menu / pane / view), registers the slot, injects the styles, registers Alt+arrow keys as
the framework's fixed shortcut and installs its keyboard handling on the document; it also
provides openWorkspaceDirectory(path) (going through
remote.session.openWorkspacePath) for the pane's "Open directory" button, and
requestSessionDelete(sessionId, displayTitle) — it lazily resolves dsh-session-delete's
sessionDeleteUi service, hands "delete this row" to that plugin's confirmation dialog,
and on success releases every pane pinned to that session with
paneStore.forgetSession.
client.fx.js — dispatch FX: source/target pane pulses, a bezier light point with a
trail, staggered multi-target launches; falls back to the board edge when a pane is not
tiled, and refuses to play when the whole board is off screen.
client.view.js — board layer: Splitter (the splitter bar),
SplitPanel (renders panes and splitters from the layout tree, the panel's
top actions, and the "on screen" marker on the board root node), installPaneKeys (the
document-level Alt+arrow keys handling, delegating focus to the pane block's
focusPaneInput).
client.views.js — the per-pane conversation view strip: reads the registered
conversation.view entries (Chat / Git, always skipping trajectory), passes the selected
view id as the owner prop of the shared conversation.content Factory, and renders no strip
at all when no extra view plugin is installed (behaviour identical to before).
client.layout.js — pure save/restore logic for the board: serializes only the current
panel mode's part (board or dispatch graph, carrying the other part's last save; the panel
mode is not stored); on restore it validates workspaces (id → path fallback), sessions, and
presets, prunes invalid layout branches and dead graph edges, and treats corrupt
JSON/version as "never saved".
client.pane.js — pane layer: PaneFrame (workspace title, the open-directory button,
the replace-workspace icon — its menu contents and the New workspace… path — split
menu, mode, session (every row ends with a delete button), close) and the session
reference it holds; the drag-to-swap on
the title bar (pointer down grabs → the drag starts only past the threshold → hit testing
finds the drop target → release swaps positions, plus "the click that just finished
dragging no longer steals the caret"); plus the whole set of decisions for "lighting up a
pane hands over the caret" (excluding controls, giving way to a selection, waiting one
frame on pane close) and focusPaneInput (the Alt+arrow keys path uses it too).
client.menu.js — menu parts: Popover (including the controlled open switch),
MenuItem, MenuDeleteButton (the icon button at the end of a menu row: it sits beside
a MenuItem, never inside it, because a MenuItem is itself a <button> and a button
inside a button is invalid HTML), and the svg icons used in various places (the tile icon,
the split icon, the folder icon, the replace icon, the check mark, the trash can, the
arrows).
client.model.js — the pure model: the layout tree (split, collapse, balance, ratio
clamping, swapping the key of two leaves), pane geometry (layoutRects converts
the layout tree into rectangles, neighborPane finds the neighbour at "the corresponding
position" by rectangle), the pane store (including replaceWorkspace /
replaceWorkspaceWithSession, swapPanes and forgetSession — releasing every pane
pinned to a session id in one step), the drag threshold, the "which session should be
shown" decision, the candidate workspaces for the split menu's second step
(splitCandidates), the replace menu's all workspaces (workspaceCandidates), and the
"not tiled yet" list used by the panel's add menu (unopenedWorkspaces); it does not
depend on React and can be tested directly in Node.
client.presets.js — Agent modes: read the Host roster, apply a mode, share a snapshot.
client.mcp.js — the per-workspace MCP switch: read the Host roster, write the selection,
share a snapshot (optimistic update with rollback; the remote namespace belongs to another
package, so it can only be resolved lazily).
client.styles.js — the stylesheet and class names; colours only use theme tokens
(--dsw-*). The tile panel's translucent gradient, the ZCOOL KuaiLe font for every
conversation and the message-reveal animation also live here (appended sci-fi section).
client.dicts.js — Chinese and English strings.
index.js — the Host entry: mounts the paneDispatch service and the dispatch_task /
report_task / control_task tools, owns their lifecycle, serves the bundled fonts at
/split-workspaces-fonts, and re-exports the public symbols. The implementation
lives in sibling host.*.js modules:
host.constants.js — service key, remote method list, timeouts and size limits;
host.store.js — binding-table persistence (the only constructor of the target shape);
host.layout.js — layout persistence at $DSH_HOME/storages/pane_layout.json, with
atomic temp-file + rename and a 1 MB guard; independent of the browser origin so a
desktop restart on a new port still finds the saved layout;
host.service.js — PaneDispatchService (bindings, dispatch state, diagnostics);
host.goal-state.js — target-state classification: phase + activation + agent.status →
running / complete / paused / blocked / cleared; shared by adoption, the watcher, and waiting;
host.goal-create.js — pre-create checks: complete can be replaced directly; blocked /
paused / active+disarmed+idle are cleared first; active+armed or a running agent is busy;
host.reviews.js — the review gate: release after a human review, record reviews, and
backfill from a completed goal;
host.report.js — the read-only report_task side request: history selection, report prompt,
per-target timeout, and parallel fan-out;
host.control.js — stop and wake: the disarm → cancel(hook) → wait for real idle → pause
order, stopping on timeout, and resuming the original goal with a fresh ticket;
host.message.js — pure helpers (task wrapping, target matching, assistant text);
host.wait.js — delivery and waiting (goal mode / plain delivery, cancellation wiring);
host.batch.js — batch scheduling: preflight, concurrent waiting, all/any/none
completion, the pre-create review gate, honest partial failures;
host.redirect.js — turns an A correction into "stop the current round, resubmit it as a
normal user message, restart the goal" (the same underlying stop as the UI button, but with
a hook cancellation cause; no new goal);
host.watch.js — what happens after dispatch: the background watcher behind wait: none
(one long-lived subscription) and adoptOrphanGoals, which reclaims dispatched-but-lost
work after a Host restart by matching the goal objective prefix;
host.tool.js — the model-facing dispatch_task / report_task descriptions and execution;
host.tool.control.js — the model-facing control_task description and execution
(stop / resume validation and result shaping).
REVIEW-2026-11-01.md / REVIEW-2026-11-03.md — the two code-review reports.
test/dispatch-harness.mjs — shared fixtures for the dispatch tests.
test/dispatch-contract.mjs / test/dispatch-batch-contract.mjs — the Host-side contract
tests for single-target delivery, batching, wait: none, the background watcher, the
end-of-turn nudge, and the correction flow (stop the current round, resubmit as a normal user
message, restart a paused/disarmed goal). The review-gate regression covers a completed goal
whose ledger was lost before persistence: a new dispatch is blocked by the goal, and reviews
can still backfill the record from it.
test/dispatch-restart-contract.mjs — the cross-process contract: a Host restart must not
orphan dispatched work; active + disarmed + idle must be reported as paused, and concurrent
reclaim calls must share one in-flight adoption instead of one returning zero.
test/report-contract.mjs — the report_task contract: at most 8 targets, 8 targets actually
run in parallel, one target's failure/timeout leaves the others intact, the request carries the
ask and goal objective, the tool is read-only, truncated history is flagged, a missing LLM
service fails per target, and the implementation does not reference an external side-query
plugin.
test/control-contract.mjs — the control_task contract: stop running / idle / timed-out /
already-complete / cross-owner targets, the hook cancellation and "wait for idle before
pause" order; wake paused and active+disarmed, refuse complete / blocked /
user-stopped / non-dispatch goals / still-winding-down targets; and a batch with one
unconfirmed target reports stopping at the top level.
cordis.patch.yml — inserts the single Host row.
locale/{en,zh}.json — the display name and description on the plugin management page.
test/harness.mjs — the offline test harness: simulates the browser module loader
(including the require.async code-block rules), a React stand-in, and Context stand-ins
(including records of ctx.inject and registerFixed).
client.dispatch.js — turns the arrows drawn in design mode into bindings and pushes only
the changed owners to the Host (a hand-written remote descriptor, same pattern as
dsh-mcp-workspace-policy).
client.graph.model.js — the pure model: the four edge checks, layered layout, drop
resolution, and the graph → bindings conversion. No React, so it runs under Node.
client.graph.view.js — design mode: the collapsible workspace/session picker that drags
cards onto the canvas, plus cards, bezier arrows, drag-to-connect and delete buttons.
client.skill.js — the per-workspace SKILL switch: same shape as the MCP block, but its items
come from scanning the skill directory and every row carries a description; empty / missing /
broken directory each get their own message.
test/board.mjs — the shared test bench for the contract tests: assertion records
(check / report), installing the plugin as a "board with two panes", colour contrast
(WCAG), and small helpers for finding panes and menus in the render output.
test/layout-contract.mjs — offline contract tests for tiling / focus highlight / the
two-step split menu (including New workspace…) / replace workspace (two-level menu:
all workspaces including already-tiled ones, the first session row is New session,
choosing an existing session swaps workspace and session atomically, choosing a new session
in another workspace reuses a blank or creates one, closing returns to step 1; the store
changes only that pane, the layout tree and the other panes are the same objects; both the
New workspace… path and picker failures) (node test/layout-contract.mjs).
fonts/ — the ZCOOL KuaiLe simplified-Chinese subset (710 KB) and Latin subset (5 KB),
served by the Host's /split-workspaces-fonts prefix route (not a browser code block).
test/font-contract.mjs — the font route and message-reveal contract
(node test/font-contract.mjs): the route serves only the two whitelisted files, and its
GET / HEAD / unknown-name / path-traversal / wrong-method answers; plus the client's two
@font-face URLs, font scope, monospace code blocks and the reveal-animation selector.
test/tint-contract.mjs — the per-pane content tint contract
(node test/tint-contract.mjs): colours follow sessions across reorders and restores, no
two panes repeat on one screen, every palette colour passes WCAG AA for body / secondary /
tertiary text, only the content area is tinted, and the rendered pane root actually carries
--dshSplitWs-pane-tint.
test/views-contract.mjs — offline contract tests for the per-pane view strip
(node test/views-contract.mjs): zero views / Chat-only leaves the old behaviour untouched,
the strip appears and switches, blank sessions hide it, a vanished view falls back to Chat,
and Trajectory never appears in a pane.
test/drag-contract.mjs — offline contract tests for the two kinds of dragging
(node test/drag-contract.mjs): resizing with a splitter (including keyboard fine-tuning
and double-click balance), and the whole chain of drag-to-swap on the title bar. The
latter replaces only two browser-specific answers (elementFromPoint and querySelector)
with a fake document; everything else is the real implementation (threshold, hit testing,
drag visual markers, swap on release, the one-frame wait for the caret after a swap,
cleanup on pointer cancel), and it specifically asserts that not a single field of the
pane records changed — the gatekeeper for "a swap does not reopen conversations".
test/focus-contract.mjs — offline contract tests for pane geometry, the neighbour
decision and keyboard path of Alt+arrow keys, fixed-shortcut registration, and caret
ownership when lighting up a pane (clicking a control does not steal it, clicking content
hands it over, a drag-selection is given way to, closing a pane waits one frame)
(node test/focus-contract.mjs).
test/save-contract.mjs — offline contract tests for layout save/restore
(node test/save-contract.mjs): serialization, scoped saving (tile-only layout /
graph-only dispatch, each carrying the other part's last save), missing
sessions/workspaces/presets, layout pruning and focus fallback, corrupt JSON/version,
graph sanitizing (missing nodes, self-edges, cycles, multiple parents), Host
persistence/read-back, and automatic restore of the board and graph in tile mode when
the panel mounts.
test/host-layout-contract.mjs — offline contract tests for the Host layout file
(node test/host-layout-contract.mjs): missing file, atomic save/read-back, storage path,
and invalid root rejection.
test/preset-contract.mjs — offline contract tests for the mode selector
(node test/preset-contract.mjs).
test/fx-contract.mjs — the dispatch-FX contract (node test/fx-contract.mjs): the
Host visual-event queue's delta, watermark and capacity, "record only real dispatches",
plus the bezier path, pane edge points, board edge points and client polling wiring.
test/graph-contract.mjs — offline contract tests for the delegation graph
(node test/graph-contract.mjs): the pure model's three layers, the paneDispatch namespace
and codec shape, the binding-sync diff, and the really rendered mode switch / cards / arrows.
test/skill-contract.mjs — offline contract tests for the SKILL switch
(node test/skill-contract.mjs): two deliberate product decisions — the button is absent when
the skill service is not mounted, and an empty directory gets a pointer to where skills live
instead of a blank popover — plus every row carrying a description.
test/mcp-contract.mjs — offline contract tests for the MCP switches
(node test/mcp-contract.mjs): the degraded branch, the optimistic update and its
rollback, and the checkbox state and per-workspace write-back on the really rendered
pane title bar.
test/open-contract.mjs — offline contract tests for "opening the workspace directory with
the file manager" (node test/open-contract.mjs): remote.session is replaced by a
recording stand-in, so what is asserted are the calls the plugin really makes — first
asking canOpenWorkspacePath (only once), then handing that pane's path to
openWorkspacePath in the shape { path }; and what each of the five failures (no session
service, no graphical environment, the path fails validation, the open command fails, the
connection dropped) actually says. The button's own structure, key, position and "disabled
when the workspace is unknown" are here too.
test/delete-contract.mjs — offline contract tests for deleting row by row in the
Switch session dropdown (node test/delete-contract.mjs): one delete button per row, the
two buttons side by side rather than nested, the button's label carrying that row's
session name, a click closing the menu and handing sessionId / displayTitle to
sessionDeleteUi (a stand-in lives in ctx.get, so the real lazy-resolution path is
exercised), a click alone not touching pane state, the pane's error line spelling out "the
delete service is missing" when it is, and forgetSession releasing every pane pinned
to the deleted session.
test/menu-contract.mjs — offline contract test for title-bar popup menus
(node test/menu-contract.mjs): the menu is portaled into document.body and uses fixed
positioning, so the pane's overflow:hidden can no longer clip it; the width fallback
shrinks with the viewport.
tools/browser-probe.mjs — a real-browser probe (requires a local google-chrome): it
uses CDP trusted mouse input to measure, one by one, the browser default behaviours that
"caret ownership" depends on, see pitfall 5. It is not part of the offline tests (those
remain dependency-free); run it by hand before changing this code
(node tools/browser-probe.mjs).
tools/replace-probe.mjs — a real-browser probe: on its own separate dsh web
(it does not touch the window you have open) it clicks through "Replace workspace" and
measures what the offline tests cannot answer — the icon button really opens the menu, the
first level really lists all workspaces (the current one marked open), the second level's
first row is New session, and after picking an existing session the pane is still in
place (neither its rectangle nor its DOM node changed, meaning the contents were replaced
rather than the pane closed and reopened) — and leaves screenshots of the open menu and of
the result (node tools/replace-probe.mjs, about a minute;
DSH_REPLACE_PROBE_URL reuses a running service).
tools/swap-probe.mjs — a real-browser probe: it starts its own separate dsh web
(without touching the window you have open) plus a headless Chrome, and really drags twice
with trusted mouse input to measure three things the offline tests cannot answer — that
hit testing stays accurate when the pointer is over another pane, that the swap exchanges
"positions" (the rectangles exactly swap), and whether the subtrees are moved or
rebuilt (tag the pane and its input box before the drag; if the tags are still there
after the swap, they were moved; a cross-level swap is honestly reported as a rebuild, see
pitfall 6). Along the way it captures the in-drag feedback as PNGs and prints the paths
(node tools/swap-probe.mjs, about two minutes; set DSH_SWAP_PROBE_URL to reuse an
already running service).
Local development
The profile points at this directory with link:, and dsh-client-hmr polls the entry
client.js every 500 ms (mtime / ctime / size), so changing the entry reloads the browser
plugin automatically within about a second, with no build step.
Note: HMR only watches the entry file, while code-block URLs carry "a version derived from
the entry file's mtime / ctime / size", so *after changing a code block (`client..js) you must also touch the entry** (for exampletouch client.js`, or edit a line of comments),
otherwise the browser will neither reload nor drop the cached old version:
touch client.js
The Host half uses a different mechanism: the profile also installs dsh-dev-hmr, which
watches the whole plugin source tree, so saving index.js or any host.*.js hot-reloads the
Host plugin in the same process — no dsh web restart. A restart is only needed when the
package.json dependency graph changes or a new package is added.
When changing behaviour, also run every offline test (dependency-free, on the order of
seconds):
node test/layout-contract.mjs
node test/views-contract.mjs
node test/tint-contract.mjs
node test/font-contract.mjs
node test/save-contract.mjs
node test/host-layout-contract.mjs
node test/drag-contract.mjs
node test/focus-contract.mjs
node test/preset-contract.mjs
node test/open-contract.mjs
node test/mcp-contract.mjs
node test/delete-contract.mjs
node test/menu-contract.mjs
node test/skill-contract.mjs
node test/fx-contract.mjs
node test/graph-contract.mjs
node test/dispatch-contract.mjs
node test/dispatch-batch-contract.mjs
node test/dispatch-restart-contract.mjs
node test/report-contract.mjs
node test/control-contract.mjs
When you touch the "caret ownership" part, additionally run the real-browser probe (requires
google-chrome, about ten seconds):
node tools/browser-probe.mjs
When you touch the "replace workspace" part, run the third real-browser probe (also requires
google-chrome and dsh, about a minute; DSH_REPLACE_PROBE_URL reuses a running service):
node tools/replace-probe.mjs
When you touch the "drag to swap positions" part, run the other real-browser probe (requires
google-chrome and dsh; it starts its own separate web service, about two minutes):
node tools/swap-probe.mjs # start its own service
DSH_SWAP_PROBE_URL='http://127.0.0.1:PORT/?token=…' \
node tools/swap-probe.mjs # or reuse an already running service
To see this behaviour on a real page, you can click through it with another headless
client (it does not affect the window you have open): dsh web --no-open --port 0 prints a
URL with a token; hand it to headless Chrome, then ① switch to the tiled panel ② click the
workspace name in some pane's title bar → the caret should enter that pane's input box
③ click the "Split" button in a title bar → focus should stay on the button and not enter the
input box ④ drag-select a piece of text inside a pane → the selection must still be there
(meaning the guard gave way to the selection) ⑤ click the current pane's close button → the
pane that takes its place should take over the caret on the next frame ⑥ press and hold some
pane's title bar, drag it onto another pane and release → the two panes swap positions and
neither conversation is reopened (look before and after at whether the messages in the
panes are still there and whether "Opening session…" flashes) ⑦ with a spare workspace
available, click the "Replace workspace" icon on one pane's title bar → the first step is
New workspace… plus all workspaces (tiled ones are marked open); pick a workspace → the
second step's first row is New session, followed by its sessions; pick an existing session →
that pane's place and size do not change, only what is inside becomes that session's
conversation (the old conversation is gone and leaves nothing behind), and not a pixel of the
other panes moves.
License
This project is released under the MIT License. See LICENSE for details.