@aiwayds/dsh-opentui 0.9.5 → 0.9.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiwayds/dsh-opentui",
3
- "version": "0.9.5",
3
+ "version": "0.9.7",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "bin": {
@@ -43,8 +43,10 @@
43
43
  // satisfied — a local development pin is never replaced by a registry version.
44
44
  // Missing deps/versions → ONE batched `dsh plugin --profile opentui add
45
45
  // <specs...>`; on failure the pnpm build-script skeleton is approved and each
46
- // package is retried once on its own; a still-failing package is a WARN, never
47
- // a hard stop (the client still launches).
46
+ // package is installed on its own with bounded spaced retries (a transient
47
+ // registry failure — TLS reset / ERR_PNPM_META_FETCH_FAIL — dies in seconds,
48
+ // a re-attempt after a short gap rides the burst out); a still-failing
49
+ // package is a WARN, never a hard stop (the client still launches).
48
50
  //
49
51
  // Step 4 reparses the profile manifest after the install: `dsh plugin add`
50
52
  // already reconciles bundles for new dependencies, so this only fills the gaps
@@ -86,6 +88,14 @@ import {
86
88
 
87
89
  const TEMPLATE = 'web'
88
90
  const INSTALL_TIMEOUT_MS = 10 * 60 * 1000
91
+ // Bounded retry schedule for a single-spec install that failed (the fallback
92
+ // loop below). A transient registry failure (TLS reset / ERR_PNPM_META_FETCH_
93
+ // FAIL) exits within seconds, so 3 attempts spaced 5s apart ride the burst
94
+ // out without meaningfully extending a healthy provisioning run: the worst
95
+ // case adds ~2 fast failures + 2 x 5s per FAILING spec, and a hung `dsh
96
+ // plugin add` is still bounded by INSTALL_TIMEOUT_MS per invocation.
97
+ const PLUGIN_ADD_ATTEMPTS = 3
98
+ const PLUGIN_ADD_BACKOFF_MS = 5000
89
99
 
90
100
  const args = process.argv.slice(2)
91
101
  /** --name=value or --name value. */
@@ -340,6 +350,12 @@ function runPluginAdd(specs) {
340
350
  })
341
351
  }
342
352
 
353
+ /** Synchronous pause (this script is spawnSync end to end; there is no event
354
+ * loop to await on). */
355
+ function pauseSync(ms) {
356
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms)
357
+ }
358
+
343
359
  const failedInstalls = []
344
360
  let installedCount = 0
345
361
 
@@ -374,13 +390,26 @@ if (tier === 'none') {
374
390
  say(3, 'plugins', 'approved the printed build scripts (pnpm allowBuilds) — retrying one by one…')
375
391
  }
376
392
  // Single-package fallback: one bad package must not sink the rest.
393
+ // Each failing spec gets bounded spaced retries (PLUGIN_ADD_ATTEMPTS /
394
+ // PLUGIN_ADD_BACKOFF_MS): a transient registry failure rides the burst
395
+ // out instead of WARN-ing the plugin away on the first drop. The
396
+ // terminal failure stays a WARN + failedInstalls entry — never a
397
+ // silent pass (the e2e npm-install boot leg asserts the delivered set).
377
398
  for (const spec of specs) {
378
- const retry = runPluginAdd([spec])
379
- if (!retry.error && retry.status === 0) {
380
- installedCount += 1
381
- } else {
382
- failedInstalls.push(spec)
383
- warn(`could not install ${spec}${retry.error ? `: ${retry.error.message}` : ` (exit ${retry.status})`} — continuing`)
399
+ let installed = false
400
+ for (let attempt = 1; attempt <= PLUGIN_ADD_ATTEMPTS && !installed; attempt += 1) {
401
+ if (attempt > 1) {
402
+ say(3, 'plugins', `${spec} failed — retry ${attempt - 1}/${PLUGIN_ADD_ATTEMPTS - 1} in ${PLUGIN_ADD_BACKOFF_MS / 1000}s…`)
403
+ pauseSync(PLUGIN_ADD_BACKOFF_MS)
404
+ }
405
+ const retry = runPluginAdd([spec])
406
+ if (!retry.error && retry.status === 0) {
407
+ installedCount += 1
408
+ installed = true
409
+ } else if (attempt === PLUGIN_ADD_ATTEMPTS) {
410
+ failedInstalls.push(spec)
411
+ warn(`could not install ${spec}${retry.error ? `: ${retry.error.message}` : ` (exit ${retry.status})`} — continuing`)
412
+ }
384
413
  }
385
414
  }
386
415
  }