rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:icrefin/dsh-session-monitor
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
DeepSeek Harness shows one conversation at a time. While several sessions work in parallel, the sidebar tells you that a session is running or waiting — the question itself, the turn it is in, and the message it wants to send stay behind its own row. This plugin adds Session Monitor to the left sidebar, directly under Plugins, and opens a grid with one card per active or recently used session:
┌ Session Monitor ─────────────────┬ Session Monitor ─────────────────┐
│ ● dsh-plugins · working · 2m │ ● release notes · waiting · 4m │
│ you Add a --dry-run flag… │ ┌ This session is asking you ┐ │
│ bash command=pnpm test │ │ Which branch should ship? │ │
│ … │ │ ( ) main ( ) next │ │
│ [Message this session…] [Send] │ └───────────────────────────┘ │
└──────────────────────────────────┴──────────────────────────────────┘
Each card carries, for a session you are not viewing:
cancel();ctx.uiWorkspace.openSession(id)); a composition without
the navigation service keeps the title as a plain heading;done label; clicking anywhere on the card clears it back to the grey
idle dot, and the next run lights it again;/model use);tokenUsage and
contextPressure projections the native composer footer uses;The toolbar also starts sessions: a New Session button with a Workspace drop-down beside it. Pick where the session belongs, click the button, and its card appears while the monitor stays open and no other card moves: with room it joins at the end, and on a full grid it takes the oldest card's slot. The drop-down's last row, Choose a folder…, opens the host's folder chooser and adopts the picked directory as a new Workspace first, so you can start a session in a folder the sidebar does not list yet. The chosen Workspace is remembered in this browser.
This directory carries a HANDOFF.md: current state, the architecture and its exact data sources, the liveness heuristics, what was verified, what was not, pitfalls, and the next steps. Read it before changing behaviour.
localStorage.
After that, a prompt, a new turn or a state change updates a card's content but
never its position — a session that becomes the most recently active does not
jump to the front, and leaving the panel or restarting the app resumes the same
cells instead of re-seeding them. A card keeps its position until it is the
oldest card and a new session needs that slot: the newcomer takes that exact
cell and the displaced card waits at the order's tail. A session that appears
later joins at the end while there is room. A waiting card is never displaced. A
session created by this toolbar follows the same rule, so starting one never
reshuffles the page.localStorage
(dsh-session-monitor:prefs). A removed session keeps running, keeps its
history and stays in the sidebar; only this grid forgets it. The toolbar's
Restore removed button brings every one of them back.ctx.sessions.create({ workspaceId }) and keeps the monitor open: the Host
returns the new session id, the page records it as a spawned blank, and the
next reconcile places its card — at the end while there is room, or in the
oldest card's slot on a full grid. The card is titled "New Session" and carries
the normal composer, so the first prompt is typed there. The drop-down defaults to the Workspace of the most recently used
session, and the Workspace you last chose is remembered in localStorage
beside the removed ids. Choose a folder… is a row of that same drop-down: it
calls the host's folder chooser, adopts the directory as a Workspace
(ctx.workspaces.create({ path })) and creates the session there. A cancelled
chooser changes nothing, and a refused start is reported in the toolbar with the
host's own message. A composition with no session-creation verb renders no
new-session control at all, and the folder row is absent when no folder chooser
is composed.ctx.sessions.retain()) while it is mounted and releases it on unmount, so the
grid opens exactly as many history streams as it shows cards, and leaving the
panel closes all of them.The plugin is browser-only in behaviour. It registers one sidebar row, one main
panel, and two locale dictionaries — no host route, no tool, no event listener —
because every fact it needs already exists in the client:
| Fact | Source |
|---|---|
| session identity, title, workspace path, recency, run-state fallback | ctx.sessions.list |
| Workspace title shown on the card | ctx.workspaces.list |
| pending question / approval | ctx.uiSession.sessionStatus |
| live run state of one card | binding.session.getSnapshot().running |
| live transcript | ctx.sessions.retain() → binding.eventSource |
| send a prompt | binding.session.prompt(content, 'queue') |
| answer a pending request | the carrier's own answer() |
| current permission preset | binding.session.projections.faceOf('permissions') |
| selectable permission presets | ctx.remote.permissionPresets.catalog() |
| switch the preset | binding.session.command('/permission <preset>') |
| queued messages | binding.session.projections.faceOf('inbox') → next-turn |
| steer / edit / discard a queued message | binding.session.updateQueue(id, { kind: 'steer' \| 'edit' \| 'remove' }) |
| stop the running turn | binding.session.cancel() |
| open the session | ctx.uiWorkspace.openSession(sessionId) |
| current model and catalog | ctx.modelDirectories.directoryFor(sessionId) |
| switch the model | the same directory's select({ provider, model }) |
| create a session in place | ctx.sessions.create({ workspaceId }) (fallback ctx.uiWorkspace.connectWorkspace) |
| keep a created blank session as a card | the monitor's local spawned set in localStorage |
| adopt a folder as a Workspace | ctx.workspaces.create({ path }) |
| ask for a folder | ctx.remote.directoryPicker.pick() |
Why answering works from another session's card. The shipped approval and
question panels publish their request into the unified pending-interaction
projection, and both carriers (PendingApproval, PendingQuestion) expose the
same answer() their own composer panel calls — approvals take
'allowed-once' | 'rejected', questions take { answers: [{ id, selected, custom }] }.
The monitor drives that method; it does not reimplement the answer path. A
carrier that offers no answer() renders nothing, and a refused answer is shown
as a failure on the card.
Why the permission control can switch another session. It reads the current
preset from that session's own permissions projection, offers the presets the
Host's process catalog lists, and submits the same /permission <preset> line
the shipped composer picker submits — the Host performs the switch, and the
projection reporting the new value is the card's settlement. Full access
switches with no extra step: choosing it in this picker is the explicit
selection. Auto review keeps one inline acknowledgement because it changes how
every request is reviewed. The namespace is optional — it is not in this bundle's
required inject list and is resolved reflectively through
ctx.get('remote.permissionPresets') — so a composition without permission
presets publishes no catalog, keeps the whole panel mounted, and the cards
render no control at all.
Why the queue and the model are the session's own too. The card lists the
next-turn rows of the session's inbox projection — the same rows the
main-view queue dock renders — and its three buttons call the dock's exact
actions: Steer ({ kind: 'steer' }, only while the session runs), Edit
(an inline editor saving { kind: 'edit', content: [{ type: 'text', text }] })
and Discard ({ kind: 'remove' }). The same convergence applies for a turn
that ended first or a row the agent already claimed. The composer has no
Queue/Steer toggle: a send is always queue, steering is a queue-row action,
and the composer's Stop button (shown only while the session runs) calls
session.cancel() — the main-view Stop action.
The model control resolves the shared per-session directory through
ctx.modelDirectories (waited for in an optional child scope that also injects
remote.session, because that service reaches the namespace through the
caller's context), so a model switched on a card is what the composer and
/model see next. A model with advertised reasoning efforts is switched at its
default effort; the card has no effort row of its own.
Why the new session does not open the conversation. The point of the monitor is
to keep several sessions in view; a click that navigates away defeats it. The
toolbar therefore calls ctx.sessions.create({ workspaceId }) and keeps the id the
Host returns. Because a brand-new session is blank, the grid would normally
filter it out, so the id is recorded in this browser's spawned set and
collectSessions keeps the blank row as a card (titled "New Session") until its
first turn gives it a real title. The card then enters the frozen order like any
other new arrival, which is what keeps the rest of the grid still. A displaced
card stays known at the order's tail rather than being dropped; otherwise it would
look like a new arrival on the next reconcile and evict another card, and the grid
would churn. A composition without sessions.create falls back to
ctx.uiWorkspace.connectWorkspace(workspaceId), which also creates without
navigating (it may reuse a blank session). Both services are optional and read
reflectively (ctx.get(...)), so the panel still mounts — and simply renders no
new-session control — where neither exists.
One known boundary. A question routed to a different browser tab (or one
whose foreground claim ended) refuses an answer made here
(no channel accepts an answer yet); the card says so rather than pretending the
answer was accepted.
cwd string, so a renamed Workspace shows its name; the raw path stays a tooltip. State and time
follow it in the muted caption colour, and the status dot repeats the state at a glance.--dsh-content-font-size plus 4 px (18 px at the default 14 px), and the Workspace / state / time line under it
is exactly 1.5x smaller than that title (12 px), set once on the card as --dsm-card-title-size and
--dsm-card-sub-size. Both come from the same token, so the Settings → General font-size preference scales the
whole head together instead of leaving the second line pinned to a size of its own.--dsh-content-font-size
(14 px by default) with the same line-height delta the Chat uses, and tool/notice rows read
--dsh-content-font-size-secondary; the card therefore follows the Settings → General font-size preference
instead of carrying a size of its own.binding.session.getSnapshot().running is the
authoritative per-session run bit: the Host's status event calls Session.handleRunning(). The catalog row is
only the fallback, so a lagging shared snapshot can never hide live work. Each card reconciles its two snapshots
every 2 s, and the page asks the Host for a fresh catalog baseline on mount and every 15 s — a missed push costs
one interval, not a wrong mark.Boundaries.tsx), so a failure stays inside the plugin and shows a
readable Try again panel that remounts the page; each card has a second boundary, so one unreadable session
costs its own cell, not the rest of the grid.displayReason as a locale map
({ en, zh, … }), not a ready string — every sandbox-escalation request carries one. The map is resolved through
the active language (ctx.locale.resolveText), with the English entry as the fallback. A map rendered as a child
throws "Objects are not valid as a React child" and takes the panel with it; that was the blank-page failure in
0.11.3 and earlier.sessionStatus is not a
member of uiSession: it is a service registered as uiSession.sessionStatus, and the context proxy
throws cannot get property "uiSession.sessionStatus" without inject for a plugin that did not declare
that exact dotted name. The read used to happen while the page rendered, so every mount of the monitor
ended in This page could not be drawn. It is now resolved with the reflective ctx.get() at mount
time (like remote.permissionPresets), so a composition without the projection still mounts the panel.sessionMonitor, so sessions.retainInfo(id) distinguishes the monitor's
streams from the conversation's own.pnpm check — typecheck of both halves and the tests, the built bundle, then
the test run: 168 tests, including a jsdom mount of the real page against
fake projections (ordering, live window, question answer, prompt send, removal,
open failure, a long answer rendered whole, the new-session control's default
Workspace, its start call, folder adoption, a cancelled chooser and a refused
start), a created blank session taking the oldest card's slot on the page
without navigating, a card keeping its cell across a panel remount and a reload,
a smaller card budget re-seeding the grid to the newest sessions, the toolbar's
card-budget stepper moving one card at a time and stopping at 2 and 24, a
pending catalog leaving the stored order alone, a stylesheet guard
(every rendered class has a rule; no literal colours), and an execution of the
built bundle behind a fake module loader (bundle id, exports, real apply
wiring, no second React).test/robustness.spec.tsx): an approval whose displayReason
is a locale map renders the resolved sentence — with ctx.locale.resolveText
and, without it, the map's English entry — and the panel stays mounted; a plain
string and a malformed map both render; a throwing card keeps its neighbours;
a throwing page renders the Try again panel and remounts on click; a page whose
pref store throws is contained inside the plugin. A table of malformed
projections (non-array catalog ids, a null catalog row, a null status row,
junk event-window entries, a null permission option, junk model groups, a
null queued row) all render the page instead of blanking it.test/foreign-data.spec.tsx): a matrix of
single-field mutations — every catalog, status, Workspace and preference value
the page reads, each replaced by null, a number, a string, an array, a
locale map and a function — mounts the real panel with the toolbar included
and asserts the page-level fallback never appears. The paths this closed: a
snapshot whose byId is null, a row with no usable title whose cwd is not
a string (the title fallback called .split()), and a null row for an id the
page spawned (the prune effect read .blank). The fallback also prints the
one-line reason it caught, so a recurrence is readable in place.scripts/dev-profile.sh — an isolated profile boots the row and serves
/plugins/dsh-session-monitor/client.js.cannot get property "uiSession.sessionStatus" without inject), which pins the fix to that call.cd dsh-session-monitor
pnpm install
pnpm check
scripts/install.sh # builds, packs and prints the tarball path
Install that tarball through Settings → Plugins (or
dsh plugin --profile <name> add <tarball> for a CLI-managed profile), then
restart the application. The desktop profile is owned by the Electron app, so its
supported install path is the Plugins page; a bundle added to a running profile is
imported at the next start.
src/index.ts host half: identity only, registers nothing
src/client/index.tsx sidebar row + main page registration
src/client/Boundaries.tsx page- and card-level crash containment
src/client/MonitorPanel.tsx registered entry: the bounded page
src/client/MonitorPage.tsx grid, toolbar, card selection
src/client/CardBudgetControl.tsx card-budget stepper (− / number / +)
src/client/NewSessionControl.tsx new-session button + Workspace drop-down
src/client/SessionCard.tsx one card: header, transcript, pending, composer
src/client/InteractionCard.tsx question/approval answer block
src/client/model.ts which sessions, what happened, localized text (pure)
src/client/store.ts removed ids + card budget (localStorage)
src/client/useSessionFeed.ts retain/follow/release one session
src/client/styles.ts theme-token stylesheet
test/ model, store, manifest, page (jsdom), robustness, built bundle
MIT.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek、deepseek-harness。