Skip to content

v0.3.0 — session_dm_wait: stop sleeping, wait for the turn to end

Latest

Choose a tag to compare

@Venshell Venshell released this 28 Oct 19:15

dsh-session-dm v0.3.0

New: session_dm_wait

Handing work to another Session used to leave you guessing how long it would take — the only option was sleep and hope. Now you can block until it actually finishes.

session_dm_send   →  hands off the work
session_dm_wait   →  blocks until the target's turn ends, returns the reason
session_event_read →  reads what it produced

session_dm_wait({ session_id, timeout_seconds? }) resolves with:

  • turn end reason — finished its turn (session seq N), plus the reason kind (completed, max-tokens, a cancel cause)
  • idle — the target had nothing pending, so there was nothing to wait for (happens right after resuming a cold Session)
  • failure — the target's Session error, surfaced rather than swallowed
  • timeout — after timeout_seconds (default 300, capped at 3600), including whether the target is still running

Why it waits on turn/end and not on status

The host's own developer documentation is explicit:

Wait on durable events such as turn/end … Do not poll agent/status. whenIdle() does not mean one follow-up finished: several inputs can share one running interval.

So the wait races three signals, each covering a gap the others leave:

Signal Covers
session/event → turn/end the normal path; fires the moment the turn durably ends
agent.whenIdle() a cold target resumed with nothing pending — no turn/end will ever arrive
seq advanced && idle poll (1 s) frames the listener missed on cold resume or reconnect

Also fixed in this release

A real hang, found while testing the wait. The timers were unref()'d, which lets Node exit the event loop while the await is still pending — the wait produced no output and the process disappeared. Active waits now keep their timers ref'd. Sharp edge #6 in the README documents it.

Everything else

session_dm_send and session_create are unchanged. The bundle still enables its own dependencies on install: it mounts the read-back tools (@deepseek-ai/dsh-tool-session-query) and opens SQLite session content search.

Install / upgrade

dsh plugin --profile <your-profile> add dsh-session-dm@0.3.0

Restart the Harness afterward — plugin modules load at boot.

Full docs: README · v0.3.0 diff