@tiflis-io/tiflis-code-workstation 0.3.6 → 0.3.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/dist/main.js +83 -4
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2716,10 +2716,79 @@ function isTerminalSession(session) {
|
|
|
2716
2716
|
return session.type === "terminal";
|
|
2717
2717
|
}
|
|
2718
2718
|
|
|
2719
|
-
// src/infrastructure/
|
|
2719
|
+
// src/infrastructure/shell/shell-env.ts
|
|
2720
|
+
import { execSync as execSync2 } from "child_process";
|
|
2721
|
+
var cachedShellEnv = null;
|
|
2720
2722
|
function getDefaultShell() {
|
|
2721
2723
|
return process.env.SHELL ?? "/bin/bash";
|
|
2722
2724
|
}
|
|
2725
|
+
function getShellEnv() {
|
|
2726
|
+
if (cachedShellEnv) {
|
|
2727
|
+
return cachedShellEnv;
|
|
2728
|
+
}
|
|
2729
|
+
const shell = getDefaultShell();
|
|
2730
|
+
const isZsh = shell.includes("zsh");
|
|
2731
|
+
const isBash = shell.includes("bash");
|
|
2732
|
+
let envOutput;
|
|
2733
|
+
try {
|
|
2734
|
+
if (isZsh) {
|
|
2735
|
+
envOutput = execSync2(`${shell} -i -l -c 'env -0'`, {
|
|
2736
|
+
encoding: "utf-8",
|
|
2737
|
+
timeout: 5e3,
|
|
2738
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
2739
|
+
// 10MB buffer for large environments
|
|
2740
|
+
env: {
|
|
2741
|
+
...process.env,
|
|
2742
|
+
// Prevent zsh from printing extra output
|
|
2743
|
+
PROMPT_EOL_MARK: ""
|
|
2744
|
+
},
|
|
2745
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
2746
|
+
// Capture stderr to ignore it
|
|
2747
|
+
});
|
|
2748
|
+
} else if (isBash) {
|
|
2749
|
+
envOutput = execSync2(`${shell} --login -i -c 'env -0'`, {
|
|
2750
|
+
encoding: "utf-8",
|
|
2751
|
+
timeout: 5e3,
|
|
2752
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
2753
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
2754
|
+
});
|
|
2755
|
+
} else {
|
|
2756
|
+
envOutput = execSync2(`${shell} -l -c 'env -0'`, {
|
|
2757
|
+
encoding: "utf-8",
|
|
2758
|
+
timeout: 5e3,
|
|
2759
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
2760
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
2761
|
+
});
|
|
2762
|
+
}
|
|
2763
|
+
const shellEnv = {};
|
|
2764
|
+
for (const entry of envOutput.split("\0")) {
|
|
2765
|
+
if (!entry) continue;
|
|
2766
|
+
const eqIndex = entry.indexOf("=");
|
|
2767
|
+
if (eqIndex > 0) {
|
|
2768
|
+
const key = entry.slice(0, eqIndex);
|
|
2769
|
+
const value = entry.slice(eqIndex + 1);
|
|
2770
|
+
shellEnv[key] = value;
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
cachedShellEnv = {
|
|
2774
|
+
...process.env,
|
|
2775
|
+
...shellEnv
|
|
2776
|
+
};
|
|
2777
|
+
return cachedShellEnv;
|
|
2778
|
+
} catch (error) {
|
|
2779
|
+
console.warn(
|
|
2780
|
+
"Failed to retrieve shell environment, using process.env:",
|
|
2781
|
+
error instanceof Error ? error.message : String(error)
|
|
2782
|
+
);
|
|
2783
|
+
cachedShellEnv = { ...process.env };
|
|
2784
|
+
return cachedShellEnv;
|
|
2785
|
+
}
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2788
|
+
// src/infrastructure/terminal/pty-manager.ts
|
|
2789
|
+
function getDefaultShell2() {
|
|
2790
|
+
return process.env.SHELL ?? "/bin/bash";
|
|
2791
|
+
}
|
|
2723
2792
|
var PtyManager = class {
|
|
2724
2793
|
logger;
|
|
2725
2794
|
bufferSize;
|
|
@@ -2733,18 +2802,19 @@ var PtyManager = class {
|
|
|
2733
2802
|
*/
|
|
2734
2803
|
create(workingDir, cols, rows) {
|
|
2735
2804
|
const sessionId = new SessionId(nanoid(12));
|
|
2736
|
-
const shell =
|
|
2805
|
+
const shell = getDefaultShell2();
|
|
2737
2806
|
this.logger.debug(
|
|
2738
2807
|
{ sessionId: sessionId.value, workingDir, shell, cols, rows },
|
|
2739
2808
|
"Creating terminal session"
|
|
2740
2809
|
);
|
|
2810
|
+
const shellEnv = getShellEnv();
|
|
2741
2811
|
const ptyProcess = pty.spawn(shell, [], {
|
|
2742
2812
|
name: "xterm-256color",
|
|
2743
2813
|
cols,
|
|
2744
2814
|
rows,
|
|
2745
2815
|
cwd: workingDir,
|
|
2746
2816
|
env: {
|
|
2747
|
-
...
|
|
2817
|
+
...shellEnv,
|
|
2748
2818
|
TERM: "xterm-256color",
|
|
2749
2819
|
// Disable zsh partial line marker (inverse % sign on startup)
|
|
2750
2820
|
PROMPT_EOL_MARK: ""
|
|
@@ -2834,10 +2904,11 @@ var HeadlessAgentExecutor = class extends EventEmitter {
|
|
|
2834
2904
|
}
|
|
2835
2905
|
const { command, args } = this.buildCommand(prompt);
|
|
2836
2906
|
const aliasEnvVars = this.getAliasEnvVars();
|
|
2907
|
+
const shellEnv = getShellEnv();
|
|
2837
2908
|
this.subprocess = spawn2(command, args, {
|
|
2838
2909
|
cwd: this.workingDir,
|
|
2839
2910
|
env: {
|
|
2840
|
-
...
|
|
2911
|
+
...shellEnv,
|
|
2841
2912
|
// Apply alias env vars (e.g., CLAUDE_CONFIG_DIR)
|
|
2842
2913
|
...aliasEnvVars,
|
|
2843
2914
|
// Ensure proper terminal environment
|
|
@@ -10861,6 +10932,14 @@ bootstrap().catch((error) => {
|
|
|
10861
10932
|
* @copyright 2025 Roman Barinov <rbarinov@gmail.com>
|
|
10862
10933
|
* @license FSL-1.1-NC
|
|
10863
10934
|
*/
|
|
10935
|
+
/**
|
|
10936
|
+
* @file shell-env.ts
|
|
10937
|
+
* @copyright 2025 Roman Barinov <rbarinov@gmail.com>
|
|
10938
|
+
* @license FSL-1.1-NC
|
|
10939
|
+
*
|
|
10940
|
+
* Utility to get the interactive login shell environment variables,
|
|
10941
|
+
* ensuring PATH and other user-configured variables are properly sourced.
|
|
10942
|
+
*/
|
|
10864
10943
|
/**
|
|
10865
10944
|
* @file pty-manager.ts
|
|
10866
10945
|
* @copyright 2025 Roman Barinov <rbarinov@gmail.com>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiflis-io/tiflis-code-workstation",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "Workstation server for tiflis-code - manages agent sessions and terminal access",
|
|
5
5
|
"author": "Roman Barinov <rbarinov@gmail.com>",
|
|
6
6
|
"license": "FSL-1.1-NC",
|