@aiwayds/dsh-tui-pi 2.38.1 → 2.38.2

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
@@ -6,6 +6,8 @@ A fully-featured pi-style terminal UI for [DeepSeek Harness](https://github.com/
6
6
 
7
7
  **Requires dsh >= 0.2.2-rc.1** — this plugin targets the dsh RC/stable line only (CI and releases resolve the newest of the `latest`/`next` dist-tags at runtime). **The alpha line is no longer supported.** A startup guard logs a one-line warning and exits cleanly when the host is older than the floor (opt out with `DSH_TUI_SKIP_HOST_CHECK=1`). See [ADR 0002](docs/adr/0002-target-dsh-0.1.2-alpha.3-single-target.md) for the now-superseded alpha single-target decision.
8
8
 
9
+ **Companion versions on first/upgrade onboarding** — bundled companions are pinned to their registry `dist-tags.latest` by default (with a cross-major guard, a post-install version check and automatic fallback to the declared range). Set `DSH_TUI_COMPANION_LATEST=0` (or `false`/`off`) to install the declared ranges instead. The switch is read in the launcher before the TUI config loads; a failed registry query never blocks startup.
10
+
9
11
  https://github.com/user-attachments/assets/67a7c6ca-ff42-4005-b543-437ba61771bb
10
12
 
11
13
  *A live recording of a session (MP4, 1.5× speed) — todos, running subagents, think/tool panels and the powerline footer in action.*
package/README.zh-CN.md CHANGED
@@ -6,6 +6,8 @@
6
6
 
7
7
  **要求 dsh >= 0.2.2-rc.1** —— 本插件只跟随 dsh RC/stable 线(CI 与发版在运行时解析 latest/next 中更新的 dist-tag)。**不再支持 alpha 线。**宿主低于下限时,启动守卫会打一行 warning 并干净退出(可用 `DSH_TUI_SKIP_HOST_CHECK=1` 跳过)。alpha 单目标决策的历史见 [ADR 0002](docs/adr/0002-target-dsh-0.1.2-alpha.3-single-target.md)(已被取代)。
8
8
 
9
+ **首启/升级 onboard 时的 companion 版本** —— bundled companions 默认钉到 registry 的 `dist-tags.latest`(带跨 major 守卫、装后版本自检和失败自动回退声明范围)。设 `DSH_TUI_COMPANION_LATEST=0`(或 `false`/`off`)改为按 `package.json` 声明范围安装。该开关在 launcher 层、TUI Config 加载前读取;registry 查询失败不会阻塞启动。
10
+
9
11
  https://github.com/user-attachments/assets/67a7c6ca-ff42-4005-b543-437ba61771bb
10
12
 
11
13
  *一次真实 session 的实况录制(MP4,1.5× 速度)——todos、运行中的 subagents、think/tool 面板和 powerline footer 的实际效果。*
package/bin/boot.mjs CHANGED
@@ -32,6 +32,15 @@ import {
32
32
 
33
33
  const args = process.argv.slice(2)
34
34
 
35
+ // Single kill switch for companion-latest onboarding, read once in the bin
36
+ // layer (before the TUI Config exists). Anything other than 0/false/off —
37
+ // including unset — means enabled. Mirrors the DSH_TUI_SKIP_HOST_CHECK style.
38
+ function companionLatestEnabled() {
39
+ const raw = process.env.DSH_TUI_COMPANION_LATEST
40
+ if (raw === undefined) return true
41
+ return !['0', 'false', 'off'].includes(String(raw).trim().toLowerCase())
42
+ }
43
+
35
44
  function boot(dsh) {
36
45
  const result = spawnSync(dsh, ['--profile', 'tui', ...args], { stdio: 'inherit' })
37
46
  process.exit(result.status ?? 1)
@@ -51,7 +60,10 @@ if (dsh && profileMounted() && !profileBehind()) {
51
60
  }
52
61
 
53
62
  console.log('dsh-tui-pi setup (first run / upgrade only):')
54
- const setup = runOnboard({ log: (line) => console.log(line) })
63
+ const setup = runOnboard({
64
+ log: (line) => console.log(line),
65
+ companionLatest: companionLatestEnabled(),
66
+ })
55
67
  if (!setup.ok) {
56
68
  console.error(`\ndsh-tui-pi: setup stopped at "${setup.step}".`)
57
69
  if (setup.detail) console.error(`dsh-tui-pi: ${setup.step} — ${setup.detail}`)
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Pure decision table for the "install companion latest" onboarding step.
3
+ *
4
+ * No I/O, no process.env, no clock: every input is passed in, so the whole
5
+ * table is unit-testable (same shape as src/host-version.ts's pure functions).
6
+ * The caller (bin/onboard-core.mjs) owns the registry query, the profile
7
+ * reads and the actual install; this module only answers one question:
8
+ * given a declared range, a resolved latest version and the currently
9
+ * mounted pin, what exact spec (if any) should be handed to `dsh plugin add`?
10
+ */
11
+
12
+ export const REASONS = Object.freeze({
13
+ LATEST: 'latest',
14
+ DISABLED: 'disabled',
15
+ UNRESOLVED: 'unresolved',
16
+ CROSS_MAJOR: 'cross_major',
17
+ DOWNGRADE: 'downgrade',
18
+ IDEMPOTENT: 'idempotent',
19
+ })
20
+
21
+ // Companions are 0.x packages: major is the only hard boundary, a 0.x minor
22
+ // jump (0.9 → 0.10, 0.20 → 0.21) is exactly the case this feature must allow.
23
+ // We only need the numeric core for the guard; prerelease suffixes are kept
24
+ // verbatim in the spec but ignored for comparisons.
25
+ // npm dist-tags are usually bare (`0.14.9`) but occasionally carry a leading
26
+ // `v` (`v0.14.9`). The version recorded in an installed manifest never has the
27
+ // `v`, so normalise before building the spec — otherwise the post-install
28
+ // self-check compares `0.14.9` against `v0.14.9` and fails spuriously.
29
+ // Prerelease suffixes (`0.3.0-rc.1`) are part of the version and kept verbatim.
30
+ export function normalizeVersion(version) {
31
+ return String(version).trim().replace(/^v/, '')
32
+ }
33
+
34
+ function parseCore(version) {
35
+ if (typeof version !== 'string') return null
36
+ // Declared ranges carry an operator prefix (^0.14.0, ~0.9.0, >=1.2.3);
37
+ // resolved pins are bare (0.14.5, possibly v-prefixed). Only the numeric
38
+ // core is needed for the major guard.
39
+ const match = /^[v^~><=\s]*(\d+)\.(\d+)\.(\d+)/.exec(version.trim())
40
+ if (!match) return null
41
+ return { major: Number(match[1]), minor: Number(match[2]), patch: Number(match[3]) }
42
+ }
43
+
44
+ function compareCore(a, b) {
45
+ const pa = parseCore(a)
46
+ const pb = parseCore(b)
47
+ if (!pa || !pb) return null
48
+ for (const key of ['major', 'minor', 'patch']) {
49
+ if (pa[key] !== pb[key]) return pa[key] - pb[key]
50
+ }
51
+ return 0
52
+ }
53
+
54
+ /**
55
+ * Decide one companion's install action.
56
+ *
57
+ * Inputs:
58
+ * packageName — e.g. '@aiwayds/dsh-dcp' (used to build the exact spec)
59
+ * declaredRange — the caret range from package.json.dependencies
60
+ * resolved — dist-tags.latest from the registry, or null on failure
61
+ * currentPin — version mounted in the profile, or null on a fresh install
62
+ * enabled — the bin-layer kill switch (DSH_TUI_COMPANION_LATEST)
63
+ *
64
+ * Output:
65
+ * { action, spec, reason }
66
+ * action 'latest' → spec is 'pkg@<resolved>'; pass it to plugin add
67
+ * action 'fallback' → spec is null; install the declared range (today's path)
68
+ * action 'skip' → spec is null; no-op (already pinned / never downgrade)
69
+ *
70
+ * Decision order matters: the kill switch wins first, then an unusable
71
+ * resolution, then the cross-major guard, then the current-pin comparison.
72
+ */
73
+ export function decideCompanionInstall({
74
+ packageName,
75
+ declaredRange,
76
+ resolved,
77
+ currentPin = null,
78
+ enabled = true,
79
+ } = {}) {
80
+ const fallback = (reason) => ({ action: 'fallback', spec: null, reason })
81
+ const skip = (reason) => ({ action: 'skip', spec: null, reason })
82
+ const latest = () => ({ action: 'latest', spec: `${packageName}@${normalizeVersion(resolved)}`, reason: REASONS.LATEST })
83
+
84
+ if (!enabled) return fallback(REASONS.DISABLED)
85
+
86
+ const resolvedCore = parseCore(resolved)
87
+ const declaredCore = parseCore(declaredRange)
88
+ // Without a trustworthy resolved version or a declared range to guard
89
+ // against, fall back — never send a half-checked spec to plugin add.
90
+ if (!resolvedCore || !declaredCore) return fallback(REASONS.UNRESOLVED)
91
+
92
+ if (resolvedCore.major !== declaredCore.major) return fallback(REASONS.CROSS_MAJOR)
93
+
94
+ if (currentPin) {
95
+ const cmp = compareCore(resolved, currentPin)
96
+ if (cmp === null) return fallback(REASONS.UNRESOLVED)
97
+ if (cmp < 0) return skip(REASONS.DOWNGRADE)
98
+ if (cmp === 0) return skip(REASONS.IDEMPOTENT)
99
+ }
100
+
101
+ return latest()
102
+ }
@@ -22,9 +22,12 @@
22
22
 
23
23
  import { execFileSync, spawnSync } from 'node:child_process'
24
24
  import { accessSync, constants, existsSync, readFileSync, statSync, writeFileSync } from 'node:fs'
25
+ import { createRequire } from 'node:module'
25
26
  import { homedir } from 'node:os'
26
27
  import { delimiter, dirname, join } from 'node:path'
27
28
  import { fileURLToPath } from 'node:url'
29
+ import { decideCompanionInstall, normalizeVersion } from './companion-policy.mjs'
30
+ import { queryDistTagLatest } from './registry-dist-tag.mjs'
28
31
 
29
32
  const PKG = '@aiwayds/dsh-tui-pi'
30
33
  const HOST = '@deepseek-ai/dsh'
@@ -78,6 +81,70 @@ export function companions() {
78
81
  }
79
82
  }
80
83
 
84
+ // Same companions, but with their declared caret ranges — the policy guard
85
+ // needs the range to reject a cross-major latest. The declaration is read
86
+ // from this package, never from the profile (which only holds resolved pins).
87
+ export function companionRanges() {
88
+ try {
89
+ const deps = readSelfPackage().dependencies ?? {}
90
+ const ranges = {}
91
+ for (const [name, range] of Object.entries(deps)) {
92
+ if (name.startsWith('@aiwayds/') && name !== PKG) ranges[name] = range
93
+ }
94
+ return ranges
95
+ } catch {
96
+ return {}
97
+ }
98
+ }
99
+
100
+ function profileCompanionDir(name) {
101
+ return join(dshHome(), 'profiles', PROFILE, 'node_modules', name)
102
+ }
103
+
104
+ // The version currently mounted in the profile, or null when absent. Used
105
+ // only for the idempotent / no-downgrade guard, never to change a user pin.
106
+ export function profileCompanionVersion(name) {
107
+ try {
108
+ return JSON.parse(readFileSync(join(profileCompanionDir(name), 'package.json'), 'utf8')).version ?? null
109
+ } catch {
110
+ return null
111
+ }
112
+ }
113
+
114
+ // The spec recorded for a companion in the profile's own package.json
115
+ // `dependencies`. `dsh plugin add pkg@<spec>` writes that line verbatim, so
116
+ // re-reading it is how the fallback verifies an exact pin was really replaced
117
+ // by the declared range (a bare add leaves the exact pin untouched).
118
+ export function profileCompanionSpec(name) {
119
+ try {
120
+ const manifest = JSON.parse(readFileSync(join(dshHome(), 'profiles', PROFILE, 'package.json'), 'utf8'))
121
+ return manifest.dependencies?.[name] ?? null
122
+ } catch {
123
+ return null
124
+ }
125
+ }
126
+
127
+ // Post-install self-check: resolve the freshly installed companion from the
128
+ // profile and compare its package.json version with the exact spec we asked
129
+ // for. A load failure or a version mismatch means the pin did not land and
130
+ // the caller must fall back to the declared range (today's path).
131
+ function companionSelfCheck(name, expectedVersion) {
132
+ try {
133
+ const req = createRequire(join(profileCompanionDir(name), 'noop.js'))
134
+ let manifest
135
+ try {
136
+ manifest = req.resolve(`${name}/package.json`)
137
+ } catch {
138
+ // Some companions do not export ./package.json; fall back to the
139
+ // profile's physical path, which is where `dsh plugin add` mounts it.
140
+ manifest = join(profileCompanionDir(name), 'package.json')
141
+ }
142
+ return JSON.parse(readFileSync(manifest, 'utf8')).version === expectedVersion
143
+ } catch {
144
+ return false
145
+ }
146
+ }
147
+
81
148
  export function which(cmd) {
82
149
  const dirs = (process.env.PATH || '').split(delimiter).filter(Boolean)
83
150
  const suffixes = process.platform === 'win32' ? ['.cmd', '.exe', '.bat', ''] : ['']
@@ -267,10 +334,18 @@ function approvePrintedBuilds() {
267
334
  * itself is not on PATH, print what to install and stop
268
335
  * 2/3 pnpm — the host's plugin manager shells out to it; installed
269
336
  * globally when missing
270
- * 3/3 tui profile — `dsh plugin --profile tui add` this package (+ companions)
337
+ * 3/3 tui profile — `dsh plugin --profile tui add` this package (+ companions).
338
+ * With companion latest enabled (the default), each companion's
339
+ * `dist-tags.latest` is resolved and guarded before the add, so the
340
+ * exact version is pinned; a failed query/guard falls back to the
341
+ * declared range (today's path) without blocking onboard.
271
342
  * Returns { ok: true, dsh } or { ok: false, step, hint, detail }.
343
+ *
344
+ * `companionLatest` comes from the bin-layer DSH_TUI_COMPANION_LATEST switch;
345
+ * it is an explicit parameter, not an env read here, so the decision stays
346
+ * testable and the TUI Config layer never gets a second source of truth.
272
347
  */
273
- export function runOnboard({ log = () => {} } = {}) {
348
+ export function runOnboard({ log = () => {}, companionLatest = true } = {}) {
274
349
  let dsh = dshBinPath()
275
350
  const wanted = resolveHostVersion()
276
351
  const hostSpec = wanted ? `${HOST}@${wanted}` : HOST
@@ -320,25 +395,108 @@ export function runOnboard({ log = () => {} } = {}) {
320
395
  const list = companions()
321
396
  log(` [3/3] tui profile ${verb}: installing ${PKG}${list.length ? ` + ${list.length} bundled companions` : ''}…`)
322
397
  if (list.length) log(` ${list.join(', ')}`)
323
- const result = spawnSync(dsh, ['plugin', '--profile', PROFILE, 'add', PKG], {
324
- stdio: 'inherit',
325
- timeout: INSTALL_TIMEOUT_MS,
398
+
399
+ // Resolve → guard → decide, one line per companion. The registry query
400
+ // inherits the install's env and runs from the profile dir when present,
401
+ // so a profile-level .npmrc (private registry) is seen by both sides.
402
+ const profileDir = join(dshHome(), 'profiles', PROFILE)
403
+ const registryCwd = existsSync(profileDir) ? profileDir : process.cwd()
404
+ const ranges = companionRanges()
405
+ const decisions = list.map((name) => {
406
+ const declaredRange = ranges[name] ?? null
407
+ const queried = companionLatest && declaredRange
408
+ ? queryDistTagLatest(name, { cwd: registryCwd, env: process.env })
409
+ : null
410
+ // Normalise once so the spec handed to plugin add and the version the
411
+ // self-check expects are the same string (a `v`-prefixed dist-tag would
412
+ // otherwise make the installed manifest compare unequal to the spec).
413
+ const resolved = queried ? normalizeVersion(queried) : null
414
+ const currentPin = profileCompanionVersion(name)
415
+ const decision = decideCompanionInstall({ packageName: name, declaredRange, resolved, currentPin, enabled: companionLatest })
416
+ if (decision.action === 'latest') {
417
+ log(` ${name}: ${declaredRange} → ${resolved} (latest)`)
418
+ } else if (decision.action === 'skip') {
419
+ log(` ${name}: skip ${declaredRange ?? '(no range)'} (${decision.reason})`)
420
+ } else {
421
+ log(` ${name}: fallback ${declaredRange ?? '(no range)'} (${decision.reason})`)
422
+ }
423
+ return { name, resolved, decision }
326
424
  })
327
- if (result.status !== 0) {
328
- if (!approvePrintedBuilds()) {
329
- return { ok: false, step: 'tui profile setup', hint: `run it manually with: dsh plugin --profile ${PROFILE} add ${PKG} — then re-run dsh-tui-pi` }
425
+
426
+ // Only guarded, resolved companions get an explicit exact spec; every
427
+ // fallback / skip leaves the declared-range resolution to the host, which
428
+ // is byte-for-byte today's `dsh plugin add PKG` behaviour.
429
+ const specDecisions = decisions.filter((entry) => entry.decision.action === 'latest')
430
+ const declaredArgs = ['plugin', '--profile', PROFILE, 'add', PKG]
431
+ const addArgs = [...declaredArgs, ...specDecisions.map((entry) => entry.decision.spec)]
432
+ const profileFail = {
433
+ ok: false,
434
+ step: 'tui profile setup',
435
+ hint: `run it manually with: dsh plugin --profile ${PROFILE} add ${PKG} — then re-run dsh-tui-pi`,
436
+ }
437
+
438
+ // One add attempt, keeping the existing build-approval retry: pnpm ≥10 can
439
+ // fail a fresh add with ERR_PNPM_IGNORED_BUILDS, which filling its
440
+ // allowBuilds skeleton fixes. When approvePrintedBuilds changes nothing we
441
+ // do not retry — that is today's behaviour. Returns the final spawn result.
442
+ function pluginAdd(args) {
443
+ let res = spawnSync(dsh, args, { stdio: 'inherit', timeout: INSTALL_TIMEOUT_MS })
444
+ if (res.status !== 0) {
445
+ if (!approvePrintedBuilds()) return res
446
+ log(' [3/3] tui profile approved the printed build scripts (our closure-linker no-ops) — retrying…')
447
+ res = spawnSync(dsh, args, { stdio: 'inherit', timeout: INSTALL_TIMEOUT_MS })
448
+ }
449
+ return res
450
+ }
451
+
452
+ let result = pluginAdd(addArgs)
453
+
454
+ // An exact-spec add can be rejected for reasons the build-approval retry
455
+ // does not address: the host's pre-install compatibility preflight, a
456
+ // dist-tag that moved between query and add, or its post-install rollback
457
+ // (all exit 1). Downgrade to the declared range once; only a second failure
458
+ // falls into today's abort semantics. The log states the observed exit and
459
+ // the likely causes so this retry is distinguishable from the one above.
460
+ let specAddFellBack = false
461
+ if (result.status !== 0 && specDecisions.length > 0) {
462
+ const cause = result.signal ? `signal ${result.signal}` : `exit ${result.status ?? 'unknown'}`
463
+ log(` companion spec add failed (${cause}; e.g. host compatibility preflight / dist-tag moved / post-install rollback) — retrying declared range`)
464
+ specAddFellBack = true
465
+ result = pluginAdd(declaredArgs)
466
+ }
467
+ if (result.status !== 0) return profileFail
468
+
469
+ // Post-install self-check on the exact specs only. When a pinned companion
470
+ // did not land at the requested version, reinstall its declared range with
471
+ // an EXPLICIT spec — a bare add would leave the bad exact pin in the
472
+ // profile's package.json (P1-2). Read that line back after the fallback and
473
+ // report only what actually happened. Skipped entirely if the add already
474
+ // fell back.
475
+ const broken = specAddFellBack
476
+ ? []
477
+ : specDecisions.filter((entry) => !companionSelfCheck(entry.name, entry.resolved))
478
+ if (broken.length) {
479
+ log(` ${broken.map((entry) => entry.name).join(', ')}: self-check failed — reinstalling declared range with explicit specs`)
480
+ const fallbackSpecs = broken.map((entry) => `${entry.name}@${ranges[entry.name]}`)
481
+ const fallback = pluginAdd([...declaredArgs, ...fallbackSpecs])
482
+ if (fallback.status !== 0) return profileFail
483
+ // Verified only when the line now holds exactly the declared range we
484
+ // asked for — not merely a value that changed from the bad pin.
485
+ const verified = broken.filter((entry) => profileCompanionSpec(entry.name) === ranges[entry.name])
486
+ if (verified.length) {
487
+ log(` ${verified.map((entry) => entry.name).join(', ')}: declared spec restored and verified in profile manifest`)
330
488
  }
331
- // pnpm's skeleton is filled; the same idempotent add now succeeds
332
- // (everything is already downloaded).
333
- log(' [3/3] tui profile approved the printed build scripts (our closure-linker no-ops) — retrying…')
334
- const retry = spawnSync(dsh, ['plugin', '--profile', PROFILE, 'add', PKG], {
335
- stdio: 'inherit',
336
- timeout: INSTALL_TIMEOUT_MS,
337
- })
338
- if (retry.status !== 0) {
339
- return { ok: false, step: 'tui profile setup', hint: `run it manually with: dsh plugin --profile ${PROFILE} add ${PKG} — then re-run dsh-tui-pi` }
489
+ const unverified = broken.filter((entry) => !verified.includes(entry))
490
+ if (unverified.length) {
491
+ log(` ${unverified.map((entry) => entry.name).join(', ')}: fallback re-check inconclusive — declared spec not reflected in profile manifest`)
340
492
  }
341
493
  }
494
+
495
+ const latestCount = specAddFellBack ? 0 : specDecisions.length - broken.length
496
+ const fallbackCount = decisions.filter((entry) => entry.decision.action === 'fallback').length
497
+ + (specAddFellBack ? specDecisions.length : broken.length)
498
+ const skipCount = decisions.filter((entry) => entry.decision.action === 'skip').length
499
+ log(` companions: ${latestCount} latest, ${fallbackCount} fallback, ${skipCount} skipped`)
342
500
  log(` [3/3] tui profile ${verb === 'updating' ? 'updated' : 'done'}`)
343
501
  }
344
502
 
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Thin wrapper around `npm view <pkg> dist-tags.latest --json`. Kept separate
3
+ * from the policy module so the policy stays pure and the subprocess can be
4
+ * replaced by a fake `npm` shim in tests.
5
+ *
6
+ * Contract:
7
+ * - query the `latest` DIST-TAG (not "newest published version"): when a
8
+ * maintainer moves the tag these two diverge, and `latest` is the defined
9
+ * source of truth;
10
+ * - inherit the exact cwd/env the install uses, so a profile-level .npmrc
11
+ * (private registry / auth) is seen by both the query and the install;
12
+ * - fail SOFT: any timeout, spawn error, non-zero exit or unparsable output
13
+ * returns null and the caller installs the declared range (never throws,
14
+ * never blocks onboard).
15
+ */
16
+
17
+ import { execFileSync } from 'node:child_process'
18
+
19
+ // npm dist-tags are usually bare but occasionally carry a leading `v`. Accept
20
+ // both here; the caller normalises the value before building the install spec.
21
+ const VERSION_RE = /^v?\d+\.\d+\.\d+/
22
+ const QUERY_TIMEOUT_MS = 15_000
23
+
24
+ export function queryDistTagLatest(packageName, { cwd, env = process.env, timeout = QUERY_TIMEOUT_MS } = {}) {
25
+ if (!packageName) return null
26
+ try {
27
+ const out = execFileSync('npm', ['view', packageName, 'dist-tags.latest', '--json'], {
28
+ encoding: 'utf8',
29
+ timeout,
30
+ cwd,
31
+ env,
32
+ stdio: ['ignore', 'pipe', 'pipe'],
33
+ }).trim()
34
+ if (!out) return null
35
+
36
+ // Real npm --json prints a quoted string ("0.21.0"); tolerate a bare
37
+ // value too, but reject objects (e.g. a dist-tags map) — that is a
38
+ // different query shape and must not be mistaken for a single version.
39
+ let value = out
40
+ try {
41
+ value = JSON.parse(out)
42
+ } catch {
43
+ /* bare version, keep as-is */
44
+ }
45
+ if (typeof value !== 'string') return null
46
+ const version = value.trim()
47
+ return VERSION_RE.test(version) ? version : null
48
+ } catch {
49
+ return null
50
+ }
51
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiwayds/dsh-tui-pi",
3
- "version": "2.38.1",
3
+ "version": "2.38.2",
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",
@@ -106,7 +106,24 @@
106
106
  "dsh": {
107
107
  "bundle": {
108
108
  "patch": "./cordis.patch.yml"
109
- }
109
+ },
110
+ "companions": [
111
+ {
112
+ "name": "@aiwayds/dsh-subagent-registry",
113
+ "description": "提供 subagent 协作能力,启用多代理任务编排与调度。",
114
+ "required": true
115
+ },
116
+ {
117
+ "name": "@aiwayds/dsh-dcp",
118
+ "description": "提供上下文动态压缩,长会话自动收敛 token 占用。",
119
+ "required": false
120
+ },
121
+ {
122
+ "name": "@aiwayds/dsh-topics-memory",
123
+ "description": "提供会话记忆,跨会话保留长期上下文。",
124
+ "required": false
125
+ }
126
+ ]
110
127
  },
111
128
  "author": "fan56",
112
129
  "publishConfig": {
@@ -56,6 +56,7 @@ dsh 0.1.5 的 `~/.dsh/settings.yaml` 已移除:其顶层 `dsh-tui:` 段会在
56
56
  | `DSH_TUI_COPY_ON_SELECT` | `0` 让拖选仅视觉选中、不自动复制(默认开) |
57
57
  | `DSH_TUI_BTW_CONTEXT_MESSAGES` | `/btw` 侧问快照的最近消息条数 |
58
58
  | `DSH_TUI_SKIP_HOST_CHECK` | `1` 跳过宿主版本下限检查(测试用) |
59
+ | `DSH_TUI_COMPANION_LATEST` | 首次/升级 onboard 时是否把 bundled companions 钉到 registry 的 `dist-tags.latest`(默认开);`0`/`false`/`off` 关闭,关闭后按 `package.json` 声明范围安装。在 bin 层读取,早于 TUI Config;查询失败/跨 major 自动回退声明范围,不阻塞启动 |
59
60
 
60
61
  retention/resume/askUser 组的优先级:**显式配置值 > env > 默认**(只看 entry `config:` 段里
61
62
  实际写下的键,未写的键回落 env,再回落默认)。