mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-09 08:59:40 +02:00
feat(tiles): Attach overlay for a tile whose session is not attached or has exited
A tile has no live terminal when its session has no PTY attached (pid null, e.g. restored after a server restart), when the agent exited in a live pane (paneExit), or when the server closed the tile's socket because the session exited (4009, which used to leave only the "session ended" marker). Its body now says which, with an Attach button, in an overlay laid over the terminal so the body and its xterm keep their size. Attach is the single view's own re-attach: POST /interactive (or /shell for a shell) with NO body, at most one in flight per session, since the route has no in-flight guard of its own. A tripped PTY-exit breaker goes through the same confirm before clearBreaker: true, and nothing automatic ever sends it. On success the tile is remounted onto the new pane (a socket stopped for good cannot reconnect), keeping the keyboard if it had it; the overlay stays away while the server catches up, and a failed attach says so and keeps it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -49,6 +49,8 @@ export class FakeEl {
|
||||
this.parentElement = null;
|
||||
}
|
||||
title = '';
|
||||
hidden = false;
|
||||
disabled = false;
|
||||
textContent = '';
|
||||
value = '';
|
||||
type = '';
|
||||
@@ -148,6 +150,8 @@ main.appendChild(section);
|
||||
/** Extra elements `document.querySelector` finds, by exact selector (e.g. '.btn-split'). */
|
||||
export const bySelector = new Map<string, FakeEl>();
|
||||
export const body = new FakeEl();
|
||||
/** The context's `fetch`; a test sets what it answers. */
|
||||
export const fetchSpy = vi.fn(async (..._args: unknown[]) => ({ ok: true, json: async () => ({}) }));
|
||||
/** `document.addEventListener`, so a test can find a listener the app installed. */
|
||||
export const documentAddEventListener = vi.fn();
|
||||
export const localStore = new Map<string, string>();
|
||||
@@ -188,7 +192,7 @@ const context = vm.createContext({
|
||||
requestIdleCallback: (cb: () => void) => idleCallbacks.push(cb),
|
||||
HTMLCanvasElement: class HTMLCanvasElement {},
|
||||
WebSocket: { OPEN: 1 },
|
||||
fetch: vi.fn(),
|
||||
fetch: (...args: unknown[]) => fetchSpy(...args),
|
||||
navigator: { onLine: true },
|
||||
location: { protocol: 'http:', host: 'codeman.test', pathname: '/', search: '', hash: '' },
|
||||
history: { replaceState: vi.fn(), state: null },
|
||||
|
||||
Reference in New Issue
Block a user