Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f

### Added

- **Follow assistant progress and final replies.** Each turn identifies the model and highlights its latest output. After a successful final reply, earlier progress can be expanded; interrupted, failed and truncated turns stay open.
- **Archive and restore sessions on linked hosts.** Archiving now works for sessions on any linked machine, not only this one. The Archived Sessions browser lists every host's archive, shows which host each session is on, and restores it on that host. A host that is offline or runs an older ompweb host is named in the browser instead of hiding its archive silently. Restore rejects a session ID already active on any registered host, so every registered host must be online to restore, even an archive on this machine; the browser names the offline host that blocks it. A per-session claim stops web-server processes that share one agent directory from restoring the same session together; it does not coordinate separate web servers that share a daemon. A restore on another host keeps running when the web server stops waiting for it (after 30 s, or when the link drops), so the session stays claimed until that host's daemon process confirms it stopped: restoring the same ID again, on any host, is refused until then instead of creating a second active copy. Only the daemon process that took the restore can confirm that, so if the daemon was replaced, restarted or shut down meanwhile, or its host was unregistered, the session stays blocked: there is no timeout and no automatic clearing, and recovery is manual (see AGENTS.md). A restored session's attachments and other files are put back before the session becomes visible, so a file attached from another tab at that moment can no longer fail the restore or block retrying it. Restore streams archives with fixed 256 MiB compressed and expanded limits and rejects unsupported session IDs before consuming the archive.
- **Several web apps can share one host daemon and the same live sessions.** Link additional servers with `ompweb host login --add --url <server>` (token from stdin). Prompts, tool progress, results and dialogs stay synchronized, and restarting one web app leaves the other connected to the same omp process. Link protocol v7 moves session startup, idle cleanup and interrupted-run recovery into the host; older links remain supported without sharing their processes. Schedule the first daemon upgrade while its host is quiescent.
- **Sidebar marks sessions with an unsent draft.** A session whose composer still holds text or attachments shows a small pencil beside its title, so a half-written message is easy to find again. The mark follows this browser tab's drafts.
Expand Down
154 changes: 154 additions & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -3332,6 +3332,160 @@ html[data-touch-targets="accessible"] .chat-scroll-bottom {
animation: chat-message-in var(--dur-med) var(--ease-out-warm) both;
}

