Vai al contenuto principale
T

dsh-pause-button

trammels51/dsh-pause-button

Pause or resume the running task from a 28 px button beside the DSH composer: safe pause lets the current step finish, holds the next agent/pre-step boundary, and resumes the same turn without a continuation message; force pause cancels immediately, and the default granularity is configurable in Settings.

Installazione

dsh plugin --profile web add github:trammels51/dsh-pause-button

README

dsh-pause-button

English | 中文

A minimal pause/resume control beside the DSH composer, plus /pause and /resume commands.

Pause button design preview

The button is 28 × 28 px, icon-only, borderless, and inherits the composer tool-row color. It stays at 68% opacity while running, uses one low-saturation blue only when paused, pulses while a safe pause is pending, and fades to 26% when there is no running task. It sits in conversation.input.right, immediately left of Send.

Behavior

Safe pause (default, safe / wait)

  • The current step is not interrupted — a running tool or model request is allowed to finish.
  • At the next agent/pre-step boundary, the turn is held before the next model request.
  • Resume releases that exact pre-step decision, continuing the same turn in place. Completed steps are not repeated, and no extra user message is inserted.
  • If the task ends before reaching another boundary, the plugin reports that no pause point was reached instead of pretending to pause.

Force pause (force / stop)

  • Calls agent.cancel({ kind: 'user' }, { keepInbox: true }) immediately, interrupting the current step while retaining completed history.
  • Resume sends one continuation prompt asking the model to continue from the breakpoint without redoing finished work.
  • Force resume therefore leaves one visible user-role message; safe resume does not.

Install

Requires DSH 0.2.2-rc.1 through 0.2.x.

From GitHub:

dsh plugin --profile web add github:trammels51/dsh-pause-button

Or from the prebuilt release tarball:

dsh plugin --profile web add https://github.com/trammels51/dsh-pause-button/releases/latest/download/dsh-pause-button.tgz

Refresh the Web page if the button does not appear after installation.

Commands

CommandAction
/pausePause using the configured default granularity
/pause force or /pause stopForce-pause this time, overriding the default
/pause safe or /pause waitSafe-pause this time, overriding the default
/pause statusShow phase, current mode, and default mode
/pause resumeSame as /resume
/resumeResume the held task

/pause force also escalates a pending safe pause instead of being a no-op.

Settings

Open Settings → General → Pause granularity:

  • Safe (wait) — finish the current step, then pause and resume in place.
  • Force (stop) — stop the current step now; resume from the breakpoint.

The choice is stored in $DSH_HOME/dsh-pause.json. The composer button and bare /pause follow it; /pause force overrides it once.

Implementation

  • Host half — lib/index.js
    • Registers /dsh-pause/state, /pause, /resume, and /config routes.
    • Holds agent/pre-step for safe pause and converges state on agent/status / agent/disposed.
    • Registers /pause and /resume through ctx.commands.
    • Keeps pause state per Session and settings in $DSH_HOME/dsh-pause.json.
  • Browser half — lib/client.js
    • A hand-written window.__ModuleLoader__.load bundle using the official conversation.input.right and settings.general.item slots.
    • Polls the current Session state every 900 ms and pauses polling while the page is hidden.
    • Requires only the platform-provided react; no extra npm dependency.

Verification

npm test runs both suites:

  • test/host.test.mjs — safe hold/resume, force cancel, continuation prompt, settings writes, origin fence, idle refusal, and force escalation over a pending safe pause.
  • test/client.test.mjs — bundle exports, both slot registrations, and the pause-state source shape.

A live Web GUI check also paused a subagent during a sleep 8 tool call: the safe pause landed after the tool finished, stayed held at the next boundary, then resumed the same turn and completed.

Limitations

  • Only the addressed Agent is paused; its subagents are not paused automatically.
  • During a safe pause the Agent status remains running because the same turn is held. Stop/cancel releases the hold and ends that turn.
  • Force resume inserts one visible continuation message because there is no held call to release.
  • Requires the Web host services webServer and agents; it is not a headless/ACP plugin.

License

MIT

Plugin correlati