dsh-pause-resume 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.1
4
+
5
+ A stop that could not finish no longer traps the button, and the dot stops lying after a resume.
6
+
7
+ * An unfinished stop now always offers the resume that releases it. The button used to prefer
8
+ `pause` whenever live work remained, so a partial stop re-ran the same stop on the same
9
+ uncancellable turn: the icon never changed, the attention dot stayed, and pressing it did
10
+ nothing a person could see.
11
+ * Work that starts while a plan waits no longer flips the button back to pause. The plan owns the
12
+ action until it is consumed.
3
13
  ## 0.4.0
4
14
 
5
15
  The crash path is now a first-class restore path, and a dead button after a restart is fixed.
package/index.js CHANGED
@@ -7,7 +7,7 @@ import { createHeartbeat } from './lib/heartbeat.js'
7
7
  import { createProbe, listRunning } from './lib/probe.js'
8
8
 
9
9
  export const name = 'dsh-pause-resume'
10
- export const VERSION = '0.4.0'
10
+ export const VERSION = '0.4.1'
11
11
 
12
12
  const BASE_PATH = '/dsh-pause-resume'
13
13
  const BUTTON_HEADER = 'x-dsh-pause-resume'
package/lib/engine.js CHANGED
@@ -139,10 +139,14 @@ export function createEngine({ store, probe, heartbeat = null, bootId = 'boot',
139
139
  const work = workOf(current)
140
140
  const busy = TRANSIENT.has(phase)
141
141
  const workCount = liveWorkCount(work)
142
+ // A plan is an unfinished stop: the only way forward is to resume it, even when the stop left
143
+ // work behind. Preferring `pause` there used to trap a partial stop forever: every press
144
+ // re-ran the same stop, the residue could never be cancelled, and the button never offered the
145
+ // resume that would have released the plan.
142
146
  let action = 'none'
143
147
  if (busy) action = 'busy'
144
- else if (current.readable === true && workCount > 0) action = 'pause'
145
148
  else if (plan !== null) action = 'resume'
149
+ else if (current.readable === true && workCount > 0) action = 'pause'
146
150
  const attentionRows = plan !== null ? plan.attention : result?.attention
147
151
  const attention = Array.isArray(attentionRows) ? attentionRows.length : 0
148
152
  const first = attention > 0 ? attentionRows[0] : null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-pause-resume",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "description": "One header button stops running turns, goals and jobs, writes a plan to disk, and restores that work after a restart or crash; the button shape is the only status.",
6
6
  "license": "MIT",