Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
a18fd4c
feat(client): render remote conversation messages through the source …
DoodleBears Oct 21, 2026
52e7736
test(client): cover remote questions with Host-scoped cards
DoodleBears Oct 21, 2026
d26e8d3
style: preserve source line endings in integration edits
DoodleBears Oct 21, 2026
8c7fb43
test(client): distinguish accepted and stale remote approval outcomes
DoodleBears Oct 21, 2026
128b7f2
refactor(client): share Host request actions with remote conversation…
DoodleBears Oct 21, 2026
a246f7d
fix(client): preserve remote avatars and localized request refusals
DoodleBears Oct 21, 2026
f681996
test(client): complete MarkdownText mocks for remote body imports
DoodleBears Oct 21, 2026
ce59399
test(client): verify remote message rendering after Host read integra…
DoodleBears Oct 21, 2026
5ee939e
fix(client): isolate remote activity errors and restore retries
DoodleBears Oct 21, 2026
b439bbc
test(client): cover shared request read errors in remote conversation…
DoodleBears Oct 21, 2026
fb09be2
fix(client): localize remote folder request failures
DoodleBears Oct 21, 2026
7fbaceb
test(client): align source isolation types and refresh remote body ev…
DoodleBears Oct 21, 2026
27f3749
test(client): cover viewer and message lifecycle integration
DoodleBears Oct 21, 2026
bdfde68
fix(client): reuse shared attachment retry button
DoodleBears Oct 21, 2026
0e770c4
fix(client): load remote files on intent and retain conversation exit
DoodleBears Oct 21, 2026
e729105
fix(client): offer retry for images reopened offline
DoodleBears Oct 21, 2026
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
7 changes: 5 additions & 2 deletions .agents/skills/verify-deepseekbot/features/remote-hosts.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The browser pairs a Remote Host as a Paired Device and reads its Host Feed throu
- `avatars`: remote Bot portraits and group images/member stacks appear in rows and conversation headers; Bot message authors and live drafts use the same remote portrait.
- `activity-unread`: remote Bot rows display received activity; DM/group unread counts come from their Host Inbox.
- `read`: a visible remote conversation at its latest message marks that message read on its owning Host and refreshes the shared Inbox.
- `message-body`: remote images, files, rich text and request cards use the existing message body, with authenticated resources and decisions on the source Host.
- `upgrade`: existing browser pairings and the selected tab survive the storage-key rename.
- `remove`: removing a Host forgets its rows, stops its Inbox and releases cached avatar object URLs.
- `viewers`: a remote Bot DM opens Browser or Computer when that Bot has access. The shared Host viewer modules read frames and send input to that Host only; closing, switching source or losing the connection tears down the viewer and releases requested control.
Expand Down Expand Up @@ -38,13 +39,15 @@ For Remote settings, use two disposable Hosts with different home basenames and

The default-model proof must change the model value on a Profile whose native settings owner can save it; a same-value no-op is insufficient. Keep a page's observed revision, change the default from another client, and verify the old page refuses without overwriting it. Explicit refresh must permit a subsequent save. Omit the catalog revision at the test transport boundary to verify the shared client refuses before any write; label that case as fault injection. For existing presets, verify Enter plus blur increments the revision once, a later blur saves independently, composition Enter does not submit, and a delayed write remains on its original Host/preset after closing and switching Hosts. Preserve the draft/error on a rejected save. New presets retain an explicit create action. Reject a remote storage preview token on the other Host, and verify neither cleanup command proceeds without its confirmation flag.

For message bodies, upload an image and a text file to Host B through its attachment API and send them in a disposable Channel. Open that Channel from Host A: the image may load immediately, but files and audio must not fetch until Download or Play is selected. Repeated pending clicks must share one request; downloading audio must not start playback. Verify that GET requests use Host B's device gateway. Switch source or close during a delayed response and verify that it cannot trigger a download or playback afterward. Refuse or remove source access and confirm the conversation retains its title and usable Close control without a timeline, composer or viewer. Request a real tool approval with `deepseek-v4-pro`, decide its card from Host A, and compare Host B's decision record with the unchanged Host A history. Capture the same conversation in light and dark before and after the renderer change. Switch between Hosts and Channels to verify draft/card isolation and media cleanup. A revoked device must never load an attachment through Host A instead.