/* Keep each assistant output legible while activity stays secondary. */
.assistant-turn-header {
display: flex;
align-items: center;
gap: 7px;
margin: 18px 0 18px;
color: var(--text-muted);
font-size: 11px;
overflow-wrap: anywhere;
}
.assistant-turn-icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
flex-shrink: 0;
border-radius: 7px;
background: color-mix(in srgb, var(--accent) 9%, var(--bg));
color: var(--accent);
}
.assistant-turn-name { font-size: 12px; font-weight: 600; color: var(--text); }
.assistant-output-step {
position: relative;
min-width: 0;
margin: 0 0 26px 11px;
padding: 0 0 0 20px;
border-left: 1px solid var(--border);
}
.assistant-output-step::before {
content: "";
position: absolute;
left: -6px;
top: 7px;
width: 5px;
height: 5px;
box-sizing: content-box;
border: 3px solid var(--bg);
border-radius: 50%;
background: var(--text-dim);
}
.assistant-output-latest {
margin-left: 10px;
padding: 12px 14px 12px 19px;
border-left: 2px solid var(--accent);
border-radius: 0 var(--radius-control) var(--radius-control) 0;
background: color-mix(in srgb, var(--accent) 5%, var(--bg));
}
.assistant-output-latest::before { display: none; }
.assistant-output-label {
margin-bottom: 7px;
color: var(--accent);
font-size: 11px;
font-weight: 500;
}
.assistant-output-message { position: relative; min-width: 0; }
.assistant-output-message [data-message-text] > .markdown-body {
color: var(--text);
font-size: calc(var(--chat-font-size) + 1px);
line-height: max(1.75, var(--chat-line-height));
}
.assistant-output-footer {
min-height: 28px;
margin-top: 8px !important;
justify-content: flex-end !important;
}
.assistant-output-actions {
flex-wrap: nowrap !important;
opacity: 0;
pointer-events: none;
transition: opacity var(--dur-fast) var(--ease-out-warm);
}
.assistant-output-step:hover .assistant-output-actions,
.assistant-output-step:focus-within .assistant-output-actions,
.assistant-output-latest .assistant-output-actions,
.assistant-output-final .assistant-output-actions {
opacity: 1;
pointer-events: auto;
}
.assistant-output-actions > div { flex-wrap: nowrap !important; gap: 2px !important; }
.assistant-output-actions button {
justify-content: center !important;
gap: 0 !important;
width: 28px;
height: 28px !important;
min-height: 28px !important;
padding: 0 !important;
font-size: 0 !important;
}
.assistant-output-actions .message-copy-action > span {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}
.assistant-output-time { margin-right: auto; color: var(--text-dim); font-size: 11px; }
.transcript-process-group { margin: 6px 0; }
.transcript-process-content {
margin-top: 7px;
padding: 10px 12px;
border: 1px solid var(--border);
border-radius: var(--radius-control);
background: var(--tool-bg);
}
.transcript-process-caption { margin-bottom: 7px; font-size: 11px; color: var(--text-muted); }
.turn-progress-history { margin: 0 0 23px 11px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.turn-progress-toggle {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 6px;
width: 100%;
min-height: 28px;
border: 0;
padding: 3px 0;
background: transparent;
color: var(--text-muted);
text-align: left;
font: inherit;
font-size: 12px;
cursor: pointer;
}
.turn-progress-toggle:hover { color: var(--text); }
.turn-progress-toggle svg { flex-shrink: 0; transition: transform var(--dur-fast) var(--ease-out-warm); }
.turn-progress-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.turn-progress-count { font-size: 11px; }
.turn-progress-action { margin-left: auto; font-size: 11px; }
.turn-progress-history > div:not([hidden]) { padding-top: 22px; }
.turn-progress-history .assistant-output-step { margin-left: 0; }
.turn-progress-history .assistant-output-step:last-child { margin-bottom: 6px; }
@media (max-width: 640px) {
.assistant-output-step { margin-left: 6px; padding-left: 15px; }
.assistant-output-latest { margin-left: 5px; padding-right: 10px; }
.assistant-output-message [data-message-text] > .markdown-body { font-size: max(15px, var(--chat-font-size)); }
}
@media (hover: none), (pointer: coarse) {
.assistant-output-actions {
opacity: 1;
pointer-events: auto;
}
.assistant-output-actions button { width: 44px; height: 44px !important; min-height: 44px !important; }
.turn-progress-toggle { min-height: 44px; }
}
html[data-touch-targets="accessible"] .assistant-output-actions {
opacity: 1;
pointer-events: auto;
}
html[data-touch-targets="accessible"] .assistant-output-actions button { width: 44px; height: 44px !important; min-height: 44px !important; }
html[data-touch-targets="accessible"] .turn-progress-toggle { min-height: 44px; }

.message-copy-actions {
display: flex;
flex-wrap: wrap;
Expand Down
28 changes: 28 additions & 0 deletions components/ChatWindow-live-tail.transition.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import assert from "node:assert/strict";
import "../tests/setup-dom.mjs";
import test, { afterEach } from "node:test";
import React from "react";

const { render, fireEvent, cleanup } = await import("@testing-library/react/pure.js");
const { ChatLiveTail } = await import("./ChatWindow-live-tail.tsx");
afterEach(cleanup);

test("first streamed text preserves a manually opened thinking block", () => {
const thinking = { type: "thinking", thinking: "Checking the details" };
const message = { role: "assistant", provider: "p", model: "m", timestamp: 1, content: [thinking] };
const props = {
streamingMessage: message, isStreaming: true, previousOutputModel: null,
pendingToolHeaders: [], deferredBash: [], pendingBash: null, toolResults: new Map(),
modelNames: {}, cwd: undefined, sessionId: undefined,
toolCallsDefaultCollapsed: true, expandThinkingByDefault: false, hideThinking: false,
};
const view = render(React.createElement(ChatLiveTail, props));
fireEvent.click(view.getByRole("button", { name: /Thinking/ }));
assert.ok(view.getByText("Checking the details"));
view.rerender(React.createElement(ChatLiveTail, {
...props,
streamingMessage: { ...message, content: [thinking, { type: "text", text: "First answer" }] },
}));
assert.ok(view.getByText("Checking the details"));
assert.ok(view.getByText("First answer"));
});
43 changes: 29 additions & 14 deletions components/ChatWindow-live-tail.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
"use client";

import type { AgentMessage, BashExecutionMessage, ToolResultMessage } from "@/lib/types";
import type { AgentMessage, AssistantMessage, BashExecutionMessage, ToolResultMessage } from "@/lib/types";
import { useI18n } from "@/lib/i18n";
import { MessageView } from "./MessageView";
import { assistantModelName, AssistantOutputStep, AssistantTurnHeader, hasAssistantOutput } from "./TranscriptOutput";

/** What `ChatLiveTail` needs from `ChatWindow`: the not-yet-committed end of the running turn. */
export interface ChatLiveTailProps {
/** The reply omp is streaming, also while held until its committed row replaces it. */
streamingMessage: Partial<AgentMessage> | null;
isStreaming: boolean;
/** Provider and model of the preceding visible assistant output, if any. */
previousOutputModel: string | null;
liveTokensPerSecond?: number | null;
/** Running tools no message renders yet, shown as status rows while tool calls are collapsed. */
pendingToolHeaders: { id: string; name: string }[];
Expand All @@ -27,27 +31,38 @@ export interface ChatLiveTailProps {

/** The running turn's live end after the committed transcript: streaming reply, pending tool rows, `!command` output. */
export function ChatLiveTail({
streamingMessage, liveTokensPerSecond, pendingToolHeaders, deferredBash, pendingBash, toolResults, modelNames, cwd, onOpenFile, sessionId,
streamingMessage, isStreaming, previousOutputModel, liveTokensPerSecond, pendingToolHeaders, deferredBash, pendingBash, toolResults, modelNames, cwd, onOpenFile, sessionId,
toolCallsDefaultCollapsed, expandThinkingByDefault, hideThinking,
}: ChatLiveTailProps) {
const { t } = useI18n();
const hasOutput = streamingMessage?.role === "assistant" && hasAssistantOutput(streamingMessage);
return (
<>
{/* Also while held: a finished reply stays until its saved row
replaces it in the same render (useAgentSession-stream). */}
{streamingMessage && (
<MessageView
key={streamingMessage.timestamp ?? "stream"}
message={streamingMessage as AgentMessage}
modelNames={modelNames}
cwd={cwd}
onOpenFile={onOpenFile}
toolResults={toolResults}
toolCallsDefaultCollapsed={toolCallsDefaultCollapsed}
expandThinkingByDefault={expandThinkingByDefault}
hideThinking={hideThinking}
liveTokensPerSecond={liveTokensPerSecond}
/>
<>
{hasOutput && streamingMessage.role === "assistant" && previousOutputModel !== `${streamingMessage.provider}:${streamingMessage.model}` && (
<AssistantTurnHeader model={assistantModelName(streamingMessage as AssistantMessage, modelNames)} />
)}
<AssistantOutputStep active={hasOutput} latest={hasOutput}>
<MessageView
key={streamingMessage.timestamp ?? "stream"}
message={streamingMessage as AgentMessage}
isStreaming={isStreaming}
modelNames={modelNames}
cwd={cwd}
onOpenFile={onOpenFile}
toolResults={toolResults}
toolCallsDefaultCollapsed={toolCallsDefaultCollapsed}
expandThinkingByDefault={expandThinkingByDefault}
hideThinking={hideThinking}
liveTokensPerSecond={liveTokensPerSecond}
hideModelLabel={hasOutput}
compactActions={hasOutput}
/>
</AssistantOutputStep>
</>
)}

{toolCallsDefaultCollapsed && pendingToolHeaders.map((tool) => (
Expand Down
Loading
Loading