chore: snapshot working tree - pty_exited notifications + in-flight inference WIP
feat(booterm): structured pty_exited WS notifications. Plan-validated, impl-validated, code-reviewed green (contracts build clean, contracts test 29/29, booterm + web typecheck clean). wip: in-progress inference/provider refactor (agents.ts, provider.ts, new llama-providers.ts, removed llama-args-validator), plus arena, dispatcher, compaction, schema changes. openspec: pty-exit-notifications complete; x-agent-flags planned (not yet implemented).
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
||||
} from '../pty/manager.js';
|
||||
import { attachPty } from '../pty/pty.js';
|
||||
import { getUser } from '../auth.js';
|
||||
import { register, unregister, appendOutput, touchActivity, consumePendingMetadata } from '../pty/registry.js';
|
||||
import { register, unregister, appendOutput, touchActivity, consumePendingMetadata, get as getRegistry, getLastLines } from '../pty/registry.js';
|
||||
|
||||
export function registerWsAttachRoute(
|
||||
app: FastifyInstance,
|
||||
@@ -168,9 +168,22 @@ export function registerWsAttachRoute(
|
||||
});
|
||||
|
||||
handle.onExit(({ exitCode }) => {
|
||||
const meta = getRegistry(pid);
|
||||
const lastLines = getLastLines(pid, 5);
|
||||
const frame = {
|
||||
type: 'pty_exited' as const,
|
||||
session_id: sid,
|
||||
pane_id: pid,
|
||||
exit_code: exitCode,
|
||||
last_lines: lastLines,
|
||||
session_title: meta?.title ?? null,
|
||||
session_description: meta?.description ?? null,
|
||||
parent_agent: meta?.parentAgent ?? null,
|
||||
timed_out: meta?.timedOut ?? false,
|
||||
};
|
||||
try {
|
||||
if (socket.readyState === socket.OPEN) {
|
||||
socket.send(JSON.stringify({ type: 'exit', code: exitCode }));
|
||||
socket.send(JSON.stringify(frame));
|
||||
}
|
||||
} catch {
|
||||
/* ignore */
|
||||
|
||||
Reference in New Issue
Block a user