@askdkc/dsh-cli 0.11.3 → 0.11.5

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.
Files changed (37) hide show
  1. package/README.md +77 -81
  2. package/bin/dsh-tui.js +88 -88
  3. package/cordis.patch.yml +9 -9
  4. package/cordis.yml +8 -8
  5. package/lib/types/adapter/standard/descriptor.js +2 -2
  6. package/lib/types/components/LogoV2.d.ts +1 -1
  7. package/lib/types/components/LogoV2.js +2 -2
  8. package/lib/types/components/ModelPicker.d.ts +6 -0
  9. package/lib/types/components/ModelPicker.d.ts.map +1 -1
  10. package/lib/types/components/ModelPicker.js +9 -6
  11. package/lib/types/dsh-adapter/cli-registration.d.ts +17 -0
  12. package/lib/types/dsh-adapter/cli-registration.d.ts.map +1 -0
  13. package/lib/types/dsh-adapter/cli-registration.js +157 -0
  14. package/lib/types/dsh-adapter/invariant.js +1 -1
  15. package/lib/types/dsh-adapter/migrate/cli.js +9 -9
  16. package/lib/types/dsh-adapter/packaged-presets.d.ts.map +1 -1
  17. package/lib/types/dsh-adapter/packaged-presets.js +3 -2
  18. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  19. package/lib/types/dsh-adapter/plugin.js +16 -0
  20. package/lib/types/i18n.d.ts +20 -4
  21. package/lib/types/i18n.d.ts.map +1 -1
  22. package/lib/types/i18n.js +5 -1
  23. package/lib/types/modelGroups.d.ts +2 -0
  24. package/lib/types/modelGroups.d.ts.map +1 -1
  25. package/lib/types/modelGroups.js +11 -0
  26. package/lib/types/screens/Chat.d.ts.map +1 -1
  27. package/lib/types/screens/Chat.js +147 -39
  28. package/lib/types/screens/chatOverlay.d.ts +6 -0
  29. package/lib/types/screens/chatOverlay.d.ts.map +1 -1
  30. package/lib/types/screens/chatOverlay.js +4 -0
  31. package/lib/types/screens/modelSearchInput.d.ts +4 -0
  32. package/lib/types/screens/modelSearchInput.d.ts.map +1 -0
  33. package/lib/types/screens/modelSearchInput.js +19 -0
  34. package/lib/types/update.d.ts +2 -2
  35. package/lib/types/update.d.ts.map +1 -1
  36. package/lib/types/update.js +33 -32
  37. package/package.json +5 -4
@@ -10,9 +10,10 @@ import { DATA_DIR } from './utils/paths.js';
10
10
  // Re-exported for scripts/verify-update.mjs and the bin launcher, which reads
11
11
  // the compiled copy at lib/types/utils/shellQuote.js.
12
12
  export { shellQuote };
13
- const PACKAGE_NAME = 'dsh-cli';
13
+ const PACKAGE_NAME = '@askdkc/dsh-cli';
14
+ const PACKAGE_BASENAME = 'dsh-cli';
14
15
  const DEFAULT_REGISTRY = 'https://registry.npmjs.org';
15
- const GITHUB_REPO = 'askdkc/dsh-TUI-fork';
16
+ const GITHUB_REPO = 'askdkc/dsh-cli';
16
17
  const UPDATE_CHECK_TIMEOUT_MS = 4000;
17
18
  const STANDALONE_DOWNLOAD_TIMEOUT_MS = 300000;
