dsh-one-click-polish 1.2.2 → 1.2.4

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 (3) hide show
  1. package/client.js +17 -7
  2. package/index.js +14 -0
  3. package/package.json +1 -1
package/client.js CHANGED
@@ -289,6 +289,7 @@ window.__ModuleLoader__.load({
289
289
  'version.unknown': '查不到最新版本',
290
290
  'version.how': '怎么更新',
291
291
  'version.recheck': '重新检查',
292
+ 'version.updateHint': '卸载后按包名重装即可更新(dsh 不为第三方插件提供更新按钮)',
292
293
  'settings.explore': '检索预算',
293
294
  'settings.explore.hint': '标准/深度润色时会先查资料。这是查资料总共能用多久、最多查几轮。查完后再改写,两者互不占用。',
294
295
  'settings.explore.unit': '秒',
@@ -455,6 +456,7 @@ window.__ModuleLoader__.load({
455
456
  'version.unknown': 'Cannot reach npm',
456
457
  'version.how': 'How to update',
457
458
  'version.recheck': 'Check again',
459
+ 'version.updateHint': 'Uninstall and install by package name to update (dsh offers no update button for third-party plugins)',
458
460
  'settings.explore': 'Lookup budget',
459
461
  'settings.explore.hint': 'A standard or deep polish looks things up first. This is how long that may take in total, and how many rounds it may spend. The rewrite runs separately with its own budget.',
460
462
  'settings.explore.unit': 's',
@@ -591,6 +593,10 @@ window.__ModuleLoader__.load({
591
593
  .dsh-op-versionNew{display:flex;flex-wrap:wrap;align-items:center;gap:8px;
592
594
  font-size:11.5px;color:var(--dsw-alias-state-warn-primary)}
593
595
  .dsh-op-versionBad{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));opacity:.8}
596
+ /* The manual update instruction: present when a newer version exists, quiet enough
597
+ not to compete with the version numbers themselves. */
598
+ .dsh-op-versionHint{flex:1 1 100%;font-size:11px;line-height:16px;
599
+ color:var(--dsw-alias-label-secondary);opacity:.85}
594
600
  /* The busy-wait line: a live counter, so it is monospaced and does not reflow as
595
601
  the seconds tick, and it holds a fixed height so the panel does not jump. */
596
602
  .dsh-op-waiting{font-variant-numeric:tabular-nums;min-height:17px}
@@ -2513,18 +2519,18 @@ window.__ModuleLoader__.load({
2513
2519
  h('div', { className: 'dsh-op-head' },
2514
2520
  h('h2', { className: 'dsh-op-h2' }, t('settings.title')),
2515
2521
  h('p', { className: 'dsh-op-sub' }, t('settings.sub')),
2516
- // dsh's own plugin page can only offer 更新 for bundles in its official
2517
- // catalogue, so a third-party plugin gets no update affordance there.
2518
- // The version line puts that question here instead.
2522
+ // `version` is null until the lookup resolves, so every read of it has to
2523
+ // go through a fallback. Reading `.current` straight off null threw during
2524
+ // render and took the whole settings page down with it.
2519
2525
  h('div', { className: 'dsh-op-version' },
2520
2526
  h('span', { className: 'dsh-op-versionNow' },
2521
- `${t('version.current')} ${version.current === '' ? '?' : version.current}`),
2527
+ `${t('version.current')} ${typeof version?.current === 'string' && version.current !== '' ? version.current : '?'}`),
2522
2528
  version === null
2523
2529
  ? h('span', { className: 'dsh-op-hint dsh-op-hint--inline' }, t('version.checking'))
2524
- : version.error !== null && version.error !== ''
2530
+ : version.error !== null && version.error !== undefined && version.error !== ''
2525
2531
  ? h('span', { className: 'dsh-op-versionBad' },
2526
2532
  `${t('version.unknown')} · ${version.error}`)
2527
- : version.latest === null
2533
+ : version.latest === null || version.latest === undefined
2528
2534
  ? h('span', { className: 'dsh-op-hint dsh-op-hint--inline' }, t('version.unknown'))
2529
2535
  : version.latest !== version.current
2530
2536
  ? h('div', { className: 'dsh-op-versionNew' },
@@ -2539,7 +2545,11 @@ window.__ModuleLoader__.load({
2539
2545
  type: 'button',
2540
2546
  className: 'dsh-op-link',
2541
2547
  onClick: () => { void checkVersion(true) },
2542
- }, t('version.recheck')))
2548
+ }, t('version.recheck')),
2549
+ // dsh derives installTarget only from its official catalogue, so a
2550
+ // third-party plugin has no update button. State the manual step
2551
+ // rather than leaving the user to wonder where one is.
2552
+ h('span', { className: 'dsh-op-versionHint' }, t('version.updateHint')))
2543
2553
  : h('span', { className: 'dsh-op-hint dsh-op-hint--inline' }, t('version.latest')))),
2544
2554
  h('div', { className: 'dsh-op-card' },
2545
2555
  h('div', { className: 'dsh-op-cardTitle' }, t('settings.group.model')),
package/index.js CHANGED
@@ -609,6 +609,20 @@ function allowedRoots(ctx, agent) {
609
609
  function profileDir() {
610
610
  const fromEnv = process.env.DSH_PROFILE_DIR
611
611
  if (typeof fromEnv === 'string' && fromEnv !== '') return fromEnv
612
+
613
+ // Resolve from where this module actually lives: <profile>/node_modules/<pkg>/.
614
+ // That anchor stays correct whatever working directory the Host was launched with,
615
+ // and it is what keeps the run log and the resume checkpoint discoverable after an
616
+ // uninstall-and-reinstall: those files live in the profile rather than in the
617
+ // package, so they survive the uninstall and must still be found afterwards.
618
+ try {
619
+ const here = dirname(fileURLToPath(import.meta.url))
620
+ const profile = join(here, '..', '..')
621
+ if (existsSync(join(profile, 'package.json')) && existsSync(join(profile, 'cordis.patch.yml'))) {
622
+ return profile
623
+ }
624
+ } catch { /* fall through to the working-directory guess */ }
625
+
612
626
  try {
613
627
  const cwd = process.cwd()
614
628
  if (!existsSync(join(cwd, 'cordis.patch.yml'))) return null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-one-click-polish",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "One-click polish, expand and autopilot for the DeepSeek Harness composer: rewrite the draft with the model the session is switched to, expand a one-line wish into a task brief, or let an AI drive a goal round after round.",
5
5
  "keywords": [
6
6
  "dsh",