Simplify boot sequence, remove terminal emblem, and introduce fastfetch script for sandbox login facts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7937879ace
commit
5f3ff481b4
24 files changed
+232
-240
No files matched your search
@@ -100,7 +100,7 @@ const STYLE = `
|
||||
* { box-sizing: border-box; }
|
||||
body { margin: 0; background: var(--background); color: var(--text); font: 15px/1.6 "JetBrains Mono", ui-monospace, monospace; font-variant-ligatures: no-contextual; }
|
||||
header, main, footer { max-width: 60rem; margin: 0 auto; padding: 0.75rem 1rem; }
|
||||
header { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; justify-content: space-between; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
|
||||
header { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; justify-content: space-between; border-bottom: 1px solid var(--border); font-size: 0.85rem; user-select: none; }
|
||||
header .site { color: var(--accent); }
|
||||
nav a { margin-left: 0.75rem; }
|
||||
a { color: var(--accent); }
|
||||
|
||||
@@ -81,7 +81,6 @@ export function buildSite(index: ContentIndex, options: SiteOptions): Site
|
||||
{
|
||||
const pages = new Map<string, SitePage>();
|
||||
const nav: Link[] = [
|
||||
{ label: 'terminal', href: '/' },
|
||||
{ label: 'ls', href: '/ls' },
|
||||
...[...options.legal.keys()].map((route) => ({ label: route, href: `/${route}` })),
|
||||
];
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { connect, type Socket } from 'node:net';
|
||||
import { readLine } from './lines.ts';
|
||||
import type { ManagedContainer, SpawnerRequest, SpawnerResponse } from './spawner.ts';
|
||||
import type { TerminalSize } from './terminal.ts';
|
||||
|
||||
const MAX_RESPONSE_BYTES = 1024 * 1024;
|
||||
|
||||
@@ -13,8 +14,9 @@ export class SpawnerClient
|
||||
|
||||
constructor(socketPath: string) { this.socketPath = socketPath; }
|
||||
|
||||
async spawn(sessionId: string, expiresAt: number): Promise<string> {
|
||||
const response = await this.request({ op: 'spawn', sessionId, expiresAt });
|
||||
/** The terminal size is set before the shell starts, so its first output already fits. */
|
||||
async spawn(sessionId: string, expiresAt: number, size: TerminalSize): Promise<string> {
|
||||
const response = await this.request({ op: 'spawn', sessionId, expiresAt, ...size });
|
||||
return response.containerId!;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,12 @@ const parse = (value: unknown) => parseRequest(JSON.stringify(value), now);
|
||||
|
||||
describe('parseRequest', () => {
|
||||
it('accepts a valid spawn', () => {
|
||||
expect(parse({ op: 'spawn', sessionId: 'abcdEFGH_-12', expiresAt: now + 1200 })).toEqual({
|
||||
expect(parse({ op: 'spawn', sessionId: 'abcdEFGH_-12', expiresAt: now + 1200, cols: 900, rows: 40 })).toEqual({
|
||||
op: 'spawn',
|
||||
sessionId: 'abcdEFGH_-12',
|
||||
expiresAt: now + 1200,
|
||||
cols: 500,
|
||||
rows: 40,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,6 +21,7 @@ describe('parseRequest', () => {
|
||||
['expiry in the past', { op: 'spawn', sessionId: 'abcdefgh', expiresAt: now }],
|
||||
['expiry too far ahead', { op: 'spawn', sessionId: 'abcdefgh', expiresAt: now + MAX_SESSION_SECONDS + 1 }],
|
||||
['fractional expiry', { op: 'spawn', sessionId: 'abcdefgh', expiresAt: now + 1.5 }],
|
||||
['missing terminal size', { op: 'spawn', sessionId: 'abcdefgh', expiresAt: now + 60 }],
|
||||
['uppercase container id', { op: 'kill', containerId: 'ABCDEF123456' }],
|
||||
['container id with path', { op: 'attach', containerId: '../../info' }],
|
||||
['unknown op', { op: 'exec', containerId: 'abcdef123456' }],
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MAX_TERMINAL_SIZE } from './terminal.ts';
|
||||
import { MAX_TERMINAL_SIZE, type TerminalSize } from './terminal.ts';
|
||||
|
||||
export const SANDBOX_LABEL = 'org.security-command.sandbox';
|
||||
export const SESSION_LABEL = 'org.security-command.session';
|
||||
@@ -7,7 +7,7 @@ export const MAX_REQUEST_BYTES = 4096;
|
||||
export const MAX_SESSION_SECONDS = 6 * 60 * 60;
|
||||
|
||||
export type SpawnerRequest =
|
||||
| { op: 'spawn'; sessionId: string; expiresAt: number }
|
||||
| ({ op: 'spawn'; sessionId: string; expiresAt: number } & TerminalSize)
|
||||
| { op: 'attach'; containerId: string }
|
||||
| { op: 'resize'; containerId: string; cols: number; rows: number }
|
||||
| { op: 'kill'; containerId: string }
|
||||
@@ -74,7 +74,13 @@ export function parseRequest(line: string, nowSeconds = Math.floor(Date.now() /
|
||||
expiresAt > nowSeconds + MAX_SESSION_SECONDS
|
||||
) { invalid('invalid expiry'); }
|
||||
|
||||
return { op: 'spawn', sessionId: sessionId(field(request, 'sessionId')), expiresAt };
|
||||
return {
|
||||
op: 'spawn',
|
||||
sessionId: sessionId(field(request, 'sessionId')),
|
||||
expiresAt,
|
||||
cols: terminalSize(field(request, 'cols')),
|
||||
rows: terminalSize(field(request, 'rows')),
|
||||
};
|
||||
}
|
||||
|
||||
case 'attach':
|
||||
|
||||
Reference in new issue
Block a user