diff --git a/web/src/attach.ts b/web/src/attach.ts
index 948d633..1886642 100644
--- a/web/src/attach.ts
+++ b/web/src/attach.ts
@@ -43,6 +43,10 @@ export interface AttachConnection {
* handling — the leader's literal Ctrl-K escape hatch
* (docs/COMMAND-BAR.md). */
sendInput(data: string): void;
+ /** Refresh the header's name/command (e.g. after autoname renames the
+ * session) — the connection outlives mount/unmount, so this is the only
+ * way an already-open header picks up a new name. */
+ updateInfo(info: AttachInfo): void;
/** Fully disconnect: close the WS, dispose the terminal, remove the element. */
dispose(): void;
}
@@ -85,21 +89,25 @@ export function createAttachConnection(
el.className = "attach";
// Useful identity over a bare UUID: name · command. The full id stays in the
// tooltip for when you really need it.
- const titleHtml = info
- ? `${escapeHtml(info.name)}` +
- (info.command && info.command !== info.name ? commandFragment(info.command) : "")
- : `session ${escapeHtml(sessionId.slice(0, 8))}`;
- const titleAttr = info ? `${info.name} · ${info.command} (${sessionId})` : sessionId;
+ const titleMarkup = (i?: AttachInfo): { html: string; attr: string } => ({
+ html: i
+ ? `${escapeHtml(i.name)}` +
+ (i.command && i.command !== i.name ? commandFragment(i.command) : "")
+ : `session ${escapeHtml(sessionId.slice(0, 8))}`,
+ attr: i ? `${i.name} · ${i.command} (${sessionId})` : sessionId,
+ });
+ const initialTitle = titleMarkup(info);
el.innerHTML = `