@aiwayds/dsh-opentui 0.18.7 → 0.19.1
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/CHANGELOG.md +47 -1
- package/bin/dsh-opentui.mjs +30 -6
- package/dist/client/index.js +21 -7
- package/dist/client/index.js.map +5 -5
- package/dist/host-launch.mjs +8 -4
- package/dist/host-launch.mjs.map +5 -5
- package/dist/watchdog.mjs +15 -6
- package/dist/watchdog.mjs.map +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,45 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [0.
|
|
8
|
+
## [0.19.1] - 2026-11-17
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- The launcher spawns the client asynchronously. Host processes were previously
|
|
12
|
+
left as unreaped zombies for the whole client session, because the synchronous
|
|
13
|
+
spawn blocked the event loop that reaps them. A client killed by a signal now
|
|
14
|
+
also reports `128 + signal` instead of exiting 0.
|
|
15
|
+
- Stopping a host under a non-default profile works again: the
|
|
16
|
+
process-identification check compared the command line against the hardcoded
|
|
17
|
+
`opentui` profile instead of the profile the registry record was read for.
|
|
18
|
+
- The watchdog backs off when the host refuses to stop (capped at 30s) instead
|
|
19
|
+
of re-probing every tick forever.
|
|
20
|
+
- The `widgets-dock` fade-window test samples across a window derived from the
|
|
21
|
+
visibility constants instead of one fixed instant, so a slow CI runner no
|
|
22
|
+
longer fails it. The live remote smoke test builds its own scratch git
|
|
23
|
+
repository instead of relying on the checkout's branch.
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
- ADR-0009 is Accepted. The phase-2 workspace-config extension is deferred:
|
|
27
|
+
skills, AGENTS.md and theme/model already resolve per session cwd; only
|
|
28
|
+
settings and tools are profile-scoped. Give each project its own `DSH_HOME`
|
|
29
|
+
if it needs a different tool set today.
|
|
30
|
+
|
|
31
|
+
## [0.19.0] - 2026-11-17
|
|
32
|
+
|
|
33
|
+
0.18.7 carried the same code but shipped these lifecycle changes as a patch;
|
|
34
|
+
it is deprecated in favour of 0.19.0.
|
|
35
|
+
|
|
36
|
+
### BREAKING CHANGES
|
|
37
|
+
- The resident host no longer exits 5s after going idle. It now shuts down
|
|
38
|
+
once the last client exits (2s grace). `DSH_OPENTUI_HOST_IDLE_MS` keeps its
|
|
39
|
+
name but now means "last-one grace override" (default 2000); `0` means
|
|
40
|
+
resident. Scripts that relied on the 5s idle window must set it explicitly.
|
|
41
|
+
- The host registry moved to schema v2. v1 records are treated as legacy and
|
|
42
|
+
never overwritten or signalled; a live v1 host is left for stale cleanup
|
|
43
|
+
only. Tooling that parsed `opentui-host.<profile>.json` must accept
|
|
44
|
+
`version: 2`.
|
|
45
|
+
- `--force` without `--yes` now exits 2 and leaves the host untouched while
|
|
46
|
+
clients are still live. Automation calling `--force` must add `--yes`.
|
|
9
47
|
|
|
10
48
|
### Changed
|
|
11
49
|
- One host service per `(DSH_HOME, profile)`, on a port derived from the home
|
|
@@ -29,6 +67,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
29
67
|
still answers `kill(pid, 0)`, which used to look like "still running" and
|
|
30
68
|
abort the reset.
|
|
31
69
|
|
|
70
|
+
### Migration
|
|
71
|
+
- Replace 5s-idle assumptions: set `DSH_OPENTUI_HOST_IDLE_MS` explicitly to keep
|
|
72
|
+
the old grace, or `0` for a resident host; the new default is 2000ms.
|
|
73
|
+
- Update tooling reading `opentui-host.<profile>.json` to accept `version: 2`;
|
|
74
|
+
treat leftover v1 records as legacy and let stale cleanup remove them.
|
|
75
|
+
- Add `--yes` to every automation call that uses `--force`, or handle exit 2 and
|
|
76
|
+
leave the host untouched while clients are live.
|
|
77
|
+
|
|
32
78
|
## [0.18.6] - 2026-11-17
|
|
33
79
|
|
|
34
80
|
### Changed
|
package/bin/dsh-opentui.mjs
CHANGED
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
* package root (plus `dist/scripts/idle-reaper.mjs`, which the bundle
|
|
48
48
|
* spawns) alongside `bin/` and `scripts/`.
|
|
49
49
|
*/
|
|
50
|
-
import { spawnSync } from 'node:child_process'
|
|
50
|
+
import { spawn, spawnSync } from 'node:child_process'
|
|
51
51
|
import { existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, renameSync, symlinkSync, unlinkSync, writeFileSync } from 'node:fs'
|
|
52
|
-
import { homedir } from 'node:os'
|
|
52
|
+
import { constants as osConstants, homedir } from 'node:os'
|
|
53
53
|
import { dirname, join } from 'node:path'
|
|
54
54
|
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
55
55
|
import { formatUpgradeUsage, formatUsage, LAUNCHER_TIMEOUT_FLAGS, parseLauncherArgs, parseLauncherOptions, parseUpgradeArgs, prelaunchFailurePolicy, readLauncherVersion, validateLauncherArgs } from './lib/launcher.mjs'
|
|
@@ -452,12 +452,36 @@ if (!clientArgs.includes('--dry-run')) {
|
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
454
|
|
|
455
|
-
|
|
455
|
+
// ADR-0009 follow-up (PR B): spawnSync blocked the launcher's event loop for
|
|
456
|
+
// the whole TUI session, so SIGCHLD could never be delivered — the detached,
|
|
457
|
+
// unref'd host child died but stayed a zombie until the client exited. An
|
|
458
|
+
// async spawn keeps libuv alive so the host is reaped as soon as it exits.
|
|
459
|
+
const child = spawn('bun', [clientEntry, ...clientArgs], {
|
|
456
460
|
stdio: 'inherit',
|
|
457
461
|
env: clientEnv,
|
|
462
|
+
// No `detached`: the client stays in the launcher's foreground process
|
|
463
|
+
// group, preserving TTY / Ctrl-C semantics.
|
|
458
464
|
})
|
|
459
|
-
|
|
460
|
-
console.error(`dsh-opentui: failed to launch the client: ${
|
|
465
|
+
child.on('error', (err) => {
|
|
466
|
+
console.error(`dsh-opentui: failed to launch the client: ${err.message}`)
|
|
461
467
|
process.exit(1)
|
|
468
|
+
})
|
|
469
|
+
|
|
470
|
+
// Forward terminal signals to the client; do NOT exit here. We rely on the
|
|
471
|
+
// client's handler being idempotent — boot-shared.ts `exitAfterShutdown` is an
|
|
472
|
+
// idempotent shutdown + 2.5s grace — so a transitive signal from the tty (the
|
|
473
|
+
// client shares our process group) plus this forward cannot strand it. The
|
|
474
|
+
// launcher waits for the client to exit, then derives its own exit code below.
|
|
475
|
+
for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
|
|
476
|
+
process.on(signal, () => {
|
|
477
|
+
child.kill(signal)
|
|
478
|
+
})
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// `resolve` forwards only its first argument, so pack both exit-event args.
|
|
482
|
+
const [exitCode, signal] = await new Promise((resolve) => child.on('exit', (code, sig) => resolve([code, sig])))
|
|
483
|
+
if (signal) {
|
|
484
|
+
// Signal death used to be mis-reported as 0 by `result.status ?? 0`.
|
|
485
|
+
process.exit(128 + (osConstants.signals[signal] ?? 0))
|
|
462
486
|
}
|
|
463
|
-
process.exit(
|
|
487
|
+
process.exit(exitCode ?? 0)
|
package/dist/client/index.js
CHANGED
|
@@ -581,7 +581,7 @@ function defaultPidAlive(pid) {
|
|
|
581
581
|
return false;
|
|
582
582
|
return true;
|
|
583
583
|
}
|
|
584
|
-
function evidencesAgree(pid, registryPid, hooks) {
|
|
584
|
+
function evidencesAgree(pid, registryPid, hooks, expectedProfile = HOST_PROFILE) {
|
|
585
585
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
586
586
|
return false;
|
|
587
587
|
if (registryPid !== pid)
|
|
@@ -590,7 +590,7 @@ function evidencesAgree(pid, registryPid, hooks) {
|
|
|
590
590
|
if (!cmd)
|
|
591
591
|
return false;
|
|
592
592
|
const profiles = [...cmd.matchAll(/--profile[= ]+([^\s]+)/g)].map((m) => m[1]);
|
|
593
|
-
if (profiles.length === 0 || profiles.some((p) => p !==
|
|
593
|
+
if (profiles.length === 0 || profiles.some((p) => p !== expectedProfile))
|
|
594
594
|
return false;
|
|
595
595
|
if (hooks.hasServerEnv(pid))
|
|
596
596
|
return true;
|
|
@@ -617,13 +617,14 @@ async function safeStopHost(options) {
|
|
|
617
617
|
pid,
|
|
618
618
|
registryPid,
|
|
619
619
|
hooks,
|
|
620
|
+
profile = HOST_PROFILE,
|
|
620
621
|
termGraceMs = DEFAULT_TERM_GRACE_MS,
|
|
621
622
|
killGraceMs = DEFAULT_KILL_GRACE_MS,
|
|
622
623
|
sleep = defaultSleep,
|
|
623
624
|
pidAlive = hooks.pidAlive ?? defaultPidAlive,
|
|
624
625
|
now = Date.now
|
|
625
626
|
} = options;
|
|
626
|
-
if (!evidencesAgree(pid, registryPid, hooks)) {
|
|
627
|
+
if (!evidencesAgree(pid, registryPid, hooks, profile)) {
|
|
627
628
|
return { attempted: false, evidencesOk: false, signals: [], stopped: !pidAlive(pid) };
|
|
628
629
|
}
|
|
629
630
|
const signals = [];
|
|
@@ -1125,6 +1126,7 @@ async function ensureHost(deps = {}) {
|
|
|
1125
1126
|
pid: forcePid,
|
|
1126
1127
|
registryPid: forcePid,
|
|
1127
1128
|
hooks: o.killHooks,
|
|
1129
|
+
profile: o.profile,
|
|
1128
1130
|
termGraceMs: FORCE_TERM_GRACE_MS,
|
|
1129
1131
|
killGraceMs: FORCE_KILL_GRACE_MS,
|
|
1130
1132
|
sleep: o.sleep,
|
|
@@ -1183,6 +1185,7 @@ async function ensureHost(deps = {}) {
|
|
|
1183
1185
|
pid: read.value.pid,
|
|
1184
1186
|
registryPid: read.value.pid,
|
|
1185
1187
|
hooks: o.killHooks,
|
|
1188
|
+
profile: o.profile,
|
|
1186
1189
|
termGraceMs: FORCE_TERM_GRACE_MS,
|
|
1187
1190
|
killGraceMs: FORCE_KILL_GRACE_MS,
|
|
1188
1191
|
sleep: o.sleep,
|
|
@@ -1265,6 +1268,7 @@ async function ensureHost(deps = {}) {
|
|
|
1265
1268
|
pid: child.pid,
|
|
1266
1269
|
registryPid,
|
|
1267
1270
|
hooks: o.killHooks,
|
|
1271
|
+
profile: o.profile,
|
|
1268
1272
|
termGraceMs: FORCE_TERM_GRACE_MS,
|
|
1269
1273
|
killGraceMs: FORCE_KILL_GRACE_MS,
|
|
1270
1274
|
sleep: o.sleep,
|
|
@@ -2500,6 +2504,7 @@ __export(exports_client_lifecycle, {
|
|
|
2500
2504
|
ENV_WATCHDOG_PROFILE: () => ENV_WATCHDOG_PROFILE,
|
|
2501
2505
|
ForceNeedsYesError: () => ForceNeedsYesError,
|
|
2502
2506
|
IncompleteLifecycleFsError: () => IncompleteLifecycleFsError,
|
|
2507
|
+
WATCHDOG_MAX_BACKOFF_MS: () => WATCHDOG_MAX_BACKOFF_MS,
|
|
2503
2508
|
assertForceAllowed: () => assertForceAllowed,
|
|
2504
2509
|
clientsDir: () => clientsDir,
|
|
2505
2510
|
freshClients: () => freshClients,
|
|
@@ -2718,6 +2723,7 @@ async function lastOneGracefulShutdown(home, options) {
|
|
|
2718
2723
|
pid: read.value.pid,
|
|
2719
2724
|
registryPid: read.value.pid,
|
|
2720
2725
|
hooks: options.hooks,
|
|
2726
|
+
profile,
|
|
2721
2727
|
termGraceMs: options.termGraceMs,
|
|
2722
2728
|
killGraceMs: options.killGraceMs,
|
|
2723
2729
|
sleep,
|
|
@@ -2760,9 +2766,11 @@ async function runWatchdog(home, options) {
|
|
|
2760
2766
|
const sleep = options.sleep ?? defaultSleep3;
|
|
2761
2767
|
const alive = options.hooks.pidAlive ?? defaultPidAlive;
|
|
2762
2768
|
const fs = options.fs ?? nodeLifecycleFs;
|
|
2769
|
+
let failStreak = 0;
|
|
2763
2770
|
for (let tick = 0;options.maxTicks === undefined || tick < options.maxTicks; tick++) {
|
|
2764
2771
|
const read = readRegistry(home, profile, fs);
|
|
2765
2772
|
if (read.kind !== "v2" || read.value.pid <= 0 || !alive(read.value.pid)) {
|
|
2773
|
+
failStreak = 0;
|
|
2766
2774
|
if (read.kind === "v2" && !alive(read.value.pid)) {
|
|
2767
2775
|
try {
|
|
2768
2776
|
fs.unlinkSync(registryPath(home, profile));
|
|
@@ -2773,6 +2781,7 @@ async function runWatchdog(home, options) {
|
|
|
2773
2781
|
const freshCount = freshClients(home, options, options.ttlMs).length;
|
|
2774
2782
|
options.onTick?.({ tick, freshCount, hostPid: read.value.pid });
|
|
2775
2783
|
if (freshCount > 0) {
|
|
2784
|
+
failStreak = 0;
|
|
2776
2785
|
await sleep(pollMs);
|
|
2777
2786
|
continue;
|
|
2778
2787
|
}
|
|
@@ -2780,14 +2789,17 @@ async function runWatchdog(home, options) {
|
|
|
2780
2789
|
const again = readRegistry(home, profile, fs);
|
|
2781
2790
|
if (again.kind !== "v2" || again.value.pid !== read.value.pid)
|
|
2782
2791
|
continue;
|
|
2783
|
-
if (freshClients(home, options, options.ttlMs).length > 0)
|
|
2792
|
+
if (freshClients(home, options, options.ttlMs).length > 0) {
|
|
2793
|
+
failStreak = 0;
|
|
2784
2794
|
continue;
|
|
2795
|
+
}
|
|
2785
2796
|
if (!alive(again.value.pid))
|
|
2786
2797
|
continue;
|
|
2787
2798
|
const stop = await safeStopHost({
|
|
2788
2799
|
pid: again.value.pid,
|
|
2789
2800
|
registryPid: again.value.pid,
|
|
2790
2801
|
hooks: options.hooks,
|
|
2802
|
+
profile,
|
|
2791
2803
|
termGraceMs: options.termGraceMs,
|
|
2792
2804
|
killGraceMs: options.killGraceMs,
|
|
2793
2805
|
sleep,
|
|
@@ -2796,6 +2808,8 @@ async function runWatchdog(home, options) {
|
|
|
2796
2808
|
});
|
|
2797
2809
|
if (!stop.stopped) {
|
|
2798
2810
|
options.onEvidenceRefused?.({ pid: again.value.pid, evidencesOk: stop.evidencesOk });
|
|
2811
|
+
await sleep(Math.min(graceMs * 2 ** failStreak, WATCHDOG_MAX_BACKOFF_MS));
|
|
2812
|
+
failStreak = Math.min(failStreak + 1, 30);
|
|
2799
2813
|
continue;
|
|
2800
2814
|
}
|
|
2801
2815
|
clearRegistryIfPid(home, profile, again, again.value.pid, fs);
|
|
@@ -2826,7 +2840,7 @@ function defaultSpawnWatchdog(command, args, options) {
|
|
|
2826
2840
|
child.unref();
|
|
2827
2841
|
return child;
|
|
2828
2842
|
}
|
|
2829
|
-
var CLIENTS_DIR_NAME = "opentui-clients", DEFAULT_HEARTBEAT_INTERVAL_MS = 3000, DEFAULT_CLIENT_TTL_MS = 15000, DEFAULT_LAST_ONE_GRACE_MS = 2000, ENV_IDLE_MS = "DSH_OPENTUI_HOST_IDLE_MS", DEFAULT_WATCHDOG_POLL_MS = 1000, ENV_WATCHDOG = "DSH_OPENTUI_WATCHDOG", ENV_WATCHDOG_HOME = "DSH_OPENTUI_WATCHDOG_HOME", ENV_WATCHDOG_PROFILE = "DSH_OPENTUI_WATCHDOG_PROFILE", nodeLifecycleFs, defaultSleep3 = (ms) => new Promise((resolve) => setTimeout(resolve, ms)), ForceNeedsYesError, IncompleteLifecycleFsError;
|
|
2843
|
+
var CLIENTS_DIR_NAME = "opentui-clients", DEFAULT_HEARTBEAT_INTERVAL_MS = 3000, DEFAULT_CLIENT_TTL_MS = 15000, DEFAULT_LAST_ONE_GRACE_MS = 2000, ENV_IDLE_MS = "DSH_OPENTUI_HOST_IDLE_MS", DEFAULT_WATCHDOG_POLL_MS = 1000, WATCHDOG_MAX_BACKOFF_MS = 30000, ENV_WATCHDOG = "DSH_OPENTUI_WATCHDOG", ENV_WATCHDOG_HOME = "DSH_OPENTUI_WATCHDOG_HOME", ENV_WATCHDOG_PROFILE = "DSH_OPENTUI_WATCHDOG_PROFILE", nodeLifecycleFs, defaultSleep3 = (ms) => new Promise((resolve) => setTimeout(resolve, ms)), ForceNeedsYesError, IncompleteLifecycleFsError;
|
|
2830
2844
|
var init_client_lifecycle = __esm(() => {
|
|
2831
2845
|
init_host_registry();
|
|
2832
2846
|
init_safe_kill();
|
|
@@ -62418,7 +62432,7 @@ var init_subagents_viewer = __esm(() => {
|
|
|
62418
62432
|
import { TextAttributes as TextAttributes12 } from "@opentui/core";
|
|
62419
62433
|
function resolveVersion() {
|
|
62420
62434
|
try {
|
|
62421
|
-
return "0.
|
|
62435
|
+
return "0.19.1";
|
|
62422
62436
|
} catch {
|
|
62423
62437
|
return "dev";
|
|
62424
62438
|
}
|
|
@@ -66056,5 +66070,5 @@ export {
|
|
|
66056
66070
|
themeNameFromConfig
|
|
66057
66071
|
};
|
|
66058
66072
|
|
|
66059
|
-
//# debugId=
|
|
66073
|
+
//# debugId=9C95BF45B128B31364756E2164756E21
|
|
66060
66074
|
//# sourceMappingURL=index.js.map
|