- Reworked internal signals

- Separated input passing from signal calling
- Exposed command registry to the broader codebase
- Moved command execution call to internal shell logic
- TTY is now expected to watch for stdout escape sequences to perform tasks
This commit is contained in:
2026-11-23 13:31:22 +01:00
parent dbffe5375e
commit 41739d7cf9
15 changed files with 191 additions and 133 deletions
+4 -1
View File
@@ -9,6 +9,7 @@ export interface ShellState {
readonly users: ReadonlyMap<number, UserInfo>;
readonly groups: ReadonlyMap<number, GroupInfo>;
readonly sessionStack: ReadonlyArray<SessionState>;
//readonly commmandRegistry: CommandRegistry;
}
export function createInitialShellState(
@@ -16,12 +17,14 @@ export function createInitialShellState(
users: ReadonlyMap<number, UserInfo>,
groups: ReadonlyMap<number, GroupInfo>,
user: UserInfo,
//commandRegistry: CommandRegistry,
): ShellState {
return Object.freeze({
filesystem,
users,
groups,
sessionStack: Object.freeze([createInitialSessionState(user)]),
//commandRegistry,
});
}
@@ -63,7 +66,7 @@ export function withCwd(state: ShellState, ptr: NodePointer): ShellState {
} satisfies ShellState);
}
export function withHistory(state: ShellState, input: string): ShellState {
export function withHistory(state: ShellState, input: Uint8Array): ShellState {
const session = getCurrentSession(state);
const newSession = Object.freeze({