## Gotchas

- The workspace hides `data-panel-empty-action` descendants. Viewer reconnect must stay in its own controls; verify the button is visible and clickable inside the real workspace, not only in a standalone panel render.
- Remote avatars consume the authenticated image cache; This Host retains its current read adapter.
- With unread messages on both Hosts, compare each row and tab with `channelUnreadCounts`. Open the remote DM/group, verify its count clears on that Host while the other Host stays unread. Keep an active Bot running to inspect its activity indicator. Stop only the task-owned remote Host and verify cached rows/counts remain with an offline tab.
- Activity timestamps are receipt times; they are not authoritative tool start times.
- Remote chat displays text and attachment names; images and cards are not qualified.
- Host looks remain device-local, including each phone's own icon and colour. DSH Desktop and two physical machines over a real tailnet are not qualified by a two-Host local run.
- The remote message renderer replaces the earlier text-and-attachment-names-only view. Qualify images and cards through the two-Host path above; test results remain separate from Human acceptance.
- Host looks are device-local by design. DSH Desktop and two physical machines over a real tailnet are not qualified by a two-Host local run; native phone qualification is separate.
- Control release uses the same device credential. An unreachable Host is retried when this viewer reconnects or reopens; a revoked credential cannot resume a Browser. In that case the Host operator resumes it. The Computer also has its existing Host-side pause lease.
- Dismiss Continue and Skip onboarding overlays before selecting Messages. Retain any failed drive evidence before retrying.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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-t5/after-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-t5/after-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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-t5/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-t5/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.
1 change: 1 addition & 0 deletions apps/mobile/src/host/attention-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { HostAnswerInvalid } from './bot-settings';
import type { HostClient } from './client';
import { uuid } from './conversation';
import type { HumanAssignmentContext, HumanAttentionItem, HumanAttentionPage } from './wire';
export { decideApproval, answerQuestion, decideGrantRequest } from './requests';

