@aiwayds/dsh-tui-pi 2.32.0 → 2.32.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.
@@ -132,6 +132,42 @@ function installGlobal(name) {
132
132
  return result.status === 0
133
133
  }
134
134
 
135
+ // Newest of the `latest` (stable) and `next` (rc) dist-tags — the same
136
+ // resolution rule as ci.yml / e2e/run-e2e.sh; the alpha tag is retired.
137
+ // The host's `latest` dist-tag lags the rc line this plugin targets
138
+ // (2026-10: latest=0.2.1-rc.2 while the plugin needs the rc.3 subagent
139
+ // APIs), so the host must never be installed from the bare package name.
140
+ // Returns a concrete version, or null when npm cannot be reached.
141
+ export function resolveHostVersion() {
142
+ try {
143
+ const out = execFileSync('npm', ['view', HOST, 'dist-tags', '--json'], {
144
+ encoding: 'utf8',
145
+ timeout: 30_000,
146
+ stdio: ['ignore', 'pipe', 'pipe'],
147
+ })
148
+ const tags = JSON.parse(out)
149
+ const stable = tags?.latest
150
+ const rc = tags?.next
151
+ if (stable && rc) return compareVersions(rc, stable) > 0 ? rc : stable
152
+ return stable ?? rc ?? null
153
+ } catch {
154
+ return null
155
+ }
156
+ }
157
+
158
+ // The oldest host this plugin can run on, read from the manifest's own
159
+ // peerDependencies so the declaration and the check stay one decision.
160
+ export function minHostVersion() {
161
+ try {
162
+ const peer = readSelfPackage().peerDependencies?.[HOST]
163
+ const match = typeof peer === 'string' ? peer.match(/>=\s*(\S+)/) : null
164
+ if (match) return match[1]
165
+ } catch {
166
+ /* fall through to the baked-in floor */
167
+ }
168
+ return '0.2.1-rc.3'
169
+ }
170
+
135
171
  // True when the mounted profile copy is OLDER than this package. Prerelease
136
172
  // tags compare numerically per dot segment (rc.10 > rc.4); a profile that is
137
173
  // NEWER (dev-upgraded ahead of the global install) is left alone.
@@ -210,23 +246,30 @@ function approvePrintedBuilds() {
210
246
  */
211
247
  export function runOnboard({ log = () => {} } = {}) {
212
248
  let dsh = dshBinPath()
213
- if (dsh) {
214
- log(` [1/3] dsh host found ${queryVersion(dsh, ['-V']) ?? '(version unknown)'}`)
215
- } else if (!which('npm')) {
216
- log(` [1/3] dsh host not found, and npm is not on PATH either`)
249
+ const wanted = resolveHostVersion()
250
+ const hostSpec = wanted ? `${HOST}@${wanted}` : HOST
251
+ const foundVersion = dsh ? queryVersion(dsh, ['-V']) : null
252
+ const tooOld = foundVersion ? compareVersions(foundVersion, minHostVersion()) < 0 : false
253
+ if (dsh && !tooOld) {
254
+ log(` [1/3] dsh host found ${foundVersion ?? '(version unknown)'}`)
255
+ } else if (!dsh && !which('npm')) {
256
+ log(' [1/3] dsh host not found, and npm is not on PATH either')
217
257
  return {
218
258
  ok: false,
219
259
  step: 'npm',
220
260
  hint: 'install Node.js (ships with npm) first: https://nodejs.org — then re-run dsh-tui-pi',
221
261
  }
222
262
  } else {
223
- log(` [1/3] dsh host not found — installing ${HOST} globally with npm (largest step, a few minutes)…`)
224
- if (!installGlobal(HOST)) {
225
- return { ok: false, step: 'dsh host install', hint: `install it with: npm install -g ${HOST} — then re-run dsh-tui-pi` }
263
+ const reason = dsh
264
+ ? `${foundVersion} is older than this plugin requires (>= ${minHostVersion()})`
265
+ : 'not found'
266
+ log(` [1/3] dsh host ${reason} — installing ${hostSpec} globally with npm (largest step, a few minutes)…`)
267
+ if (!installGlobal(hostSpec)) {
268
+ return { ok: false, step: 'dsh host install', hint: `install it with: npm install -g ${hostSpec} — then re-run dsh-tui-pi` }
226
269
  }
227
270
  dsh = dshBinPath()
228
271
  if (!dsh) {
229
- return { ok: false, step: 'dsh host lookup', hint: `installed, but still not found — run: npm install -g ${HOST}` }
272
+ return { ok: false, step: 'dsh host lookup', hint: `installed, but still not found — run: npm install -g ${hostSpec}` }
230
273
  }
231
274
  log(` [1/3] dsh host installed ${queryVersion(dsh, ['-V']) ?? ''}`)
232
275
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiwayds/dsh-tui-pi",
3
- "version": "2.32.0",
3
+ "version": "2.32.1",
4
4
  "description": "A fully-featured pi-style terminal UI for DeepSeek Harness (dsh) — history look-back & fork-at-turn, guided preset switching, live subagent steering, model profiles & themes",
5
5
  "repository": {
6
6
  "type": "git",
@@ -75,7 +75,7 @@
75
75
  "@aiwayds/dsh-mcp-adapter": "^0.7.0",
76
76
  "@aiwayds/dsh-model-sync": "^0.7.0",
77
77
  "@aiwayds/dsh-profile-switch": "^0.3.0",
78
- "@aiwayds/dsh-subagent-registry": "^0.13.0",
78
+ "@aiwayds/dsh-subagent-registry": "^0.14.0",
79
79
  "@aiwayds/dsh-web-search-anysearch": "^0.6.0",
80
80
  "@earendil-works/pi-tui": "0.85.1"
81
81
  },