18
19
  /**
@@ -184,7 +185,7 @@ async function fetchLatestVersion(registryBase) {
184
185
  const controller = new AbortController();
185
186
  const timeout = setTimeout(() => controller.abort(), UPDATE_CHECK_TIMEOUT_MS);
186
187
  try {
187
- const response = await fetch(`${registryBase}/${PACKAGE_NAME}/latest`, {
188
+ const response = await fetch(`${registryBase}/${encodeURIComponent(PACKAGE_NAME)}/latest`, {
188
189
  headers: { accept: 'application/json' },
189
190
  signal: controller.signal,
190
191
  });
@@ -853,7 +854,7 @@ function runProcess(command, args, options = {}) {
853
854
  resolve(code);
854
855
  };
855
856
  child.once('error', error => {
856
- process.stderr.write(`dsh-tui: failed to run ${command}: ${error.message}\n`);
857
+ process.stderr.write(`dsh-cli: failed to run ${command}: ${error.message}\n`);
857
858
  finish(127);
858
859
  });
859
860
  child.once('close', code => finish(code ?? 1));
@@ -1303,7 +1304,7 @@ export function removeStalePackageInstall(profile) {
1303
1304
  }
1304
1305
  try {
1305
1306
  for (const name of readdirSync(scopeDir)) {
1306
- if (!name.startsWith(`${PACKAGE_NAME}_tmp_`) || !/^\d+_\d+$/.test(name.slice(PACKAGE_NAME.length + 5)))
1307
+ if (!name.startsWith(`${PACKAGE_BASENAME}_tmp_`) || !/^\d+_\d+$/.test(name.slice(PACKAGE_BASENAME.length + 5)))
1307
1308
  continue;
1308
1309
  const staging = join(scopeDir, name);
1309
1310
  try {
@@ -1389,7 +1390,7 @@ export function migrateGlobalLauncher() {
1389
1390
  * Install-only half of `/update`: run `dsh plugin add`, refuse boot-deadlock
1390
1391
  * targets, verify the profile actually advanced, and migrate the global
1391
1392
  * launcher. No restart — `updateTuiAndRestart` layers the session-preserving
1392
- * restart on top, and the `dsh-tui update` CLI stops here.
1393
+ * restart on top, and the `dsh-cli update` CLI stops here.
1393
1394
  *
1394
1395
  * @param profile - The dsh profile to update.
1395
1396
  * @param targetVersion - Exact version from the preflight registry check, or
@@ -1411,15 +1412,15 @@ export async function updateTui(profile, targetVersion) {
1411
1412
  : (latestVersion ? `https://github.com/${GITHUB_REPO}/releases/download/v${latestVersion}/${getStandaloneAssetName()}` : undefined);
1412
1413
  const checksumUrl = target.kind === 'update' ? target.checksumUrl : undefined;
1413
1414
  if (downloadUrl === undefined || latestVersion === undefined) {
1414
- process.stderr.write('dsh-tui: 无法解析便携包更新下载地址\n');
1415
+ process.stderr.write('dsh-cli: 无法解析便携包更新下载地址\n');
1415
1416
  return { code: 1, updatedFrom };
1416
1417
  }
1417
- process.stderr.write(`dsh-tui: 正在更新便携包 (${updatedFrom || 'current'} → ${latestVersion})…\n`);
1418
+ process.stderr.write(`dsh-cli: 正在更新便携包 (${updatedFrom || 'current'} → ${latestVersion})…\n`);
1418
1419
  const result = await downloadAndReplaceStandaloneBinary(downloadUrl, msg => {
1419
- process.stderr.write(`dsh-tui: ${msg}\n`);
1420
+ process.stderr.write(`dsh-cli: ${msg}\n`);
1420
1421
  }, checksumUrl);
1421
1422
  if (!result.success) {
1422
- process.stderr.write(`dsh-tui: 便携包更新失败: ${result.error ?? '未知错误'}\n`);
1423
+ process.stderr.write(`dsh-cli: 便携包更新失败: ${result.error ?? '未知错误'}\n`);
1423
1424
  return { code: 1, updatedFrom };
1424
1425
  }
1425
1426
  return { code: 0, updatedFrom, installed: latestVersion };
@@ -1432,7 +1433,7 @@ export async function updateTui(profile, targetVersion) {
1432
1433
  // the profile workspace with explicit `false` entries before pnpm runs.
1433
1434
  const allowBuilds = ensureProfileAllowBuilds(profile);
1434
1435
  if (allowBuilds !== undefined && allowBuilds.added.length > 0) {
1435
- process.stderr.write(`dsh-tui: pre-seeded profile pnpm allowBuilds (${allowBuilds.added.join(', ')}) — ` +
1436
+ process.stderr.write(`dsh-cli: pre-seeded profile pnpm allowBuilds (${allowBuilds.added.join(', ')}) — ` +
1436
1437
  'postinstall-only deps are explicitly ignored\n');
1437
1438
  }
1438
1439
  // Foreign-platform @img/sharp-* optionals are pure download waste (~90MB on
@@ -1440,7 +1441,7 @@ export async function updateTui(profile, targetVersion) {
1440
1441
  // machine (each update recomputes it) so pnpm never fetches them.
1441
1442
  const sharpFilter = ensureProfileSharpPlatformFilter(profile);
1442
1443
  if (sharpFilter !== undefined && sharpFilter.changed) {
1443
- process.stderr.write(`dsh-tui: sharp platform filter updated (${sharpFilter.entries.length} foreign-platform patterns ignored) — ` +
1444
+ process.stderr.write(`dsh-cli: sharp platform filter updated (${sharpFilter.entries.length} foreign-platform patterns ignored) — ` +
1444
1445
  `this profile's install keeps only the current platform's natives\n`);
1445
1446
  }
1446
1447
  // pnpm ≥11's minimumReleaseAge (24h by default) refuses installs of
@@ -1451,7 +1452,7 @@ export async function updateTui(profile, targetVersion) {
1451
1452
  if (targetVersion !== undefined) {
1452
1453
  const releaseAge = ensureProfileReleaseAgeExclude(profile, targetVersion);
1453
1454
  if (releaseAge !== undefined && releaseAge.changed) {
1454
- process.stderr.write(`dsh-tui: pre-seeded profile release-age exclusion (${PACKAGE_NAME}@${targetVersion}) — ` +
1455
+ process.stderr.write(`dsh-cli: pre-seeded profile release-age exclusion (${PACKAGE_NAME}@${targetVersion}) — ` +
1455
1456
  'a freshly published version installs without the 24h supply-chain delay\n');
1456
1457
  }
1457
1458
  }
@@ -1462,7 +1463,7 @@ export async function updateTui(profile, targetVersion) {
1462
1463
  // command once — it succeeds on a clean second run, and only the
1463
1464
  // `_tmp_<pid>` race signature qualifies, never a real resolution error.
1464
1465
  if (updateCode !== 0 && isTransientUpdateFailure(updateStderr)) {
1465
- process.stderr.write('dsh-tui: transient pnpm failure (Windows tmp-rename race) — retrying once…\n');
1466
+ process.stderr.write('dsh-cli: transient pnpm failure (Windows tmp-rename race) — retrying once…\n');
1466
1467
  updateStderr = '';
1467
1468
  updateCode = await runProcess(dsh, updateArgs, { shell: true, onStderr: capture });
1468
1469
  }
@@ -1476,7 +1477,7 @@ export async function updateTui(profile, targetVersion) {
1476
1477
  const flavor = isEexistTmpRenameFailure(updateStderr) ? 'EEXIST, issue #479' : 'retry failed, issue #225';
1477
1478
  const removal = removeStalePackageInstall(profile);
1478
1479
  const stagingNote = removal.tmpDirs.length > 0 ? ` + ${removal.tmpDirs.length} staging dir(s)` : '';
1479
- process.stderr.write(`dsh-tui: pnpm tmp-rename race (${flavor}) — cleared the stale install ` +
1480
+ process.stderr.write(`dsh-cli: pnpm tmp-rename race (${flavor}) — cleared the stale install ` +
1480
1481
  `(package dir: ${removal.packageDir}${stagingNote}) and rerunning the update…\n`);
1481
1482
  updateStderr = '';
1482
1483
  updateCode = await runProcess(dsh, updateArgs, { shell: true, onStderr: capture });
@@ -1491,7 +1492,7 @@ export async function updateTui(profile, targetVersion) {
1491
1492
  // boots) and gets the repair hint on the next /update instead.
1492
1493
  const installedNow = installedTuiVersion();
1493
1494
  if (installedNow !== undefined && installedNow !== updatedFrom && isBootDeadlockTarget(installedNow)) {
1494
- process.stderr.write(`dsh-tui: update landed on ${installedNow}, which can permanently deadlock boot under older launcher patches ` +
1495
+ process.stderr.write(`dsh-cli: update landed on ${installedNow}, which can permanently deadlock boot under older launcher patches ` +
1495
1496
  `(#183/#307) — NOT restarting into it. Repair with:\n` +
1496
1497
  ` dsh plugin --profile ${profile} add ${PACKAGE_NAME}@latest\n` +
1497
1498
  `(if the mirror has not synced the latest release yet, retry later)\n`);
@@ -1509,7 +1510,7 @@ export async function updateTui(profile, targetVersion) {
1509
1510
  installed = installedTuiVersion();
1510
1511
  }
1511
1512
  if (installed !== targetVersion) {
1512
- process.stderr.write(`dsh-tui: update completed but the profile still runs ${installed ?? 'an unreadable version'} ` +
1513
+ process.stderr.write(`dsh-cli: update completed but the profile still runs ${installed ?? 'an unreadable version'} ` +
1513
1514
  `(expected ${targetVersion}) — the profile is half-updated. Repair manually with:\n` +
1514
1515
  ` dsh plugin --profile ${profile} add ${PACKAGE_NAME}@${targetVersion}\n`);
1515
1516
  return { code: 1, updatedFrom, installed };
@@ -1520,7 +1521,7 @@ export async function updateTui(profile, targetVersion) {
1520
1521
  // time the outer copy can lag. Best-effort; the alignment warning stays as
1521
1522
  // the fallback when the copy is impossible.
1522
1523
  if (migrateGlobalLauncher()) {
1523
- process.stderr.write('dsh-tui: global launcher aligned to the delegating shim (no manual npm i -g needed anymore).\n');
1524
+ process.stderr.write('dsh-cli: global launcher aligned to the delegating shim (no manual npm i -g needed anymore).\n');
1524
1525
  }
1525
1526
  return { code: 0, updatedFrom, installed: installedTuiVersion() };
1526
1527
  }
@@ -1561,7 +1562,7 @@ export async function updateTuiAndRestart(sessionId, profile, targetVersion) {
1561
1562
  return { updateCode: 0, restartCode };
1562
1563
  }
1563
1564
  /**
1564
- * Headless `dsh-tui update`: the `/update` decision flow (preflight, deadlock
1565
+ * Headless `dsh-cli update`: the `/update` decision flow (preflight, deadlock
1565
1566
  * refusal, mirror-lag note, `--latest` fallback) followed by the install-only
1566
1567
  * half — no TUI, no restart. The bin launcher dynamic-imports this from the
1567
1568
  * profile copy's compiled lib.
@@ -1572,19 +1573,19 @@ export async function updateTuiAndRestart(sessionId, profile, targetVersion) {
1572
1573
  export async function cliUpdate(profile) {
1573
1574
  const target = await resolveTuiUpdateTarget();
1574
1575
  if (target.kind === 'latest') {
1575
- process.stdout.write(`dsh-tui: already the latest version (${target.current}).\n`);
1576
+ process.stdout.write(`dsh-cli: already the latest version (${target.current}).\n`);
1576
1577
  return 0;
1577
1578
  }
1578
1579
  if (isStandaloneRuntime()) {
1579
1580
  if (target.kind === 'update') {
1580
- process.stdout.write(`dsh-tui: updating standalone binary ${target.current} → ${target.latest}…\n`);
1581
+ process.stdout.write(`dsh-cli: updating standalone binary ${target.current} → ${target.latest}…\n`);
1581
1582
  const outcome = await updateTui(profile, target.latest);
1582
1583
  if (outcome.code === 0) {
1583
- process.stdout.write(`dsh-tui: standalone binary updated successfully (${outcome.updatedFrom || target.current} → ${outcome.installed}).\n`);
1584
+ process.stdout.write(`dsh-cli: standalone binary updated successfully (${outcome.updatedFrom || target.current} → ${outcome.installed}).\n`);
1584
1585
  }
1585
1586
  return outcome.code;
1586
1587
  }
1587
- process.stderr.write('dsh-tui: version check failed (offline or unreachable registry).\n');
1588
+ process.stderr.write('dsh-cli: version check failed (offline or unreachable registry).\n');
1588
1589
  return 1;
1589
1590
  }
1590
1591
  let targetVersion;
@@ -1593,19 +1594,19 @@ export async function cliUpdate(profile) {
1593
1594
  // range (permanent boot deadlock under older launcher patches, #183/#307)
1594
1595
  // instead of installing it.
1595
1596
  if (isBootDeadlockTarget(target.latest)) {
1596
- process.stderr.write(`dsh-tui: refusing to update onto ${target.latest} — that range can permanently deadlock boot ` +
1597
+ process.stderr.write(`dsh-cli: refusing to update onto ${target.latest} — that range can permanently deadlock boot ` +
1597
1598
  `(#183/#307). Latest on the official registry: ${target.authoritative ?? target.latest}. ` +
1598
1599
  `If you use a mirror, retry after it syncs.\n`);
1599
1600
  return 1;
1600
1601
  }
1601
1602
  if (target.authoritative !== undefined) {
1602
- process.stdout.write(`dsh-tui: note — your registry serves ${target.latest} while npmjs.org has ${target.authoritative} (mirror lag).\n`);
1603
+ process.stdout.write(`dsh-cli: note — your registry serves ${target.latest} while npmjs.org has ${target.authoritative} (mirror lag).\n`);
1603
1604
  }
1604
1605
  targetVersion = target.latest;
1605
- process.stdout.write(`dsh-tui: updating ${target.current} → ${target.latest}…\n`);
1606
+ process.stdout.write(`dsh-cli: updating ${target.current} → ${target.latest}…\n`);
1606
1607
  }
1607
1608
  else {
1608
- process.stdout.write('dsh-tui: version check failed (offline or unreadable install) — falling back to `--latest`.\n');
1609
+ process.stdout.write('dsh-cli: version check failed (offline or unreadable install) — falling back to `--latest`.\n');
1609
1610
  }
1610
1611
  const outcome = await updateTui(profile, targetVersion);
1611
1612
  if (outcome.code === 0) {
@@ -1614,10 +1615,10 @@ export async function cliUpdate(profile) {
1614
1615
  // vacuous `updated X → X` — the /update path surfaces the same state via
1615
1616
  // the DSH_TUI_UPDATED_FROM stamp on restart.
1616
1617
  if (targetVersion === undefined && outcome.installed !== undefined && outcome.installed === outcome.updatedFrom) {
1617
- process.stdout.write(`dsh-tui: version did not advance (still ${outcome.installed}) — already the latest, or the registry has no newer release yet.\n`);
1618
+ process.stdout.write(`dsh-cli: version did not advance (still ${outcome.installed}) — already the latest, or the registry has no newer release yet.\n`);
1618
1619
  }
1619
1620
  else {
1620
- process.stdout.write(`dsh-tui: updated ${outcome.updatedFrom || '(unknown)'} → ${outcome.installed ?? '(unreadable)'}.\n`);
1621
+ process.stdout.write(`dsh-cli: updated ${outcome.updatedFrom || '(unknown)'} → ${outcome.installed ?? '(unreadable)'}.\n`);
1621
1622
  }
1622
1623
  }
1623
1624
  return outcome.code;
@@ -1721,7 +1722,7 @@ export async function restartTui(sessionId, options = {}) {
1721
1722
  child.once('error', error => {
1722
1723
  clearTimeout(timer);
1723
1724
  logRestartEvent(`${tag}: spawn error`, { message: error.message });
1724
- writeHandoffNotice(`dsh-tui: failed to spawn the restart: ${error.message}\n`);
1725
+ writeHandoffNotice(`dsh-cli: failed to spawn the restart: ${error.message}\n`);
1725
1726
  resolve(127);
1726
1727
  });
1727
1728
  child.once('close', (code, signal) => {
@@ -1737,13 +1738,13 @@ export async function restartTui(sessionId, options = {}) {
1737
1738
  // process.exit() right after an async stream write skips the flush,
1738
1739
  // and a vanished diagnosis is indistinguishable from silent failure.
1739
1740
  const suffix = childStderr.trim() === '' ? '' : `\n${childStderr.trimEnd()}`;
1740
- writeHandoffNotice(`dsh-tui: restart child exited during the handoff (code ${code ?? 'null'}` +
1741
+ writeHandoffNotice(`dsh-cli: restart child exited during the handoff (code ${code ?? 'null'}` +
1741
1742
  `${signal === undefined || signal === null ? '' : `, signal ${signal}`}) — the TUI did not come up.` +
1742
1743
  `${suffix}\nYour session is preserved; resume with the launcher or retry the command.\n`);
1743
1744
  }
1744
1745
  else if (code !== 0 && code !== null) {
1745
1746
  // Late nonzero exit: the session ended abnormally, say so briefly.
1746
- writeHandoffNotice(`\ndsh-tui: the restarted session exited with code ${code}.\n`);
1747
+ writeHandoffNotice(`\ndsh-cli: the restarted session exited with code ${code}.\n`);
1747
1748
  }
1748
1749
  resolve(code ?? 1);
1749
1750
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askdkc/dsh-cli",
3
- "version": "0.11.3",
3
+ "version": "0.11.5",
4
4
  "description": "Interactive terminal interface for DeepSeek Harness agents, sessions and tools.",
5
5
  "keywords": [
6
6
  "dsh",
@@ -22,12 +22,12 @@
22
22
  },
23
23
  "repository": {
24
24
  "type": "git",
25
- "url": "https://github.com/askdkc/dsh-TUI-fork.git"
25
+ "url": "https://github.com/askdkc/dsh-cli.git"
26
26
  },
27
27
  "bugs": {
28
- "url": "https://github.com/askdkc/dsh-TUI-fork/issues"
28
+ "url": "https://github.com/askdkc/dsh-cli/issues"
29
29
  },
30
- "homepage": "https://github.com/askdkc/dsh-TUI-fork#readme",
30
+ "homepage": "https://github.com/askdkc/dsh-cli#readme",
31
31
  "packageManager": "pnpm@11.21.0",
32
32
  "publishConfig": {
33
33
  "access": "public"
@@ -39,6 +39,7 @@
39
39
  "#dsh-ecosystem-spec/tui-contributions": "./dsh-ecosystem-spec/protocols/tui-contributions.js"
40
40
  },
41
41
  "bin": {
42
+ "dsh-cli": "./bin/dsh-tui.js",
42
43
  "dsh-tui": "./bin/dsh-tui.js",
43
44
  "dst": "./bin/dsh-tui.js"
44
45
  },