From 4d7d9efbf56363d41f986f9d3e792b10805b6c5c Mon Sep 17 00:00:00 2001 From: DoodleBears Date: Sun, 15 Nov 2026 19:32:59 +0900 Subject: [PATCH 1/2] fix(client): unify Activity environments and header actions Issue: #4223 Agent-Task: codex/local/01a1d942-fe32-7141-be32-477d4749cfb9 --- .../verify-deepseekbot/features/README.md | 2 +- .../features/activity-inline-approval.md | 2 + .../features/remote-hosts.md | 2 +- changes/4223-activity-environment-headers.md | 11 + docs/architecture/botharness-architecture.md | 2 +- .../client/src/client/activity-approval.tsx | 10 +- .../src/client/activity-center-view.tsx | 230 ++++++++----- .../src/client/activity-environment-badge.tsx | 48 +++ .../src/client/activity-environments.ts | 86 +++++ .../client/src/client/activity-inbox-menu.tsx | 2 + .../src/client/activity-inbox-styles.ts | 4 + .../client/src/client/activity-list-view.tsx | 205 +++++++----- packages/client/src/client/bot-sidebar.tsx | 25 +- .../client/src/client/environment-panel.tsx | 30 +- .../client/src/client/remote-activity.tsx | 312 +++++------------- .../client/test/activity-environments.test.ts | 159 +++++++++ .../test/activity-list-keyboard-batch.test.ts | 140 ++++++-- packages/client/test/bot-sidebar.test.ts | 9 + .../client/test/remote-host-rows.test.tsx | 20 +- 19 files changed, 829 insertions(+), 470 deletions(-) create mode 100644 changes/4223-activity-environment-headers.md create mode 100644 packages/client/src/client/activity-environment-badge.tsx create mode 100644 packages/client/src/client/activity-environments.ts create mode 100644 packages/client/test/activity-environments.test.ts diff --git a/.agents/skills/verify-deepseekbot/features/README.md b/.agents/skills/verify-deepseekbot/features/README.md index 811954e0fb..6f4f2007e6 100644 --- a/.agents/skills/verify-deepseekbot/features/README.md +++ b/.agents/skills/verify-deepseekbot/features/README.md @@ -71,7 +71,7 @@ One file per user-facing feature. Each file has four sections: `Sub-features`, ` | Disposable Memory history, restore and stale-head refusal | no | `scripts/e2e-memory-restore.mjs` | [memory-restore.md](memory-restore.md) | | Version-bound Memory images, Markdown previews and CLI export | no | `scripts/e2e-memory-images.mjs`, `scripts/e2e-memory-markdown.mjs`, `scripts/e2e-memory-formats.mjs` | [memory-images.md](memory-images.md) | -| Activity Center: approvals, Remote Host actions, Channel mute and independent control-rail indicator; page and Dock | yes (real pending requests) | `scripts/e2e-inbox-tool-approval.mjs`, `scripts/e2e-activity-live.mjs`, `scripts/e2e-activity-approve-sync.mjs`, `scripts/e2e-activity-load.mjs` | [activity-inline-approval.md](activity-inline-approval.md) | +| Activity Center: shared header Environment selector, per-item source badges, approvals, Remote Host actions, Channel mute and independent control-rail indicator; page and Dock | yes (real pending requests) | `scripts/e2e-inbox-tool-approval.mjs`, `scripts/e2e-activity-live.mjs`, `scripts/e2e-activity-approve-sync.mjs`, `scripts/e2e-activity-load.mjs` | [activity-inline-approval.md](activity-inline-approval.md) | | Assignment Report identity, continuation, restart and refusals | no for reads; yes to produce reports | none (isolated Host CLI journey) | [assignment-report-continuation.md](assignment-report-continuation.md) | diff --git a/.agents/skills/verify-deepseekbot/features/activity-inline-approval.md b/.agents/skills/verify-deepseekbot/features/activity-inline-approval.md index cc26ca1218..a706ae81da 100644 --- a/.agents/skills/verify-deepseekbot/features/activity-inline-approval.md +++ b/.agents/skills/verify-deepseekbot/features/activity-inline-approval.md @@ -10,10 +10,12 @@ - Dock decides the card's own Channel request while another Channel remains selected. - Batch controls appear only in explicit Select mode. Needs you, For you and Other unread are independently collapsible sections; initial state is expanded, with browser/Host-origin collapse preferences. History stays in the header menu. - Search expands inside the header like the Channel list, uses the Host query across all eligible results (not just loaded rows), and retains section order. Each section paginates independently; failed reads retain existing rows and offer retry. +- The Environment selector lives in the header on both surfaces. All merges each category across Hosts once, without Host sections. Every item carries its source icon and name at the upper right, including in a single Environment. Equal attention/Channel/message IDs on different Hosts remain independently selectable and route actions to their own Host. ## How to get to it (user POV) Enter Bot mode and open Activity Center from the workspace control rail on desktop. +Use the header Environment selector to switch between All and one Host. With unread messages on both Hosts, verify one Needs you / For you / Other unread heading each, per-item source badges, source navigation and a mixed selection's read acknowledgement against both canonical Host timelines. Stop only a task-owned Host and retain its named unavailable status and cached rows; restore it before testing pagination and query changes. This opens Dock even without a selected Channel. The narrow Web shell exposes Activity Center in its Bot mode navigation and opens the full page. Wait for responsive navigation to finish mounting after resizing. Toggle the other panels off from the rail for a wide diff --git a/.agents/skills/verify-deepseekbot/features/remote-hosts.md b/.agents/skills/verify-deepseekbot/features/remote-hosts.md index dd71f325e2..b3e96b242d 100644 --- a/.agents/skills/verify-deepseekbot/features/remote-hosts.md +++ b/.agents/skills/verify-deepseekbot/features/remote-hosts.md @@ -59,7 +59,7 @@ E11 remote Connections: open Environment → Manage the named remote Host → Co E11 recovery boundaries: revoking this browser must explain re-adding and authorizing it, rather than recovering by another route; Cancel leaves access intact. Native independent-device revocation and a route stop must acknowledge the exact requested operation, retain sibling access and read back the owning Host. Controlled boundary regressions cover malformed HTTP200 acknowledgements retaining unknown, a persisted credential replacement before storage-event delivery refusing dispatch, and a same-grant route change while waiting for the credential transaction requiring fresh disconnection consent. Expired or failed preflight checks create no new execution record or Host write. Partial storage failures leave one recoverable generation and never replay it; invalid legacy references or cleanup keys cannot delete credentials. A new nonempty version3 execution index must reject both older array-only and version2 Client parsers globally, including an older writer on another Host, so it cannot discard another unknown record. Reload a current Client for readback, retain unresolved legacy facts, and require same-pin readback after a genuine grant replacement. Do not forge live storage or responses to manufacture runtime evidence; use controlled regressions for those failures. -Enter Bot mode, then Messages. Open the channel header's add menu and choose Add remote. Paste a link from the other Host's Settings → Devices → Pair a phone. Choose All or the Remote Host icon, then a Bot or group row. Right-click the Host icon and choose Remove to remove it. A remote Bot DM with Browser or Computer access shows the corresponding header button. Open its viewer, choose Pause Bot and take control, interact with the screen or send text, then Resume Bot or Close viewer. Groups have no viewer entry. +Enter Bot mode, then Environments. Use the header's Add remote plus icon; the list body has no add footer, and the Channels create menu has no Add remote item. Paste a link from the other Host's Settings → Devices → Pair a phone. Choose All or the Remote Host icon, then a Bot or group row. Right-click the Host icon and choose Remove to remove it. A remote Bot DM with Browser or Computer access shows the corresponding header button. Open its viewer, choose Pause Bot and take control, interact with the screen or send text, then Resume Bot or Close viewer. Groups have no viewer entry. ## Driving it with verify-app diff --git a/changes/4223-activity-environment-headers.md b/changes/4223-activity-environment-headers.md new file mode 100644 index 0000000000..6f3193ddff --- /dev/null +++ b/changes/4223-activity-environment-headers.md @@ -0,0 +1,11 @@ +--- +section: Fixed +--- + +## en + +- Activity uses the shared environment selector in its header and labels each item with its source instead of repeating Host sections. Add remote now lives in the Environment panel header and no longer appears in the Channels creation menu ([#4223](https://github.com/BotHarness/DeepSeekBot/issues/4223)). + +## zh + +- 活动面板在标题栏复用环境选择器,每条活动标明来源,不再重复显示 Host 分区。“添加远程”移至环境面板标题栏,并从频道创建菜单中移除([#4223](https://github.com/BotHarness/DeepSeekBot/issues/4223))。 diff --git a/docs/architecture/botharness-architecture.md b/docs/architecture/botharness-architecture.md index 74f7ae645e..ea37671f26 100644 --- a/docs/architecture/botharness-architecture.md +++ b/docs/architecture/botharness-architecture.md @@ -1389,7 +1389,7 @@ The application-defined browser `RemoteHosts` owner keeps its pairings and selec 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 consumes each Remote Host's shared Inbox through `RemoteHosts.activity`, reusing the existing `ActivityListView` 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. +Activity consumes each Remote Host's shared Inbox through `RemoteHosts.activity` and merges the selected Environments into one `ActivityListView` per category. The shared Environment selector lives in the panel header; every item displays its source icon and name. Each remote item retains its Host-scoped source for identity, pagination, source navigation and commands, including retained detail and retiring rows; that source never receives This Host's `BridgeActions`. Selection, focus, busy and detail identities include the Host as well as the attention and Source Event IDs, so equal IDs from different Hosts remain independent. Pagination advances only sources with their own cursor, and failed or unavailable sources retain their named status alongside available results. `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. The phone owns its persisted four-kind Device Notification Preference and copies it to every paired Host on changes, pairing and retry. Existing Host switches seed it only before a device choice exists. The Host stores the copy independently of its Expo token and reads it only for delivery; Activity facts are unchanged. A browser owns per-Remote-Host choices and consumes the shared Inbox while subscribed, suppressing the initial snapshot and reconnect backlog, deduplicating Host-scoped items and closing notifications on disposal. The browser retains exact seen attention identities per Host and credential for the active owner lifetime, including ordinary reconnects and overlapping subscriber changes. Source Event creation time is not attention arrival order. While the same Host connection and credential remain active, stale or failed Inbox reads preserve an established notification baseline and its seen identities; incomplete responses are not consumed. A connection interruption requires a new complete silent baseline for the reconnect backlog but retains identity history. An owner without a completed baseline stays uninitialized through read failures. There is no timestamp watermark or identity eviction: memory is O(distinct identities seen), not bounded to 2,000 entries. Removing the Host, replacing its credential or releasing the final subscriber clears this history; the next owner establishes a complete silent baseline. Permanent removal also deletes that Host's persisted browser notification choice through the notification owner and cancels pending activation. Reloading or pairing that Host again starts with notifications off and default kinds; temporary disconnect, page disposal and other Hosts' choices are unaffected. This does not delete the phone's global Device Notification Preference. If notification storage refuses deletion, removal still clears the in-memory choice, cancels activation, closes handles and revokes the pairing; a bounded redacted `remote-notification-forget-persistence-failed` diagnostic reports that persistence failed. Reload may still read the old choice in that refusal case. The browser has no closed-page notification path. Notification discovery uses the existing Host Feed client and live invalidation, with `humanAttention({ notifications: true })` paging Host-decided actions, unread group mentions/replies and ordinary DM replies independently of the Activity UI window. The shared Inbox publishes notification items only after every page completes; invalidation during a scan restarts it, and a failed page cannot replace the notification baseline. Browser activation keeps the previous choice until a fresh complete shared-Inbox scan succeeds; this acknowledged commit is the enable boundary, so an in-flight backlog cannot become new alerts. Activation has a ten-second deadline and is cancelled on target change, settings close, permission loss, removal or disposal; these cancellations do not create another feed. `deepseekbot activity --notifications` exposes the same Host query. Phone copy failures retry while foreground with bounded backoff (1–30 seconds), without subscribing to every paired Host feed; backgrounding cancels the timer. Development-client AX invokes the existing phone owner through a precisely targeted loopback Metro inspector (`phone-notifications`); this does not provide release-client CLI parity. diff --git a/packages/client/src/client/activity-approval.tsx b/packages/client/src/client/activity-approval.tsx index ed92bce581..c02f109eaa 100644 --- a/packages/client/src/client/activity-approval.tsx +++ b/packages/client/src/client/activity-approval.tsx @@ -1,4 +1,4 @@ -import { useState, type ReactElement } from 'react'; +import { useState, type ReactElement, type ReactNode } from 'react'; import { Button } from '@deepseek-ai/dsh-client-ui-primitives'; import type { BridgeActions } from './actions.js'; import { PersonaBotAvatar } from './avatar.js'; @@ -15,6 +15,7 @@ export function ActivityApproval({ t, leaving, onFocus, + origin, }: { source: HumanAttentionItem; actions: BridgeActions; @@ -22,6 +23,7 @@ export function ActivityApproval({ t: BotHarnessTranslate; leaving: boolean; onFocus: () => void; + origin?: ReactNode; }): ReactElement { const [message, setMessage] = useState(); const [failed, setFailed] = useState(false); @@ -99,6 +101,7 @@ export function ActivityApproval({ {source.channelId?.startsWith('dm-') ? t('identity.kind.dm') : source.channelName} + {origin}