Skip to content
Merged
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 @@ -17,6 +17,7 @@ All notable changes to **tau** (`@ompweb-dev/tau`) are documented in this file.

### Changed

- **Chats and files open as tabs in one strip above the chat.** Every conversation you open gets a tab beside the files you open, in the order they were opened; clicking a tab shows it, and closing the shown conversation shows its neighbour (or a new chat in its workspace once none is left). Files now open in the main area instead of the file panel, with their actions (mention, copy path, reveal, download, close) at the end of the strip; the file panel keeps Explorer, Git, Worktrees and the other tools. While a file is shown, the chat behind it keeps its place and Esc no longer stops its run. An agent's `open_file` from the shown conversation also opens over its chat. On a phone the strip is the same, scrolled sideways.
- **One light and one dark theme, modelled on Pendant.** tau ships Light (warm paper surfaces) and Dark (charcoal), both with a muted blue accent, plus System, which follows the operating system and is the default. Midnight, Dracula, Nord and the other nine themes are gone: a stored choice of one of them now reads as Light or Dark, whichever side it was on. Headings use the UI's sans instead of a serif, and the fonts only those themes used (Geist, JetBrains Mono, Source Serif, Noto Serif SC) are no longer shipped. On desktop the sidebar, the chat and the file panel are rounded cards on a frame of their own. Your message is a bordered bubble, the selected session is outlined, and Send is a round arrow button in the text colour.
- **tau runs sessions on pi.** Every session is a `pi --mode rpc` child (`@earendil-works/pi-coding-agent`, found on `PATH` or through `TAU_PI_BIN`) loaded with tau's companion extension (`lib/pi/tau-extension.ts`), which adds host tools, the `ask` dialog, message origins, `/btw`, history Edit and per-host provider logins. The ompweb omp runner, its pinned release and `fetch-omp` are gone. tau keeps pi's state in `~/.pi/agent` (sessions, `settings.json`, `models.json`), lists and installs pi packages and skills instead of omp plugins, and mirrors pi's configuration to cluster members. The host link starts again at protocol v1, and host software updates go through a separately versioned maintenance API. tau shares no state with ompweb: hosts, settings and sessions are set up anew. The routes `/api/omp-settings` and `/api/omp-version` are now `/api/pi-settings` and `/api/pi-version`, a host without pi reports `pi-missing`, and the unused `/api/omp-update` route is removed.
- **Browsers connect over server-sent events only.** The browser WebSocket link (`/api/events/link`) and the Settings → Interface & Behavior → **Browser connection** choice are gone; chat commands and uploads go over HTTP. A stored `browserTransport` setting is ignored.
Expand Down
192 changes: 163 additions & 29 deletions components/AppShell.tsx

Large diffs are not rendered by default.

19 changes: 15 additions & 4 deletions components/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
];

interface Props {
/** A file tab covers the chat: its window-level dictation keys stay off. */
covered?: boolean;
/** Without `outbox`, only a rejected submission is restored; completed/superseded runs must not be replayed.
* `uploads`: the ids of files sent As file, passed only when there are some. `options` preserves explicit model-input
* intent when attachments or prefills would otherwise leave a shell-looking string. */
Expand Down Expand Up @@ -280,6 +282,7 @@
}

