Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/screen-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ export class ScreenManager extends EventEmitter {

// Environment variables must be exported, not passed inline to nice
// Using inline VAR=value before nice doesn't work correctly
// Unset COLORTERM to prevent truecolor issues - xterm.js doesn't handle inherited COLORTERM=truecolor well
const envExports = [
'unset COLORTERM',
'export CLAUDEMAN_SCREEN=1',
`export CLAUDEMAN_SESSION_ID=${sessionId}`,
`export CLAUDEMAN_SCREEN_NAME=${screenName}`,
Expand Down
8 changes: 6 additions & 2 deletions src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ export class Session extends EventEmitter {
cols: 120,
rows: 40,
cwd: this.workingDir,
env: { ...process.env, TERM: 'xterm-256color' },
env: { ...process.env, TERM: 'xterm-256color', COLORTERM: undefined },
});
} catch (spawnErr) {
console.error('[Session] Failed to spawn PTY for screen attachment:', spawnErr);
Expand Down Expand Up @@ -888,6 +888,7 @@ export class Session extends EventEmitter {
...process.env,
PATH: getAugmentedPath(),
TERM: 'xterm-256color',
COLORTERM: undefined,
// Inform Claude it's running within Claudeman (helps prevent self-termination)
CLAUDEMAN_SCREEN: '1',
CLAUDEMAN_SESSION_ID: this.id,
Expand Down Expand Up @@ -1062,7 +1063,7 @@ export class Session extends EventEmitter {
cols: 120,
rows: 40,
cwd: this.workingDir,
env: { ...process.env, TERM: 'xterm-256color' },
env: { ...process.env, TERM: 'xterm-256color', COLORTERM: undefined },
});
} catch (spawnErr) {
console.error('[Session] Failed to spawn PTY for shell screen attachment:', spawnErr);
Expand Down Expand Up @@ -1098,6 +1099,7 @@ export class Session extends EventEmitter {
env: {
...process.env,
TERM: 'xterm-256color',
COLORTERM: undefined,
CLAUDEMAN_SCREEN: '1',
CLAUDEMAN_SESSION_ID: this.id,
CLAUDEMAN_API_URL: process.env.CLAUDEMAN_API_URL || 'http://localhost:3000',
Expand Down Expand Up @@ -1211,6 +1213,7 @@ export class Session extends EventEmitter {
'-p',
'--dangerously-skip-permissions',
'--output-format', 'stream-json',
'--verbose', // Required for stream-json output format
];
if (model) {
args.push('--model', model);
Expand All @@ -1227,6 +1230,7 @@ export class Session extends EventEmitter {
...process.env,
PATH: getAugmentedPath(),
TERM: 'xterm-256color',
COLORTERM: undefined,
// Inform Claude it's running within Claudeman
CLAUDEMAN_SCREEN: '1',
CLAUDEMAN_SESSION_ID: this.id,
Expand Down