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
Binary file added .github/pr-screenshots/2500/add-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/pr-screenshots/2500/add-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/pr-screenshots/2500/all-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/pr-screenshots/2500/all-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/pr-screenshots/2500/before-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/pr-screenshots/2500/before-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/pr-screenshots/2500/chat-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/pr-screenshots/2500/chat-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/pr-screenshots/2500/tab-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/pr-screenshots/2500/tab-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions changes/2500-computer-tabs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
section: Added
---

## en

- The channel list has Computer tabs: **All** (the default), **This computer**, and one tab per other Computer. **Add computer** takes the pairing link from another Computer's Settings → Devices → Pair a phone, so a browser can list, open and answer that Computer's chats over Tailscale. Right-click a Computer's tab to remove it ([#2500](https://github.com/BotHarness/DeepSeekBot/issues/2500)).

## zh

- 频道列表加了电脑 tabs:**全部**(默认)、**这台电脑**,以及每台其他电脑各一个。**添加电脑**里粘贴另一台电脑「设置 → 设备 → 配对手机」的配对链接,浏览器就能通过 Tailscale 列出、打开并回复那台电脑的聊天。右键电脑的 tab 可以移除它([#2500](https://github.com/BotHarness/DeepSeekBot/issues/2500))。
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
Status: Accepted
Date: 2026-10-21
Issues: [#2500](https://github.com/BotHarness/DeepSeekBot/issues/2500), [#2180](https://github.com/BotHarness/DeepSeekBot/issues/2180), [#2178](https://github.com/BotHarness/DeepSeekBot/issues/2178)
---

# A browser pairs other Computers through their device gateway

The Web Client serves exactly one Host. The Human wants its channel list to work like the phone's (#2194): **All** by default, then one tab per Computer, with chats from another Computer on the tailnet listed, opened and answered in the same browser. Spec #2178 already fixes the authority split: each Computer owns its conversations, and a client's connections belong to that client (browser profile plus origin), never to a Host setting.

We decided that **the browser pairs another Computer exactly like a phone does, and talks to it directly with that per-device credential.** The other Host admits the cross-origin calls on its device gateway (ADR-0199); the serving Host never relays or stores the credential.

## Decision

- **Same pairing, same credential.** The Human copies the pairing link from the other Computer's Settings → Devices → Pair a phone and pastes it into **Add computer** in the channel list. The browser redeems the offer at `/botharness-device/pair` and keeps the returned device record in `localStorage` of the serving origin. The other Computer lists it as one more paired device ("Browser on …") and can revoke it there.
- **CORS only for header-authenticated paths.** The gateway answers cross-origin `pair`, `unpair`, `stream-ticket` and unary `/botharness-device/api/*` requests, including the preflight, only when the `Origin` is itself a Host-shaped address (loopback, Tailscale HTTPS or the Connect domain, the same check as phone routes) and the request carries no cookie. The cookie-authenticated full Web Client (`/botharness-device/web/`) stays same-origin. Responses echo that origin with `Vary: Origin` and never allow credentials, so a page needs the device secret itself; ambient cookies never authorize a cross-origin call.
- **Stream tickets.** Browsers cannot put an `Authorization` header on a WebSocket. The browser first `POST`s `/botharness-device/stream-ticket` with its credential and opens `/botharness-device/api/remote.mux?ticket=…`. A ticket is random, stored only as a hash, bound to the device, valid for 30 seconds and spent on first use; the device is checked again when it is used, so revocation still closes streams and refuses new ones. Phones keep the header form.
- **One client implementation.** The Web Client reuses the phone's Host client, pairing and conversation modules (`apps/mobile/src/host/`) behind a browser carrier, so wire handling, reconnects, drafts and sends stay one code path.
- **Source-scoped state.** Conversations are keyed by Computer and conversation, so the same Bot slug or Channel ID on two Computers never shares a draft, history or send. Removing a Computer revokes this browser there and drops its cached conversations.

## Consequences

- The first slice shows each other Computer as its own section under All and as its own tab; it does not merge them into one recency-sorted list, show images or cards, or sync read state. Those follow in later #2180 slices.
- The Computer look (icon and colour) is still stored per phone, so the Web Client uses a generic computer icon.
- DSH Desktop is not qualified by this slice; its storage and origin rules are verified separately (#2180).
74 changes: 67 additions & 7 deletions packages/client/src/client/bot-sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { Menu } from './appearance-primitives.js';
import { ALL_COMPUTERS, computerSources } from './computer-sources.js';
import { useChannelDockActive } from './channel-dock.js';
import {
ComputerSourceMark,
ComputerTabs,
RemoteComputerRows,
useComputerSources,
} from './computer-tabs.js';
import { plainMarkdown } from '../../../core/src/channels/message-preview.js';
import { PointerMenu } from './ds/pointer-menu.js';
import { PanelEmptyState } from './ds/empty-state.js';
Expand Down Expand Up @@ -592,6 +600,7 @@ function BotRow({
onMenu,
onPinDragStart,
onPinDragEnd,
source = false,
t,
}: {
bot: BotSummary;
Expand All @@ -609,6 +618,7 @@ function BotRow({
onMenu: (request: ChannelMenuRequest) => void;
onPinDragStart: (channelId: string) => void;
onPinDragEnd: () => void;
source?: boolean;
t: BotHarnessTranslate;
}): ReactElement {
const now = useMinuteNow();
Expand Down Expand Up @@ -694,6 +704,7 @@ function BotRow({
<span className="bh-body">
<span className="bh-top">
<span className="bh-name">{bot.displayName}</span>
{source ? <ComputerSourceMark /> : null}
{muted ? <MutedMark t={t} /> : null}
<ChannelMessageTime channel={channel} now={now} t={t} />
</span>
Expand Down Expand Up @@ -726,6 +737,7 @@ function ChannelRow({
onMenu,
onPinDragStart,
onPinDragEnd,
source = false,
t,
}: {
channel: ChannelSummary;
Expand All @@ -742,6 +754,7 @@ function ChannelRow({
onMenu: (request: ChannelMenuRequest) => void;
onPinDragStart?: ((channelId: string) => void) | undefined;
onPinDragEnd?: (() => void) | undefined;
source?: boolean;
t: BotHarnessTranslate;
}): ReactElement {
const now = useMinuteNow();
Expand Down Expand Up @@ -824,6 +837,7 @@ function ChannelRow({
<span className="bh-body">
<span className="bh-top">
<span className="bh-name">{channel.name}</span>
{source ? <ComputerSourceMark /> : null}
{muted ? <MutedMark t={t} /> : null}
<ChannelMessageTime channel={channel} now={now} t={t} />
</span>
Expand Down Expand Up @@ -1008,6 +1022,9 @@ export function BotSidebar({
t,
}: SidebarProps): ReactElement {
const state = useClientStore(keepClientState, rosterInputs);
const computerTabs = useChannelDockActive();
const computers = useComputerSources();
const remoteOpen = computerTabs && computers.open !== undefined;
const channelUnread = state.humanInbox.channelUnread;
const mutedChannelSet = new Set(state.roster.muted);
const prefs = useBotModePrefs((value) => value);
Expand Down Expand Up @@ -1316,9 +1333,13 @@ export function BotSidebar({
? visibleChannelIds
: [...railPinnedChannels, ...railChannels].map((channel) => channel.id);
const shortcutIdsRef = useRef<readonly string[]>(shortcutIds);
const openConversationRef = useRef(onOpenConversation);
const openLocalConversation = (): void => {
computerSources().close();
onOpenConversation?.();
};
const openConversationRef = useRef(openLocalConversation);
shortcutIdsRef.current = shortcutIds;
openConversationRef.current = onOpenConversation;
openConversationRef.current = openLocalConversation;
const navigationIdsRef = useRef<readonly string[]>([]);
navigationIdsRef.current = [...railPinnedChannels, ...railChannels].map((channel) => channel.id);
const dragActiveRef = useRef(false);
Expand Down Expand Up @@ -1466,9 +1487,10 @@ export function BotSidebar({
});
const visibleCount =
pinnedChannels.length + flatBlocks.reduce((total, block) => total + block.channels.length, 0);
const selectedBot = state.selection?.kind === 'bot' ? state.selection.slug : undefined;
const selectedBot =
!remoteOpen && state.selection?.kind === 'bot' ? state.selection.slug : undefined;
const selectedChannel =
state.selection?.kind === 'channel' ? state.selection.channelId : undefined;
!remoteOpen && state.selection?.kind === 'channel' ? state.selection.channelId : undefined;
const contextSection = state.roster.sections.find(
(section) => section.id === sectionContextMenu?.sectionId,
);
Expand Down Expand Up @@ -1823,15 +1845,15 @@ export function BotSidebar({
),
);
if (gesture !== 'plain') return;
onOpenConversation?.();
openLocalConversation();
void (channel.botSlug === undefined
? actions.openChannel(channel.id)
: actions.openBot(channel.botSlug));
};

const openQuickSwitcherEntry = ({ channel }: QuickSwitcherEntry): void => {
setQuickSwitcherOpen(false);
onOpenConversation?.();
openLocalConversation();
setChannelSelection((current) =>
selectChannels(
reconcileChannelSelection(current, visibleChannelIds),
Expand Down Expand Up @@ -1917,6 +1939,8 @@ export function BotSidebar({
useSectionDrag(commitSectionDrag);
dragActiveRef.current = channelDragActive || sectionDragActive;

const showSource =
computerTabs && computers.tab === ALL_COMPUTERS && computers.computers.length > 0;
const renderChannelRow = (channel: ChannelSummary, scopeId: ScopeId): ReactElement => {
const drag = channelDragProps(scopeId, channel.id);
const bot = channel.botSlug === undefined ? undefined : botBySlug.get(channel.botSlug);
Expand All @@ -1941,12 +1965,14 @@ export function BotSidebar({
onMenu={openChannelMenu}
onPinDragStart={(channelId) => startPinDrag(channelId, 'roster')}
onPinDragEnd={endPinDrag}
source={showSource}
/>
);
}
return (
<ChannelRow
t={t}
source={showSource}
key={channel.id}
channel={channel}
bots={botBySlug}
Expand Down Expand Up @@ -2167,6 +2193,27 @@ export function BotSidebar({
{headerEnd}
</div>
);
const remoteTab = computerTabs
? computers.computers.find((computer) => computer.host.hostId === computers.tab)
: undefined;
if (remoteTab !== undefined)
return (
<div className="bh-root bh-region" data-bh-tour="roster">
{headerTarget
? createPortal(<InstantTooltipScope>{header}</InstantTooltipScope>, headerTarget)
: header}
<ComputerTabs t={t} />
<div className="bh-roster-list">
<RemoteComputerRows
computer={remoteTab}
query={query}
showSource={false}
onOpen={onOpenConversation}
t={t}
/>
</div>
</div>
);
return (
<div
ref={rosterMount}
Expand Down Expand Up @@ -2214,6 +2261,7 @@ export function BotSidebar({
{headerTarget
? createPortal(<InstantTooltipScope>{header}</InstantTooltipScope>, headerTarget)
: header}
{computerTabs ? <ComputerTabs t={t} /> : null}
{state.status === 'loading' && state.bots.length === 0 ? (
<LoadingSkeleton kind="roster" label={t('roster.loading')} />
) : null}
Expand Down Expand Up @@ -2811,6 +2859,18 @@ export function BotSidebar({
</div>
);
})}
{computerTabs && computers.tab === ALL_COMPUTERS
? computers.computers.map((computer) => (
<RemoteComputerRows
key={computer.host.hostId}
computer={computer}
query={query}
showSource
onOpen={onOpenConversation}
t={t}
/>
))
: null}
</div>
{createRequest?.kind === 'bot' && createRequest.source === 'zip' ? (
<ImportBotZipModal
Expand Down Expand Up @@ -2965,7 +3025,7 @@ export function BotSidebar({
}}
onOpen={(channelId) => {
setHiddenManagerOpen(false);
onOpenConversation?.();
openLocalConversation();
void actions.openChannel(channelId);
}}
onClose={() => {
Expand Down
4 changes: 4 additions & 0 deletions packages/client/src/client/channel-dock.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { mountWorkspaceChrome, updateWorkspaceChrome } from './workspace-chrome.js';
import { useComputerSources } from './computer-tabs.js';
import { RemoteConversationView } from './remote-conversation-view.js';
import { AppearancePanelHeader } from './appearance-panel-header.js';
import { AppearanceContext } from './appearance-context.js';
import { PanelAppearanceSettings } from './appearance-panel-settings.js';
Expand Down Expand Up @@ -325,6 +327,8 @@ function workspaceState(dock: DockContextValue, id: string): SubpanelState | und

function ChannelBodyPanel(): ReactElement {
const dock = useDock();
const remote = useComputerSources().open;
if (remote !== undefined) return <RemoteConversationView target={remote} t={dock.t} />;
const panels: Record<string, { label: string; header?: ReactNode; content: ReactNode }> = {
[MESSAGE_LEAF]: { label: dock.t('workspace.messages'), content: <ChannelMessageContent /> },
};
Expand Down
Loading
Loading