@dmsdc-ai/aigentry-telepty 0.5.0 → 0.5.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 +19 -0
- package/cli.js +4 -0
- package/daemon.js +6 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,25 @@ All notable changes to `@dmsdc-ai/aigentry-telepty` are documented here.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.5.1] - 2026-05-30
|
|
8
|
+
|
|
9
|
+
### Fixed — daemon never started (CRITICAL, regresses 0.5.0)
|
|
10
|
+
|
|
11
|
+
- **The daemon failed to start for all users on 0.5.0.** `daemon.js` guarded
|
|
12
|
+
`app.listen()` behind `require.main === module` (added in 0.5.0 for test
|
|
13
|
+
isolation so `require('./daemon.js')` is side-effect-free). But the production
|
|
14
|
+
CLI launches the daemon via `require('./daemon.js')` (`telepty daemon`, and the
|
|
15
|
+
auto-start spawns `node cli.js daemon`), so `require.main` is always `cli.js` —
|
|
16
|
+
`app.listen` never ran, the process exited 0 right after `[PERSIST] Restored
|
|
17
|
+
session … (awaiting reconnect)`, and every CLI reported `Daemon restart failed
|
|
18
|
+
after 3 attempts` / `fetch failed`. **Fix:** `cli.js` sets
|
|
19
|
+
`AIGENTRY_TELEPTY_DAEMON_MAIN=1` before requiring `daemon.js`; the guard is now
|
|
20
|
+
`require.main === module || process.env.AIGENTRY_TELEPTY_DAEMON_MAIN === '1'`.
|
|
21
|
+
Tests that `require()` daemon.js without the env stay side-effect-free. (telepty#15)
|
|
22
|
+
- Follow-up (tracked): a daemon-launch integration smoke test — assert the HTTP
|
|
23
|
+
endpoint responds when the daemon is launched via the real CLI path. The unit-test
|
|
24
|
+
guard masked this regression; an integration test would have caught it.
|
|
25
|
+
|
|
7
26
|
## [0.5.0] - 2026-05-30
|
|
8
27
|
|
|
9
28
|
### Changed — Surface-ownership boundary (ADR 2026-05-30)
|
package/cli.js
CHANGED
|
@@ -966,6 +966,10 @@ async function main() {
|
|
|
966
966
|
|
|
967
967
|
if (cmd === 'daemon') {
|
|
968
968
|
console.log('Starting telepty daemon...');
|
|
969
|
+
// daemon.js binds the port only when launched as the daemon. The CLI reaches
|
|
970
|
+
// it via require() (not as require.main), so signal intent explicitly — tests
|
|
971
|
+
// that `require('./daemon.js')` without this env stay side-effect-free. (#15 / 0.5.0 daemon-never-listened regression)
|
|
972
|
+
process.env.AIGENTRY_TELEPTY_DAEMON_MAIN = '1';
|
|
969
973
|
require('./daemon.js');
|
|
970
974
|
return;
|
|
971
975
|
}
|
package/daemon.js
CHANGED
|
@@ -3017,11 +3017,13 @@ app.patch('/api/threads/:id', (req, res) => {
|
|
|
3017
3017
|
res.json({ success: true, thread_id: thread.id, status: thread.status });
|
|
3018
3018
|
});
|
|
3019
3019
|
|
|
3020
|
-
// Bind the port
|
|
3021
|
-
//
|
|
3022
|
-
//
|
|
3020
|
+
// Bind the port when launched as the daemon. A test can `require('./daemon.js')` to reach the
|
|
3021
|
+
// exported decision functions WITHOUT starting the daemon — it just must not set the env below.
|
|
3022
|
+
// The production CLI reaches daemon.js via require() (cli.js `cmd==='daemon'`), so require.main is
|
|
3023
|
+
// cli.js, never this module — hence the explicit AIGENTRY_TELEPTY_DAEMON_MAIN signal. Guarding on
|
|
3024
|
+
// require.main ALONE (0.5.0 regression) meant app.listen never ran in production → daemon exited 0.
|
|
3023
3025
|
let server;
|
|
3024
|
-
if (require.main === module) {
|
|
3026
|
+
if (require.main === module || process.env.AIGENTRY_TELEPTY_DAEMON_MAIN === '1') {
|
|
3025
3027
|
server = app.listen(PORT, HOST, () => {
|
|
3026
3028
|
console.log(`🚀 aigentry-telepty daemon listening on http://${HOST}:${PORT}`);
|
|
3027
3029
|
runStartupBootstrapRestore();
|