mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-04 22:49:41 +02:00
chore: bump version to 0.1485
This commit is contained in:
@@ -57,14 +57,10 @@ const DEFAULT_STATS_INTERVAL_MS = 2000;
|
||||
/** Maximum retry attempts for carriage return (3) */
|
||||
const CR_MAX_ATTEMPTS = 3;
|
||||
|
||||
/**
|
||||
* Wraps a command with `nice` for priority adjustment.
|
||||
*/
|
||||
export function wrapWithNice(cmd: string, config: NiceConfig): string {
|
||||
if (!config.enabled) return cmd;
|
||||
const niceValue = Math.max(-20, Math.min(19, config.niceValue));
|
||||
return `nice -n ${niceValue} ${cmd}`;
|
||||
}
|
||||
// Import from shared utility (extracted to avoid cross-dependency)
|
||||
import { wrapWithNice } from './utils/nice-wrapper.js';
|
||||
// Re-export for backward compatibility
|
||||
export { wrapWithNice } from './utils/nice-wrapper.js';
|
||||
|
||||
|
||||
/** Cached directory containing the claude binary */
|
||||
|
||||
+25
-1
@@ -27,7 +27,7 @@ import { existsSync, readFileSync, mkdirSync, writeFile } from 'node:fs';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { homedir } from 'node:os';
|
||||
import { ProcessStats, PersistedRespawnConfig, getErrorMessage, NiceConfig, DEFAULT_NICE_CONFIG } from './types.js';
|
||||
import { wrapWithNice } from './screen-manager.js';
|
||||
import { wrapWithNice } from './utils/nice-wrapper.js';
|
||||
import type { TerminalMultiplexer, MuxSession, MuxSessionWithStats } from './mux-interface.js';
|
||||
|
||||
// ============================================================================
|
||||
@@ -156,6 +156,8 @@ export class TmuxManager extends EventEmitter implements TerminalMultiplexer {
|
||||
private sessions: Map<string, MuxSession> = new Map();
|
||||
private statsInterval: NodeJS.Timeout | null = null;
|
||||
|
||||
private trueColorConfigured = false;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.loadSessions();
|
||||
@@ -296,6 +298,21 @@ export class TmuxManager extends EventEmitter implements TerminalMultiplexer {
|
||||
// Non-critical — session still works with status bar
|
||||
}
|
||||
|
||||
// Enable 24-bit true color passthrough — without this, tmux downgrades
|
||||
// RGB colors (like Claude's red logo) to the nearest 256-color palette entry.
|
||||
// Server-wide option, only set once per TmuxManager lifetime to avoid duplicates.
|
||||
if (!this.trueColorConfigured) {
|
||||
try {
|
||||
execSync(
|
||||
`tmux set-option -sa terminal-overrides ",*:Tc"`,
|
||||
{ encoding: 'utf-8', timeout: EXEC_TIMEOUT_MS }
|
||||
);
|
||||
this.trueColorConfigured = true;
|
||||
} catch {
|
||||
// Non-critical — colors will still work, just limited to 256
|
||||
}
|
||||
}
|
||||
|
||||
// Get the PID of the pane process
|
||||
const pid = this.getPanePid(muxName);
|
||||
if (!pid) {
|
||||
@@ -419,6 +436,13 @@ export class TmuxManager extends EventEmitter implements TerminalMultiplexer {
|
||||
return false;
|
||||
}
|
||||
|
||||
// SAFETY: Never kill the tmux session we're running inside of
|
||||
const currentMuxName = process.env.CLAUDEMAN_SCREEN_NAME;
|
||||
if (currentMuxName && session.muxName === currentMuxName) {
|
||||
console.error(`[TmuxManager] BLOCKED: Refusing to kill own tmux session: ${session.muxName}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get current PID (may have changed)
|
||||
const currentPid = this.getPanePid(session.muxName) || session.pid;
|
||||
|
||||
|
||||
@@ -34,3 +34,4 @@ export {
|
||||
todoContentHash,
|
||||
} from './string-similarity.js';
|
||||
export { assertNever } from './type-safety.js';
|
||||
export { wrapWithNice } from './nice-wrapper.js';
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @fileoverview Shared utility for wrapping commands with `nice` priority.
|
||||
*
|
||||
* Extracted from screen-manager.ts so both tmux-manager and screen-manager
|
||||
* can use it without cross-dependency on the deprecated screen module.
|
||||
*
|
||||
* @module utils/nice-wrapper
|
||||
*/
|
||||
|
||||
import type { NiceConfig } from '../types.js';
|
||||
|
||||
/**
|
||||
* Wraps a command with `nice` for priority adjustment.
|
||||
*/
|
||||
export function wrapWithNice(cmd: string, config: NiceConfig): string {
|
||||
if (!config.enabled) return cmd;
|
||||
const niceValue = Math.max(-20, Math.min(19, config.niceValue));
|
||||
return `nice -n ${niceValue} ${cmd}`;
|
||||
}
|
||||
Reference in New Issue
Block a user