pty-manager 1.9.0 → 1.9.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/dist/index.d.mts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +16 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -8
- package/dist/index.mjs.map +1 -1
- package/dist/pty-worker.js +16 -8
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -52,6 +52,17 @@ interface SpawnConfig {
|
|
|
52
52
|
* are emitted as autoResponded=false instead of being auto-responded.
|
|
53
53
|
* Auto-response rules (ruleOverrides) are unaffected. */
|
|
54
54
|
skipAdapterAutoResponse?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Whether to inherit the parent process environment variables.
|
|
57
|
+
* When `true` (default), `process.env` is spread as the base of the spawned
|
|
58
|
+
* process environment. When `false`, only `adapter.getEnv()` output and
|
|
59
|
+
* `config.env` are used — the caller is responsible for providing any
|
|
60
|
+
* necessary system vars (PATH, HOME, etc.) via `config.env`.
|
|
61
|
+
*
|
|
62
|
+
* Set to `false` for security-sensitive contexts where the host process has
|
|
63
|
+
* secrets that spawned agents should not access.
|
|
64
|
+
*/
|
|
65
|
+
inheritProcessEnv?: boolean;
|
|
55
66
|
}
|
|
56
67
|
/**
|
|
57
68
|
* Handle to a running session
|
|
@@ -693,6 +704,12 @@ declare class PTYSession extends EventEmitter {
|
|
|
693
704
|
* @param keys - Key name(s) to send, e.g. "ctrl+c" or ["up", "up", "enter"]
|
|
694
705
|
*/
|
|
695
706
|
sendKeys(keys: string | string[]): void;
|
|
707
|
+
/**
|
|
708
|
+
* Build the environment object for spawning a PTY process.
|
|
709
|
+
* Merges base env (process.env unless opted out), adapter env, and config env,
|
|
710
|
+
* with TERM/COLORTERM always forced.
|
|
711
|
+
*/
|
|
712
|
+
static buildSpawnEnv(config: SpawnConfig, adapterEnv: Record<string, string>): Record<string, string>;
|
|
696
713
|
/**
|
|
697
714
|
* Normalize a list of key names for SPECIAL_KEYS lookup.
|
|
698
715
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -52,6 +52,17 @@ interface SpawnConfig {
|
|
|
52
52
|
* are emitted as autoResponded=false instead of being auto-responded.
|
|
53
53
|
* Auto-response rules (ruleOverrides) are unaffected. */
|
|
54
54
|
skipAdapterAutoResponse?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Whether to inherit the parent process environment variables.
|
|
57
|
+
* When `true` (default), `process.env` is spread as the base of the spawned
|
|
58
|
+
* process environment. When `false`, only `adapter.getEnv()` output and
|
|
59
|
+
* `config.env` are used — the caller is responsible for providing any
|
|
60
|
+
* necessary system vars (PATH, HOME, etc.) via `config.env`.
|
|
61
|
+
*
|
|
62
|
+
* Set to `false` for security-sensitive contexts where the host process has
|
|
63
|
+
* secrets that spawned agents should not access.
|
|
64
|
+
*/
|
|
65
|
+
inheritProcessEnv?: boolean;
|
|
55
66
|
}
|
|
56
67
|
/**
|
|
57
68
|
* Handle to a running session
|
|
@@ -693,6 +704,12 @@ declare class PTYSession extends EventEmitter {
|
|
|
693
704
|
* @param keys - Key name(s) to send, e.g. "ctrl+c" or ["up", "up", "enter"]
|
|
694
705
|
*/
|
|
695
706
|
sendKeys(keys: string | string[]): void;
|
|
707
|
+
/**
|
|
708
|
+
* Build the environment object for spawning a PTY process.
|
|
709
|
+
* Merges base env (process.env unless opted out), adapter env, and config env,
|
|
710
|
+
* with TERM/COLORTERM always forced.
|
|
711
|
+
*/
|
|
712
|
+
static buildSpawnEnv(config: SpawnConfig, adapterEnv: Record<string, string>): Record<string, string>;
|
|
696
713
|
/**
|
|
697
714
|
* Normalize a list of key names for SPECIAL_KEYS lookup.
|
|
698
715
|
*
|
package/dist/index.js
CHANGED
|
@@ -900,14 +900,7 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
|
|
|
900
900
|
const command = this.adapter.getCommand();
|
|
901
901
|
const args = this.adapter.getArgs(this.config);
|
|
902
902
|
const adapterEnv = this.adapter.getEnv(this.config);
|
|
903
|
-
const env =
|
|
904
|
-
...process.env,
|
|
905
|
-
...adapterEnv,
|
|
906
|
-
...this.config.env,
|
|
907
|
-
// Force terminal settings
|
|
908
|
-
TERM: "xterm-256color",
|
|
909
|
-
COLORTERM: "truecolor"
|
|
910
|
-
};
|
|
903
|
+
const env = _PTYSession.buildSpawnEnv(this.config, adapterEnv);
|
|
911
904
|
this.logger.info(
|
|
912
905
|
{ sessionId: this.id, command, args: args.join(" ") },
|
|
913
906
|
"Starting PTY session"
|
|
@@ -1289,6 +1282,21 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
|
|
|
1289
1282
|
}
|
|
1290
1283
|
}
|
|
1291
1284
|
}
|
|
1285
|
+
/**
|
|
1286
|
+
* Build the environment object for spawning a PTY process.
|
|
1287
|
+
* Merges base env (process.env unless opted out), adapter env, and config env,
|
|
1288
|
+
* with TERM/COLORTERM always forced.
|
|
1289
|
+
*/
|
|
1290
|
+
static buildSpawnEnv(config, adapterEnv) {
|
|
1291
|
+
const baseEnv = config.inheritProcessEnv !== false ? process.env : {};
|
|
1292
|
+
return {
|
|
1293
|
+
...baseEnv,
|
|
1294
|
+
...adapterEnv,
|
|
1295
|
+
...config.env,
|
|
1296
|
+
TERM: "xterm-256color",
|
|
1297
|
+
COLORTERM: "truecolor"
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1292
1300
|
/**
|
|
1293
1301
|
* Normalize a list of key names for SPECIAL_KEYS lookup.
|
|
1294
1302
|
*
|