export const ChatInput = memo(forwardRef<ChatInputHandle, Props>(function ChatInput({
covered = false,
onSend, onAbort, onSteer, onFollowUp, isStreaming, model, isAutoModelSelection, modelNames, modelList, modelError, modelsLoading, onModelChange,
onAbortCompaction, isCompacting, compactResult,
thinkingLevel, onThinkingLevelChange, availableThinkingLevels, thinkingLevelMap, modelNameOverride,
Expand Down Expand Up @@ -1227,7 +1230,7 @@
// so Escape/Enter are handled at window level: Escape cancels/discard, Enter
// retries after an error or converts the recording to text.
useEffect(() => {
if (!(isRecording || isPaused || isReviewing || isTranscribing || transcribeError)) return;
if (covered || !(isRecording || isPaused || isReviewing || isTranscribing || transcribeError)) return;
const onKeyDown = (e: globalThis.KeyboardEvent) => {
if (e.key === "Escape") {
e.preventDefault();
Expand All @@ -1245,7 +1248,7 @@
};
window.addEventListener("keydown", onKeyDown);
return () => window.removeEventListener("keydown", onKeyDown);
}, [isRecording, isPaused, isReviewing, isTranscribing, transcribeError, cancelDictation, retryDictation, confirmTranscribeDictation, stopDictation]);
}, [covered, isRecording, isPaused, isReviewing, isTranscribing, transcribeError, cancelDictation, retryDictation, confirmTranscribeDictation, stopDictation]);

const slashQuery = slashMatch?.query ?? null;
const isMidPromptSkillLookup = slashMatch?.mode === "mid-prompt";
Expand Down Expand Up @@ -1923,7 +1926,7 @@
}
}
},
[isMobile, isStreaming, onSteer, onFollowUp, onAbort, onMinimize, slashMenuOpen, slashQuery, filteredSlashCommands, slashActiveIndex, applySlashCommand, sendQueued, handleSend, getNextSlashIndex, atMenuOpen, atQuery, atMatches, atActiveIndex, applyAtCompletion, historyMenuOpen, inputHistory, historyActiveIndex, applyHistoryInput, value, toggleDictation, setValue]

Check warning on line 1929 in components/ChatInput.tsx

View workflow job for this annotation

GitHub Actions / Verify (windows-latest)

React Hook useCallback has an unnecessary dependency: 'setValue'. Either exclude it or remove the dependency array

Check warning on line 1929 in components/ChatInput.tsx

View workflow job for this annotation

GitHub Actions / Verify (macos-latest)

React Hook useCallback has an unnecessary dependency: 'setValue'. Either exclude it or remove the dependency array

Check warning on line 1929 in components/ChatInput.tsx

View workflow job for this annotation

GitHub Actions / Verify (ubuntu-latest)

React Hook useCallback has an unnecessary dependency: 'setValue'. Either exclude it or remove the dependency array
);

// The fullscreen editor submits like Enter in the composer: during a run it queues or steers.
Expand Down Expand Up @@ -2122,8 +2125,16 @@
}
}
}, [contextOpen, contextContainer]);
// A file tab covering the chat closes what the chat shows outside its own
// area: the context panel (in the header on mobile) and the fullscreen editor
// (portaled to the body; its text stays in the composer).
useEffect(() => {
if (!contextOpen) return;
if (!covered) return;
setContextOpen(false);
setEditorFullscreen(false);
}, [covered]);
useEffect(() => {
if (!contextOpen || covered) return;
const onKeyDown = (event: globalThis.KeyboardEvent) => {
if (event.key !== "Escape" || event.isComposing || event.defaultPrevented) return;
const panel = contextWrapRef.current?.querySelector<HTMLElement>('[role="dialog"]');
Expand All @@ -2139,7 +2150,7 @@
};
document.addEventListener("keydown", onKeyDown, true);
return () => document.removeEventListener("keydown", onKeyDown, true);
}, [contextOpen]);
}, [contextOpen, covered]);

