Repository navigation
Add DSH Agent to the Android plus menu - #1924
Conversation
The browser's new-chat menu offers Add DSH Agent while the team has none; the phone app had no DSH Agent support. The host gains agent-chat, which pages the DSH Agent's newest plain DSH Session, and the mobile API lists the agents capability. The app adds the menu entry, a DSH Agent row in the team list and a chat that loads through agent-chat and sends to its Session. Fixes #1415
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8c19485d0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| async function agentPage(agentId, cursor, steps = false) { | ||
| const sessionId = rt.agentSessionOf(agentId) | ||
| if (sessionId === undefined) throw Object.assign(new Error('Unknown DSH Agent'), { code: 'bot/not-found' }) | ||
| return { sessionId, ...(await partPage([{ sessionId }], 0, cursor, steps)) } |
There was a problem hiding this comment.
Allow Agent sessions in the attachment-reading endpoints
When a DSH Agent conversation contains images or downloadable files, this endpoint exposes them through the existing chat items, but the corresponding host readers still reject Agent sessions. In ds-bot/src/host/mobile.js, image, fileDownload, and markdownImage require a Bot or room owner and return bot/not-found for these plain DSH sessions. Consequently, photos sent using the newly enabled Agent composer cannot be loaded back, and Agent-generated files cannot be saved. Extend those readers' ownership checks and session selection to support registered Agent sessions.
Useful? React with 👍 / 👎.
| {fileError ? <Text style={[type.small, { color: p.danger, textAlign: 'center', marginBottom: 4 }]} accessibilityRole="alert">{fileError}</Text> : null} | ||
| {page !== null && loadError !== null ? <Text style={[type.small, { color: p.danger, textAlign: 'center', marginBottom: 4, marginHorizontal: 16 }]} accessibilityRole="alert">{loadError}</Text> : null} | ||
| <Composer name={bot?.name ?? room?.name ?? ''} running={running} canStop={canStop} canAttach={hello?.capabilities?.includes('send-images') === true} onSend={send} onStop={stop} p={p} /> | ||
| <Composer name={bot?.name ?? room?.name ?? agent?.name ?? ''} running={running} canStop={canStop} canAttach={hello?.capabilities?.includes('send-images') === true} onSend={send} onStop={stop} p={p} /> |
There was a problem hiding this comment.
Wire running state and cancellation for Agent chats
While a DSH Agent is executing a prompt, this composer always receives running=false and canStop=false: doing is populated only for Bots, and roomWork is empty for an Agent. Moreover, the existing stop callback handles only Bots and rooms. Users can now start potentially long-running Agent work from Android but cannot interrupt it there. Add Agent session status and a cancellation path before reusing the composer for this chat kind.
Useful? React with 👍 / 👎.
The phone's media endpoints only knew Bot and group Sessions, so an image or a presented file in a DSH Agent chat was refused as an unknown session.
agent-chat answered an Agent with every Session archived as unknown, so the phone left the chat; it now returns an empty page and the phone opens a new Session on the first message. A new newest Session no longer keeps the older pages of the previous one.
A paired browser may not open DSH Agent chats, but the media endpoints it may call now resolve Agent Sessions, so it could read Agent workspace images and files. Refuse those endpoints for Agent Sessions unless the caller is a phone.
Two sends to an Agent with no Session each created one, and the phone shows only the newest, hiding the other message and its reply.
The demo provider left hello unset, so menu entries gated on a capability, such as Add DSH Agent, never showed in demo mode.
The browser shows a DSH Agent Session running and stops it from its own view; the phone had neither. state.work.agents names each Agent with a running turn, and stop-agent cancels it. Also test Agent media on the phone.
The composer shows Stop while state.work.agents has the Agent, and Stop calls stop-agent; the demo runs an Agent after a send until stopped.
So an emulator check of a demo build can open an Agent chat photo and save its file.
session/event dropped every event of a plain DSH Session, so state.work.agents never named a running Agent and stop-agent found no turn to cancel. Track only turn/start and turn/end for Agent Sessions.
The phone only learned an Agent was running at its next 15-second state poll, so short replies never showed Stop. Bot Sessions already nudge the feed on agent/status; do the same for DSH Agent Sessions.
# Conflicts: # mobile/src/screens/Chat.tsx
|
Review: approved Independent first-principles review passed:
|
Issue
Fixes #1415
What changed / 改了什么
The browser's new-chat menu offers Add DSH Agent while the team has no DSH Agent. The Android app had no DSH Agent support at all.
agent-chatendpoint. It pages the DSH Agent's newest plain DSH Session throughpartPage; an Agent whose Sessions are all archived gets an empty page. Also addsagentByIdon the runtime and theagentscapability in the mobile API list.image,file-downloadandmarkdown-imageaccept DSH Agent Sessions, and the link refuses them to paired browsers, which cannot open Agent chats.session/eventnow recordsturn/start/turn/endfor Agent Sessions (it used to drop every plain-Session event),state.work.agentsnames each Agent with a running turn, and new phone-onlystop-agentcancels it. An Agent Session'sagent/statusnudges the live feed, as a Bot's does, so the phone shows Stop at once.添加 DSH Agent) only when the host listsagentsandteam.agentsis empty, the same rule asnew-chat.js. It callsadd-agentand opens the new Agent's chat, and the team list shows a DSH Agent row. The chat loads viaagent-chatand drops older pages when the newest Session changes. It sends with the existingsend; an Agent without a Session gets one viaagent-session, shared by quick sends. The composer shows Stop while the Agent runs, and Stop callsstop-agent.TeamState.agents,work.agentsandChatTargetkindagent. Demo mode supportsadd-agent,agent-chatandstop-agent, and exposes itshellocapabilities. After a send, the demo Agent runs until stopped, then replies with a photo and a file.@deepseek-ai/dsh-client-ui-primitives, listed inNOTICE(hard rule 3).Changelog
The Android app's "+" menu can add the DSH Agent and open its chat, like the browser, including Stop while it runs.
How I checked it / 怎么验证的
npm test(inds-bot/): 3510 pass, with new tests foragent-chat(including all Sessions archived), Agent media on the phone, browser refusal of Agent media, and an Agent turn instate.work.agents/stop-agent, and the live-feed nudge for an Agent Sessionnode scripts/build-client.mjs --checknpm run lintindex.jsorsrc/host/: not run, because the test machine has nodeepseek-harnesscheckoutf4ea092c. Later commits change only the host.mobile/:npm run typecheckandnpm testpass (109 tests, including a newactiveChatTargetagent case).Checklist / 检查
src/client/changed →npm run buildran andclient.jsis committed. / 改了src/client/就已重新 build 并提交client.js。 (not changed)Co-authored-by. / 没有把 AI 工具写成作者或Co-authored-by。Implemented in session Add DSH Agent to Android plus menu
Review with Devin · Open in Devin Desktop