@adhdev/daemon-core 0.8.14 → 0.8.15
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/dist/index.js +25 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -27
- package/dist/index.mjs.map +1 -1
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +1 -9
- package/src/cli-adapters/pty-transport.ts +17 -6
package/package.json
CHANGED
|
@@ -27,15 +27,7 @@ import {
|
|
|
27
27
|
type PtyRuntimeTransport,
|
|
28
28
|
type PtyTransportFactory,
|
|
29
29
|
} from './pty-transport.js';
|
|
30
|
-
import { sanitizeSpawnEnv
|
|
31
|
-
|
|
32
|
-
let pty: any;
|
|
33
|
-
try {
|
|
34
|
-
pty = require('node-pty');
|
|
35
|
-
ensureNodePtySpawnHelperPermissions((msg: string) => LOG.info('CLI', msg));
|
|
36
|
-
} catch {
|
|
37
|
-
LOG.error('CLI', '[ProviderCliAdapter] node-pty not found. Terminal features disabled.');
|
|
38
|
-
}
|
|
30
|
+
import { sanitizeSpawnEnv } from './spawn-env.js';
|
|
39
31
|
|
|
40
32
|
// ─── Types ──────────────────────────────────────────
|
|
41
33
|
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import * as os from 'os';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { ensureNodePtySpawnHelperPermissions } from './spawn-env.js';
|
|
3
|
+
|
|
4
|
+
let cachedPty: any | null | undefined;
|
|
5
|
+
|
|
6
|
+
function loadNodePty(): any {
|
|
7
|
+
if (cachedPty !== undefined) return cachedPty;
|
|
8
|
+
try {
|
|
9
|
+
// Keep node-pty out of processes that delegate PTY ownership elsewhere
|
|
10
|
+
// (for example via session-host on Windows), so native PTY crashes do not
|
|
11
|
+
// take down the daemon just by importing this module.
|
|
12
|
+
cachedPty = require('node-pty');
|
|
13
|
+
ensureNodePtySpawnHelperPermissions();
|
|
14
|
+
} catch {
|
|
15
|
+
cachedPty = null;
|
|
16
|
+
}
|
|
17
|
+
return cachedPty;
|
|
8
18
|
}
|
|
9
19
|
|
|
10
20
|
export interface PtySpawnOptions {
|
|
@@ -90,6 +100,7 @@ class NodePtyRuntimeTransport implements PtyRuntimeTransport {
|
|
|
90
100
|
|
|
91
101
|
export class NodePtyTransportFactory implements PtyTransportFactory {
|
|
92
102
|
spawn(command: string, args: string[], options: PtySpawnOptions): PtyRuntimeTransport {
|
|
103
|
+
const pty = loadNodePty();
|
|
93
104
|
if (!pty) throw new Error('node-pty is not installed');
|
|
94
105
|
// Validate cwd — an invalid directory causes a native crash on Windows
|
|
95
106
|
// (node-pty error code 267: ERROR_DIRECTORY) that bypasses JS try/catch
|