@aiwayds/dsh-tui-pi 2.32.0 → 2.33.0

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/README.md CHANGED
@@ -42,7 +42,7 @@ npm i -g @aiwayds/dsh-tui-pi
42
42
  dsh-tui-pi # or the short form: dst
43
43
  ```
44
44
 
45
- The global install sets the machine up by itself, printing one progress line per step: it installs the `@deepseek-ai/dsh` host when missing (via npm; if npm itself is not on PATH, it prints what to install and stops), installs pnpm, and creates the `tui` profile with this plugin and its bundled companions. Whatever the install cannot finish (e.g. an offline machine) completes automatically on the first launch. After a later `npm i -g` upgrade of this package, the profile's mounted copy is moved to the new version on the next launch — a profile that is newer than the global install (dev-upgraded ahead) is left untouched.
45
+ The global install sets the machine up by itself, printing one progress line per step: it installs the `@deepseek-ai/dsh` host when missing (via npm, resolved as the newest of the `latest`/`next` dist-tags — the `latest` tag alone lags the rc line; if npm itself is not on PATH, it prints what to install and stops), installs pnpm, and creates the `tui` profile with this plugin and its bundled companions. Host compatibility window: **0.2.1-rc.2 through 0.2.1-rc.4** — an rc.2 host is kept as-is (the subagent companion degrades gracefully there); an older one is upgraded automatically. Whatever the install cannot finish (e.g. an offline machine) completes automatically on the first launch. After a later `npm i -g` upgrade of this package, the profile's mounted copy is moved to the new version on the next launch — a profile that is newer than the global install (dev-upgraded ahead) is left untouched.
46
46
 
47
47
  The manual steps do exactly what the onboarding runs, if you prefer them:
48
48
 
@@ -132,6 +132,48 @@ 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 supports. Compatibility window: 0.2.1-rc.2
159
+ // through 0.2.1-rc.4 (rc.2 lacks the subagents.start* APIs, where the
160
+ // subagent-registry companion degrades gracefully via its host-compat
161
+ // guard; rc.3/rc.4 have the full surface). Read from the manifest's own
162
+ // peerDependencies when declared, so declaration and check stay one
163
+ // decision — note the floor must NOT move into peerDependencies itself:
164
+ // npm ≥7 auto-installs peers on global installs and would pull the 834MB
165
+ // host at its stale `latest` tag.
166
+ export function minHostVersion() {
167
+ try {
168
+ const peer = readSelfPackage().peerDependencies?.[HOST]
169
+ const match = typeof peer === 'string' ? peer.match(/>=\s*(\S+)/) : null
170
+ if (match) return match[1]
171
+ } catch {
172
+ /* fall through to the baked-in floor */
173
+ }
174
+ return '0.2.1-rc.2'
175
+ }
176
+
135
177
  // True when the mounted profile copy is OLDER than this package. Prerelease
136
178
  // tags compare numerically per dot segment (rc.10 > rc.4); a profile that is
137
179
  // NEWER (dev-upgraded ahead of the global install) is left alone.
@@ -210,23 +252,30 @@ function approvePrintedBuilds() {
210
252
  */
211
253
  export function runOnboard({ log = () => {} } = {}) {
212
254
  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`)
255
+ const wanted = resolveHostVersion()
256
+ const hostSpec = wanted ? `${HOST}@${wanted}` : HOST
257
+ const foundVersion = dsh ? queryVersion(dsh, ['-V']) : null
258
+ const tooOld = foundVersion ? compareVersions(foundVersion, minHostVersion()) < 0 : false
259
+ if (dsh && !tooOld) {
260
+ log(` [1/3] dsh host found ${foundVersion ?? '(version unknown)'}`)
261
+ } else if (!dsh && !which('npm')) {
262
+ log(' [1/3] dsh host not found, and npm is not on PATH either')
217
263
  return {
218
264
  ok: false,
219
265
  step: 'npm',
220
266
  hint: 'install Node.js (ships with npm) first: https://nodejs.org — then re-run dsh-tui-pi',
221
267
  }
222
268
  } 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` }
269
+ const reason = dsh
270
+ ? `${foundVersion} is older than this plugin requires (>= ${minHostVersion()})`
271
+ : 'not found'
272
+ log(` [1/3] dsh host ${reason} — installing ${hostSpec} globally with npm (largest step, a few minutes)…`)
273
+ if (!installGlobal(hostSpec)) {
274
+ return { ok: false, step: 'dsh host install', hint: `install it with: npm install -g ${hostSpec} — then re-run dsh-tui-pi` }
226
275
  }
227
276
  dsh = dshBinPath()
228
277
  if (!dsh) {
229
- return { ok: false, step: 'dsh host lookup', hint: `installed, but still not found — run: npm install -g ${HOST}` }
278
+ return { ok: false, step: 'dsh host lookup', hint: `installed, but still not found — run: npm install -g ${hostSpec}` }
230
279
  }
231
280
  log(` [1/3] dsh host installed ${queryVersion(dsh, ['-V']) ?? ''}`)
232
281
  }
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.33.0",
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
  },