small tweaks to the file structure, and reorganization of the codebase.

preparations for session manager function implementations
This commit is contained in:
2026-07-28 17:54:02 +02:00
parent 8c0a7e7a6c
commit 7348d3723e
14 changed files with 32 additions and 36 deletions
+34
View File
@@ -0,0 +1,34 @@
import { type HistoryState } from "./history_state";
import type { ShellState } from "./shell_state";
export interface UserInfo {
readonly username: string;
readonly uid: number;
readonly gid: number;
readonly group: readonly number[];
readonly home: number;
}
export interface SessionState {
readonly user: UserInfo;
readonly envVars: ReadonlyMap<string, string>;
readonly history: HistoryState;
readonly cwd: number;
readonly pwd: number;
readonly exitCode: number;
}
export function createInitialSessionState(user: UserInfo): SessionState {
return Object.freeze({
user,
envVars: Object.freeze(new Map()),
history: Object.freeze([]),
cwd: user.home,
pwd: user.home,
exitCode: 0,
} satisfies SessionState);
}
export function getCurrentSession(state: ShellState): SessionState {
return state.sessionStack[state.sessionStack.length - 1]!;
}