@ran-sh/dsh-crew 2.0.8 → 2.0.9

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-crew",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "Dispatch subtasks to DeepSeek Harness (DSH) agents as native subagents with live progress",
5
5
  "author": {
6
6
  "name": "ZSeven-W"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ran-sh/dsh-crew",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "type": "module",
5
5
  "main": "./src/hub/entry.mjs",
6
6
  "bin": {
@@ -518,6 +518,22 @@ export function claudeIntegrationLine(result) {
518
518
  return '✓ Claude Code integration';
519
519
  }
520
520
 
521
+ /**
522
+ * How long to keep watching the plugin snapshot after a failed CLI attempt.
523
+ *
524
+ * Zero unless that attempt timed out. The install is a real copy of the plugin
525
+ * tree, and a timed-out child on Windows is not in the shell's process tree, so
526
+ * it can go on writing after the shell has given up — that is the only case with
527
+ * something to wait for. A `claude` that is not installed exits with status 1 and
528
+ * never started a copy, and a CLI that failed on its own terms has already
529
+ * stopped; waiting on either cost a fixed 180s on every update of a machine
530
+ * without Claude Code, to learn nothing it did not already know.
531
+ */
532
+ export function claudeSnapshotSettleMs(err) {
533
+ const timedOut = err?.code === 'ETIMEDOUT' || err?.signal === 'SIGTERM';
534
+ return timedOut ? CLAUDE_SNAPSHOT_SETTLE_MS : 0;
535
+ }
536
+
521
537
  export async function installClaudeCode({ home = homedir(), statusline = false, root = ROOT } = {}) {
522
538
  const actions = [];
523
539
 
@@ -605,6 +621,9 @@ export async function installClaudeCode({ home = homedir(), statusline = false,
605
621
  actions.push('cli: skipped (non-default home; test mode)');
606
622
  return { ok: true, actions };
607
623
  }
624
+ // Set only when the CLI attempt threw, and only a timeout then justifies
625
+ // waiting for the snapshot: see claudeSnapshotSettleMs.
626
+ let installError = null;
608
627
  try {
609
628
  const { execSync } = await import('node:child_process');
610
629
  // 300s, not 120: the install below runs after the uninstall, so it does a real
@@ -629,6 +648,7 @@ export async function installClaudeCode({ home = homedir(), statusline = false,
629
648
  }
630
649
  actions.push(`cli: plugin snapshot refreshed (${PLUGIN_KEY})`);
631
650
  } catch (err) {
651
+ installError = err;
632
652
  actions.push(`cli: plugin install failed — run manually: claude plugin install ${PLUGIN_KEY} (${String(err?.message ?? err).slice(0, 120)})`);
633
653
  }
634
654
  // Report the state that resulted, not the step that was attempted. The CLI is
@@ -645,7 +665,7 @@ export async function installClaudeCode({ home = homedir(), statusline = false,
645
665
  // is still running keeps writing while this function has already given up on
646
666
  // it. Wait for the snapshot to settle before reporting it missing, or the
647
667
  // update says "not loaded" about a plugin that is loading.
648
- const settleDeadline = Date.now() + CLAUDE_SNAPSHOT_SETTLE_MS;
668
+ const settleDeadline = Date.now() + claudeSnapshotSettleMs(installError);
649
669
  const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
650
670
  while (Date.now() < settleDeadline) {
651
671
  await wait(CLAUDE_SNAPSHOT_POLL_MS);
@@ -36,7 +36,7 @@ export {
36
36
  // included in the identity contract.
37
37
  const RUNTIME_ID = randomUUID();
38
38
 
39
- export const RUNTIME_VERSION = '2.0.8';
39
+ export const RUNTIME_VERSION = '2.0.9';
40
40
  export const HUB_PROTOCOL_VERSION = 1;
41
41
 
42
42
  export const HUB_CAPABILITIES = Object.freeze([