export interface AttentionRef {
id: string;
Expand Down
4 changes: 4 additions & 0 deletions apps/mobile/src/host/conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ export function shownInChat(message: ConversationMessage): boolean {
return false;
if (message.welcome === true) return false;
return (
message.source?.message.contentPurge !== undefined ||
message.source?.message.sessionFailure !== undefined ||
message.activity !== undefined ||
message.body.trim() !== '' ||
message.attachments.length > 0 ||
Expand All @@ -121,6 +123,7 @@ export function shownInChat(message: ConversationMessage): boolean {
}

export interface ConversationMessage {
source?: JournalEntry;
id: string;
revision?: number;
at: string;
Expand Down Expand Up @@ -418,6 +421,7 @@ function present(
const activity = activityOf(message);
return {
id: message.id,
source: entry,
revision: entry.revision,
at: message.at,
author: kind === 'human' ? 'human' : kind === 'bot' ? 'bot' : 'system',
Expand Down
17 changes: 17 additions & 0 deletions apps/mobile/src/host/message-display.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
import type { ConversationMessage } from './conversation';
import type { ChannelWireMessage } from './wire';

export function messageForDisplay(message: ConversationMessage): ChannelWireMessage {
return (
message.source?.message ?? {
id: message.id,
at: message.at,
body: message.body,
author:
message.author === 'bot'
? { kind: 'bot', slug: message.bot ?? '' }
: { kind: message.author },
}
);
}

export type MessageDisplayMode = 'streaming' | 'complete';

export function createMessageDisplayPreferences(storage: {
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/host/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export interface QuestionRequest extends RequestRef {

export type DecisionResult = 'accepted' | 'decided' | 'expired';

export type ApprovalChoice = 'allowed-once' | 'allowed-always-tool' | 'rejected';
export type ApprovalChoice = ToolApprovalOutcome;

export function requestRef(item: HumanAttentionItem): RequestRef | undefined {
if (item.channelId === undefined || item.messageId === undefined) return undefined;
Expand Down
1 change: 1 addition & 0 deletions apps/mobile/src/host/wire.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface WireAllBotMention {
}

export interface ChannelWireMessage extends WireMessage {
contentPurge?: unknown;
author: WireAuthor;
mentions?: WireMention[];
reactions?: WireReaction[];
Expand Down
42 changes: 42 additions & 0 deletions apps/mobile/test/conversation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
type ConversationSnapshot,
} from '../src/host/conversation';
import { createConversationPlayback } from '../src/host/conversation-playback';
import { messageForDisplay } from '../src/host/message-display';
import { FakeHost, type FakeChannel } from './fake-host';
import wire from './fixtures/host-wire.json';
import type { ChannelMessage } from '../../../packages/core/src/channels/channel';
Expand Down Expand Up @@ -89,6 +90,47 @@ function contiguous(snapshot: ConversationSnapshot): boolean {
}

describe('DM conversation', () => {
it('retains the source Channel and rich payload through the shared display projection', async () => {
const host = new FakeHost();
const channel = host.channel(DM);
channel.append(
{
id: 'rich-message',
author: { kind: 'bot', slug: SLUG },
body: 'Image and approval',
format: 'text',
attachments: [
{
fileId: 'file:11111111-1111-4111-8111-111111111111',
name: 'photo.png',
mime: 'image/png',
size: 12,
},
],
toolApprovalRequest: {
sessionId: 'session',
callId: 'call',
toolName: 'bash',
role: 'orchestrator',
cwd: '/source',
input: '{"command":"pwd"}',
},
},
false,
);
const live = await until(open(host), (snapshot) => snapshot.status === 'live');
const message = live.messages.find((entry) => entry.id === 'rich-message')!;
expect(message.source?.channelId).toBe(DM);
expect(messageForDisplay(message)).toMatchObject({
format: 'text',
toolApprovalRequest: { callId: 'call' },
attachments: [{ fileId: 'file:11111111-1111-4111-8111-111111111111' }],
});
expect(message.attachments[0]?.source?.uri).toContain(
`${ROUTE}/botharness-device/api/botharness/attachment?`,
);
});

it('shows paged committed history immediately while playback is held away from latest', async () => {
const host = new FakeHost();
seed(host.channel(DM), 25);
Expand Down
15 changes: 15 additions & 0 deletions changes/2500-remote-message-body.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
section: Added
---

## en

- Remote Host conversations show message images, files and request cards using the same message body as This Host; attachments and decisions go directly to the source Host with this browser's device credential ([#2500](https://github.com/BotHarness/DeepSeekBot/issues/2500)).
- Remote folder requests show localized retry guidance when browsing or authorization fails, while retaining the source Host's error for diagnostics ([#2500](https://github.com/BotHarness/DeepSeekBot/issues/2500)).
- Remote file downloads and audio playback load only after an explicit action; unavailable remote conversations retain their title and Close control, and images reopened offline offer Retry ([#2500](https://github.com/BotHarness/DeepSeekBot/issues/2500)).

## zh

- 远程会话复用本机的消息正文,显示图片、文件和请求卡片;附件读取与处理请求使用此浏览器的设备凭据,直接发往消息所属的 Host([#2500](https://github.com/BotHarness/DeepSeekBot/issues/2500))。
- 远程文件夹请求在浏览或授权失败时显示本地化重试提示,同时保留来源 Host 的原始错误供诊断([#2500](https://github.com/BotHarness/DeepSeekBot/issues/2500))。
- 远程文件下载与音频播放仅在操作后加载;远程会话不可用时仍保留标题和关闭入口,离线重开的图片显示重试操作([#2500](https://github.com/BotHarness/DeepSeekBot/issues/2500))。
2 changes: 2 additions & 0 deletions docs/architecture/botharness-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,8 @@ Remote Bot Browser and Computer viewers reuse `apps/mobile/src/host/browser-view

The application-defined browser `RemoteHosts` owner keeps its pairings and selected Host tab in device-local storage. Each Remote Host reuses the phone's Host client and conversation module through the device gateway; This Host never relays the Remote Host's credential. The shared `createInbox(client, { activity: true })` supplies each Remote Host's Human Inbox and unread snapshot. The first browser subscriber starts the client and Inbox, and the last stops them while retaining the last Inbox snapshot. Authenticated avatar fetches publish an immutable URL-to-object-URL map; removal, roster replacement and final unsubscribe release obsolete objects and discard late fetch results. The storage-key rename imports existing browser pairings and the selected tab. See [ADR-0242](../adr/0242-a-browser-pairs-other-computers-through-their-device-gateway.md) and [ADR-0243](../adr/0243-every-client-reads-every-host-through-one-host-feed.md).

Remote conversation presentation retains the source Channel Journal entry through the shared conversation and message-display modules, then uses the existing Web message body and request cards. A conversation-scoped adapter supplies the source Host client and validates the active Host/Channel before decisions. Attachment reads resolve through that client's `resource(path)` and device credential, with no local-store or local-URL fallback; changing conversations aborts reads and releases object URLs. Activity and conversation cards share `createHostRequestActions`, with request references from the Inbox and Journal respectively. Only a Host-accepted decision completes a submission; stale decisions trigger the existing cards' status reload. Decisions reuse the shared attention actions and remain subject to the source Host's ownership and permission checks.

Activity Center consumes each Remote Host's shared Inbox through `RemoteHosts.activity`, reusing the existing `HumanInboxView` for Host groups. Its Host-scoped source supplies identity, pagination, source navigation and commands; it never receives This Host's `BridgeActions`. `createHostActivityActions` adapts the shared attention and request operations to the existing approval and question cards. Each operation resolves the current pairing before calling its Host client, and confirmed changes refresh that Host's Inbox. Filtered observers share the Host client and stop with their last subscriber. This Host still reads its existing bridge/store until that Host Feed slice migrates. Device Notification Preference remains a subsequent device-owned slice; the browser has no closed-page notification path.

Remote Host settings resolve the selected Host's existing client from `RemoteHosts`. The browser reuses `apps/mobile/src/host/model-settings`, `usage` and `storage` for default models, presets, usage/Memory activity and cleanup; the existing Web settings, model picker, charts and destructive confirmation controls present those operations. Settings unmount their content when the source is disconnected or removed. Model resources are keyed by client and scope; there is no This Host fallback, Bot-profile link or automatic write replay. Cleanup retains the owning Host's preview token, scope and explicit confirmation. Host looks remain device-local and independent of these Host-owned settings.
Expand Down
12 changes: 8 additions & 4 deletions packages/client/src/client/bridge-audio-resource.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { fetchMessageResource, type MessageHost } from './message-host.js';
import { subscribeMessagingDefaults } from './messaging-defaults-live.js';

interface AudioState {
Expand All @@ -11,6 +12,7 @@ export function createBridgeAudioResource(
channelId: string,
sourceEventId: string,
attachmentId: string,
host?: MessageHost,
) {
let state = EMPTY;
let controller: AbortController | undefined;
Expand All @@ -34,15 +36,16 @@ export function createBridgeAudioResource(
const signal = AbortSignal.any([request.signal, AbortSignal.timeout(30000)]);
update({ loading: true });
try {
const response = await fetch(
'./api/botharness/attachment?' +
const response = await fetchMessageResource(
'/api/botharness/attachment?' +
new URLSearchParams({
channelId,
sourceEventId,
attachmentId,
representation: 'playback',
}),
{ signal },
signal,
host,
);
signal.throwIfAborted();
if (!response.ok || response.headers.get('content-type')?.split(';', 1)[0] !== 'audio/wav') {
Expand Down Expand Up @@ -96,7 +99,8 @@ export function createBridgeAudioResource(
getSnapshot: () => state,
subscribe(listener: () => void) {
listeners.add(listener);
if (listeners.size === 1) stopLive = subscribeMessagingDefaults(reset);
if (listeners.size === 1)
stopLive = host === undefined ? subscribeMessagingDefaults(reset) : undefined;
return () => {
listeners.delete(listener);
if (!listeners.size) {
Expand Down
28 changes: 24 additions & 4 deletions packages/client/src/client/bridge-audio.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { useMessageHost } from './message-host.js';
import { useMemo, useSyncExternalStore, type ReactElement } from 'react';
import { Button } from '@deepseek-ai/dsh-client-ui-primitives';
import { MessageAudio } from './message-audio.js';
import { createBridgeAudioResource } from './bridge-audio-resource.js';
import { createBridgeFileResource } from './bridge-file-resource.js';
import type { BotHarnessTranslate } from './locale.js';

export function BridgeAudio({
Expand All @@ -19,15 +21,29 @@ export function BridgeAudio({
sizeBytes?: number | undefined;
t: BotHarnessTranslate;
}): ReactElement {
const host = useMessageHost();
const resource = useMemo(
() => createBridgeAudioResource(channelId, sourceEventId, attachmentId),
[channelId, sourceEventId, attachmentId],
() => createBridgeAudioResource(channelId, sourceEventId, attachmentId, host),
[channelId, sourceEventId, attachmentId, host],
);
const state = useSyncExternalStore(
resource.subscribe,
resource.getSnapshot,
resource.getSnapshot,
);
const download = useMemo(
() => createBridgeFileResource(channelId, sourceEventId, attachmentId, host),
[channelId, sourceEventId, attachmentId, host],
);
const subscribeDownload = useMemo(
() => (host === undefined ? () => () => {} : download.subscribe),
[host, download],
);
const downloadState = useSyncExternalStore(
subscribeDownload,
download.getSnapshot,
download.getSnapshot,
);
const failures = {
unavailable: 'im.voiceAudioUnavailable',
format: 'im.voiceAudioFormat',
Expand All @@ -43,10 +59,13 @@ export function BridgeAudio({
size={sizeBytes}
url={state.url}
downloadUrl={
'./api/botharness/attachment?' +
new URLSearchParams({ channelId, sourceEventId, attachmentId })
host === undefined
? './api/botharness/attachment?' +
new URLSearchParams({ channelId, sourceEventId, attachmentId })
: state.url
}
onError={resource.fail}
onDownload={host === undefined ? undefined : () => void download.download(name)}
t={t}
/>
{state.url ? null : (
Expand All @@ -64,6 +83,7 @@ export function BridgeAudio({
)}
<p>{t('im.voiceAudioHint')}</p>
{state.failure ? <p role="alert">{t(failures[state.failure])}</p> : null}
{downloadState.failure ? <p role="alert">{t('bridgeFile.failed')}</p> : null}
</div>
);
}
12 changes: 8 additions & 4 deletions packages/client/src/client/bridge-file-resource.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { fetchMessageResource, type MessageHost } from './message-host.js';
import { subscribeMessagingDefaults } from './messaging-defaults-live.js';
import { boundedBridgeMediaRequest } from './bridge-media-request.js';

Expand All @@ -12,6 +13,7 @@ export function createBridgeFileResource(
channelId: string,
sourceEventId: string,
attachmentId: string,
host?: MessageHost,
) {
let state = EMPTY;
let controller: AbortController | undefined;
Expand All @@ -38,10 +40,11 @@ export function createBridgeFileResource(
update({ loading: true });
try {
await boundedBridgeMediaRequest(signal, async () => {
const response = await fetch(
'./api/botharness/attachment?' +
const response = await fetchMessageResource(
'/api/botharness/attachment?' +
new URLSearchParams({ channelId, sourceEventId, attachmentId }),
{ signal },
signal,
host,
);
signal.throwIfAborted();
if (!response.ok) {
Expand Down Expand Up @@ -109,7 +112,8 @@ export function createBridgeFileResource(
getSnapshot: () => state,
subscribe(listener: () => void) {
listeners.add(listener);
if (listeners.size === 1) stopLive = subscribeMessagingDefaults(reset);
if (listeners.size === 1)
stopLive = host === undefined ? subscribeMessagingDefaults(reset) : undefined;
return () => {
listeners.delete(listener);
if (!listeners.size) {
Expand Down
Loading
Loading