Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(presence): echo your own cursor-chat back as a timed bubble

enesaa156bd786fa
diff --git a/src/renderer/components/PresenceLayer.tsx b/src/renderer/components/PresenceLayer.tsx
index b3090f239..f39019e3e 100644
--- a/src/renderer/components/PresenceLayer.tsx
+++ b/src/renderer/components/PresenceLayer.tsx
@@ -54,6 +54,11 @@ export function PresenceLayer(): JSX.Element | null {
// Cursor-chat input (local). `null` = closed.
const [chat, setChat] = useState<string | null>(null)
+ // Our OWN sent line, shown back to US as a timed bubble at the spot we typed it — the same thing
+ // our peers see, so a chat feels like a conversation, not a fire-and-forget. Cleared after
+ // CHAT_LINGER_MS (in step with the peer-side retraction), the fade handled by a CSS life animation.
+ const [sent, setSent] = useState<{ text: string; x: number; y: number } | null>(null)
+ const sentTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
// Where the input is pinned on screen: a SNAPSHOT of the pointer taken when the chat opened, not
// the live pointer. Read during render, so it must be state — reading the live pointer ref here
// would make the "anchor" chase the mouse whenever a peer's cursor happened to re-render us.
@@ -182,6 +187,7 @@ export function PresenceLayer(): JSX.Element | null {
useEffect(
() => () => {
if (lingerRef.current) clearTimeout(lingerRef.current)
+ if (sentTimerRef.current) clearTimeout(sentTimerRef.current)
if (publishedRef.current) api.presence.chat(null)
},
[api]
@@ -241,6 +247,17 @@ export function PresenceLayer(): JSX.Element | null {
onKeyDown={(e) => {
if (e.key === 'Enter') {
e.preventDefault()
+ // Show our own line back to us as a timed bubble (mirrors what peers see), pinned where
+ // we typed it. Escape cancels with no bubble; only a real Enter'd line lingers.
+ const text = chat.trim()
+ if (text && anchor) {
+ if (sentTimerRef.current) clearTimeout(sentTimerRef.current)
+ setSent({ text, x: anchor.x, y: anchor.y })
+ sentTimerRef.current = setTimeout(() => {
+ sentTimerRef.current = null
+ setSent(null)
+ }, CHAT_LINGER_MS)
+ }
closeChat(true)
} else if (e.key === 'Escape') {
e.preventDefault()
@@ -251,6 +268,15 @@ export function PresenceLayer(): JSX.Element | null {
onBlur={() => closeChat(false)}
/>
)}
+
+ {sent && (
+ <div
+ className="presence-chat-sent nodrag"
+ style={{ left: sent.x + CHAT_ANCHOR_OFFSET_PX, top: sent.y + CHAT_ANCHOR_OFFSET_PX }}
+ >
+ {sent.text}
+ </div>
+ )}
</>
)
}
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 99eeae340..b4385151a 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -5486,6 +5486,41 @@ body,
outline: none;
}
+/* Our OWN sent cursor-chat line, shown back to us at the spot we typed it — same look as the peer
+ bubble (.presence-cursor__chat), timed: it fades in, holds, then fades out over CHAT_LINGER_MS. */
+.presence-chat-sent {
+ position: fixed;
+ z-index: 20;
+ max-width: 320px;
+ padding: 4px 8px;
+ border-radius: 10px;
+ background: rgba(28, 28, 30, 0.95);
+ border: 1px solid rgba(255, 255, 255, 0.14);
+ color: var(--text);
+ font-size: 12px;
+ white-space: pre-wrap;
+ overflow-wrap: anywhere;
+ pointer-events: none;
+ animation: presence-chat-sent-life 5000ms ease forwards;
+}
+
+@keyframes presence-chat-sent-life {
+ 0% {
+ opacity: 0;
+ transform: translateY(3px);
+ }
+ 6% {
+ opacity: 1;
+ transform: translateY(0);
+ }
+ 82% {
+ opacity: 1;
+ }
+ 100% {
+ opacity: 0;
+ }
+}
+
/* ---- facepile: who is connected (the one surface that shows off-project peers) ---- */
/* Lives INSIDE .controls-cluster (see Canvas.tsx) as its first flex item, so the faces sit to the
LEFT of the top-right toolbar on the same row — not absolutely positioned into the tab-bar band