// Close dropdowns on outside click
useEffect(() => {
Expand Down
13 changes: 8 additions & 5 deletions components/ChatWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ interface Props {
hideThinkingBlock?: boolean;
onAgentEnd?: () => void;
onSessionCreated?: (session: SessionInfo) => void;
/** A file tab covers this chat: its window-level keys (Esc stop, model and thinking cycling, dictation) stay off. */
covered?: boolean;
onSessionForked?: (newSessionId: string) => void;
modelsRefreshKey?: number;
chatInputRef?: React.RefObject<ChatInputHandle | null>;
Expand Down Expand Up @@ -390,7 +392,7 @@ const CommittedTranscript = memo(function CommittedTranscript({
);
});

export function ChatWindow({ session, newSessionCwd, newSessionHostId, newSessionCreationId, newSessionPoolId, newSessionProjectId, newSessionInitialization, onNewSessionInitialization, hostStatus: channelHostStatus, hostLabel, newSessionWorkspace, toolCallsDefaultCollapsed = true, hideToolActivity = true, neverFoldActivity = false, showToolCallsUnfolded = false, expandThinkingByDefault = false, hideThinkingBlock = false, onAgentEnd, onSessionCreated, onSessionForked, modelsRefreshKey, chatInputRef, sessionInfoContainer, onBranchDataChange, onSystemPromptChange, onSystemPromptLoaderChange, onSessionStatsChange, onSessionStatsPanelOpen, onGenerationSpeedChange, onOpenFile: onOpenWorkspaceFile, onOpenUrl, onOpenProviders, searchQuery = "", searchTarget = null, onSearchTargetHandled }: Props) {
export function ChatWindow({ session, newSessionCwd, newSessionHostId, newSessionCreationId, newSessionPoolId, newSessionProjectId, newSessionInitialization, onNewSessionInitialization, hostStatus: channelHostStatus, hostLabel, newSessionWorkspace, toolCallsDefaultCollapsed = true, hideToolActivity = true, neverFoldActivity = false, showToolCallsUnfolded = false, expandThinkingByDefault = false, hideThinkingBlock = false, onAgentEnd, onSessionCreated, onSessionForked, modelsRefreshKey, chatInputRef, sessionInfoContainer, onBranchDataChange, onSystemPromptChange, onSystemPromptLoaderChange, onSessionStatsChange, onSessionStatsPanelOpen, onGenerationSpeedChange, onOpenFile: onOpenWorkspaceFile, onOpenUrl, onOpenProviders, searchQuery = "", searchTarget = null, onSearchTargetHandled, covered = false }: Props) {
const { t, tn } = useI18n();
const fileSource = useMemo<WorkspaceFileSource>(() => ({
hostId: session?.hostId ?? newSessionHostId ?? "local",
Expand Down Expand Up @@ -518,15 +520,15 @@ export function ChatWindow({ session, newSessionCwd, newSessionHostId, newSessio
// matters: unmounting mid-run must not leave the module-global handler
// pointing at this (now unmounted) instance's handleAbort.
useEffect(() => {
registerAbortHandler(sessionBusy ? handleAbort : null);
registerAbortHandler(sessionBusy && !covered ? handleAbort : null);
return () => registerAbortHandler(null);
}, [sessionBusy, handleAbort]);
}, [sessionBusy, handleAbort, covered]);

// Cycle model / thinking level via ⌘/Ctrl+Alt+M and ⌘/Ctrl+Alt+T (RPC
// cycle_model / cycle_thinking_level). Meta/Alt combos avoid clashing with
// ordinary typing in the composer.
useEffect(() => {
if (!session) return;
if (!session || covered) return;
const handler = (e: KeyboardEvent) => {
if (!(e.metaKey || e.ctrlKey) || !e.altKey) return;
const key = e.key.toLowerCase();
Expand All @@ -540,7 +542,7 @@ export function ChatWindow({ session, newSessionCwd, newSessionHostId, newSessio
};
window.addEventListener("keydown", handler);
return () => window.removeEventListener("keydown", handler);
}, [session, handleCycleModel, handleCycleThinkingLevel]);
}, [session, covered, handleCycleModel, handleCycleThinkingLevel]);

// --- Lazy-load historical messages ---
// Only render the last N messages initially. When the user scrolls to the
Expand Down Expand Up @@ -916,6 +918,7 @@ export function ChatWindow({ session, newSessionCwd, newSessionHostId, newSessio
const chatInputElement = (
<ChatInput
ref={composerRef}
covered={covered}
sessionInfoContainer={sessionInfoContainer}
onSend={handleSend}
onAbort={handleAbort}
Expand Down
12 changes: 1 addition & 11 deletions components/ConnectionDiagnostics.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ const sseDiagnostics = {

function rightPanelProps(overrides) {
return {
fileTabs: [],
activeFileTabId: null,
activeFilePath: null,
rightPanelOpen: true,
onClose: () => {},
rightPanelWidth: null,
Expand All @@ -65,19 +64,10 @@ function rightPanelProps(overrides) {
isMobile: false,
isCompactOverlay: false,
onOpenFile: () => {},
onSelectFileTab: () => {},
onCloseFileTab: () => {},
onCloseOtherFileTabs: () => {},
onCloseAllFileTabs: () => {},
onMentionActiveFile: () => {},
onCopyActiveFilePath: () => {},
onDownloadActiveFile: () => {},
onRevealActiveFile: () => {},
onExplorerRefresh: () => {},
onExplorerRefreshDone: () => {},
onAtMention: () => {},
onAtMentions: () => {},
onMentionLines: () => {},
onExplorerGitStatus: () => {},
onResetRightPanelWidth: () => {},
onRightPanelResizeStart: () => {},
Expand Down
131 changes: 131 additions & 0 deletions components/FileTabs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
"use client";

import { memo } from "react";
import { AtSign, Copy, Download, FileX, LocateFixed } from "lucide-react";
import { FileViewer } from "./FileViewer";
import type { Tab } from "./TabBar";
import { useI18n } from "@/lib/i18n";
import { getFileName } from "@/lib/file-paths";
import type { WorkspaceFileSource } from "@/lib/workspace-types";

/** Actions on the open file tab, shown at the end of the main tab strip. */
// Memoized like RightPanel was for these: AppShell re-renders on every
// streaming tick, and its callbacks are useCallback-stable.
export const FileTabToolbar = memo(function FileTabToolbar({ activeFileTab, fileTabs, activeFileMatchesSource, revealPath, onMentionActiveFile, onCopyActiveFilePath, onRevealActiveFile, onDownloadActiveFile, onCloseOtherFileTabs, onCloseAllFileTabs }: {
activeFileTab: Tab;
fileTabs: Tab[];
/** The file belongs to the shown conversation's workspace: mention and reveal work. */
activeFileMatchesSource: boolean;
revealPath: string | null;
onMentionActiveFile: () => void;
onCopyActiveFilePath: () => void;
onRevealActiveFile: () => void;
onDownloadActiveFile: () => void;
onCloseOtherFileTabs: () => void;
onCloseAllFileTabs: () => void;
}) {
const { t } = useI18n();
return (
<div style={{ display: "flex", alignItems: "center", flexShrink: 0, padding: "0 2px" }} role="toolbar" aria-label={activeFileTab.filePath}>
<button
onClick={onMentionActiveFile}
disabled={!activeFileMatchesSource}
title={t("appShell.mentionFileInChat")}
aria-label={t("appShell.mentionFileInChat")}
style={{ display: "flex", alignItems: "center", justifyContent: "center", width: 26, height: 26, padding: 0, background: "none", border: "none", borderRadius: "var(--radius-control)", color: "var(--accent)", cursor: activeFileMatchesSource ? "pointer" : "default", opacity: activeFileMatchesSource ? 1 : 0.45 }}
onMouseEnter={(e) => { e.currentTarget.style.background = "var(--bg-hover)"; }}
onMouseLeave={(e) => { e.currentTarget.style.background = "none"; }}
>
<AtSign size={13} strokeWidth={2.2} aria-hidden="true" />
</button>
<button
onClick={onCopyActiveFilePath}
title={t("appShell.copyFilePath")}
aria-label={t("appShell.copyFilePath")}
style={{ display: "flex", alignItems: "center", justifyContent: "center", width: 26, height: 26, padding: 0, background: "none", border: "none", borderRadius: "var(--radius-control)", color: "var(--text-dim)", cursor: "pointer" }}
onMouseEnter={(e) => { e.currentTarget.style.color = "var(--text)"; e.currentTarget.style.background = "var(--bg-hover)"; }}
onMouseLeave={(e) => { e.currentTarget.style.color = "var(--text-dim)"; e.currentTarget.style.background = "none"; }}
>
<Copy size={13} strokeWidth={2} aria-hidden="true" />
</button>
<button
onClick={onRevealActiveFile}
disabled={!activeFileMatchesSource}
title={t(activeFileMatchesSource ? "appShell.revealInExplorer" : "appShell.revealSourceSession")}
aria-label={t("appShell.revealInExplorer")}
style={{ display: "flex", alignItems: "center", justifyContent: "center", width: 26, height: 26, padding: 0, background: revealPath ? "var(--bg-hover)" : "none", border: "none", borderRadius: "var(--radius-control)", color: revealPath ? "var(--accent)" : "var(--text-dim)", cursor: activeFileMatchesSource ? "pointer" : "not-allowed", opacity: activeFileMatchesSource ? 1 : 0.5 }}
onMouseEnter={(e) => { e.currentTarget.style.color = "var(--text)"; e.currentTarget.style.background = "var(--bg-hover)"; }}
onMouseLeave={(e) => { e.currentTarget.style.color = revealPath ? "var(--accent)" : "var(--text-dim)"; e.currentTarget.style.background = revealPath ? "var(--bg-hover)" : "none"; }}
>
<LocateFixed size={13} strokeWidth={2} aria-hidden="true" />
</button>
<button
onClick={onDownloadActiveFile}
title={t("fileExplorer.downloadFile")}
aria-label={t("fileExplorer.downloadFile")}
style={{ display: "flex", alignItems: "center", justifyContent: "center", width: 26, height: 26, padding: 0, background: "none", border: "none", borderRadius: "var(--radius-control)", color: "var(--text-dim)", cursor: "pointer" }}
onMouseEnter={(e) => { e.currentTarget.style.color = "var(--text)"; e.currentTarget.style.background = "var(--bg-hover)"; }}
onMouseLeave={(e) => { e.currentTarget.style.color = "var(--text-dim)"; e.currentTarget.style.background = "none"; }}
>
<Download size={13} strokeWidth={2} aria-hidden="true" />
</button>
{fileTabs.length > 1 && (
<button
onClick={onCloseOtherFileTabs}
title={t("appShell.closeOtherTabs")}
aria-label={t("appShell.closeOtherTabs")}
style={{ display: "flex", alignItems: "center", justifyContent: "center", height: 26, padding: "0 7px", background: "none", border: "none", borderRadius: "var(--radius-control)", color: "var(--text-dim)", cursor: "pointer", fontSize: 11, fontWeight: 600, whiteSpace: "nowrap" }}
onMouseEnter={(e) => { e.currentTarget.style.color = "var(--text)"; e.currentTarget.style.background = "var(--bg-hover)"; }}
onMouseLeave={(e) => { e.currentTarget.style.color = "var(--text-dim)"; e.currentTarget.style.background = "none"; }}
>
{t("appShell.closeOthers")}
</button>
)}
<button
onClick={onCloseAllFileTabs}
title={t("appShell.closeAllTabs")}
aria-label={t("appShell.closeAllTabs")}
style={{ display: "flex", alignItems: "center", justifyContent: "center", width: 26, height: 26, padding: 0, background: "none", border: "none", borderRadius: "var(--radius-control)", color: "var(--text-dim)", cursor: "pointer" }}
onMouseEnter={(e) => { e.currentTarget.style.color = "var(--text)"; e.currentTarget.style.background = "var(--bg-hover)"; }}
onMouseLeave={(e) => { e.currentTarget.style.color = "var(--text-dim)"; e.currentTarget.style.background = "none"; }}
>
<FileX size={13} strokeWidth={2} aria-hidden="true" />
</button>
</div>
);
});

/** Every open file's viewer, kept mounted so switching tabs preserves scroll and preview state. */
export const FileTabViews = memo(function FileTabViews({ fileTabs, activeFileTab, active, activeFileMatchesSource, explorerRefreshKey, onMentionLines, onOpenFile }: {
fileTabs: Tab[];
activeFileTab: Tab | null;
/** A file tab, not a chat, is the shown tab: the views cover the chat. */
active: boolean;
activeFileMatchesSource: boolean;
explorerRefreshKey: number;
onMentionLines: (relativePath: string, startLine: number, endLine: number) => void;
onOpenFile: (filePath: string, fileName: string, source: WorkspaceFileSource) => void;
}) {
return (
<div id="workspace-file-tabs" role="tabpanel" aria-label={activeFileTab?.filePath} style={{ display: active ? "block" : "none", position: "absolute", inset: 0, zIndex: 1, overflow: "hidden", background: "var(--bg)" }}>
{fileTabs.map((tab) => (
<div key={tab.id} style={{ display: tab.id === activeFileTab?.id ? "block" : "none", height: "100%" }}>
<FileViewer
filePath={tab.filePath}
hostId={tab.hostId}
cwd={tab.sourceCwd ?? undefined}
sourceSessionId={tab.sourceSessionId}
gitRefreshKey={explorerRefreshKey}
active={tab.id === activeFileTab?.id && active}
onMentionLines={tab.id === activeFileTab?.id && active && activeFileMatchesSource ? onMentionLines : undefined}
onOpenFile={(filePath) => onOpenFile(
filePath,
getFileName(filePath),
{ hostId: tab.hostId, cwd: tab.sourceCwd, sessionId: tab.sourceSessionId ?? null },
)}
/>
</div>
))}
</div>
);
});
Loading
Loading