🤖 feat: mobile task tools + live bash output #1307
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds mobile parity for task tools and bash live output.
bash-outputevents into bash tool cards via transient buffer (avoids timeline spam; keeps tail when final output is missing).durationMs; fix session timing interval typing.xhigh).tests:
đź“‹ Implementation Plan
React Native app catch-up (mobile/) — post-rebase fixes + task + live bash output parity
Status (as of 2025-12-23)
âś… Completed in this worktree:
make typecheck-react-native).workspace.getInfo().aiSettingsxhighthinking levelworkspace.updateAISettingsmake typecheck+make static-checkpassing.Goals
make typecheck-react-nativeto passing on latestorigin/main.task,task_await,task_list,task_terminate,agent_report)./workspace/<taskId>.<taskId>.bash-outputinto the bash tool card, without timeline spam).Parity audit (desktop/web vs mobile): additional gaps to consider
A) Chat input / composer UX
VoiceInputButton; mobile has none). Est: M (~+300–600 LoC)src/browser/components/ChatInput/VoiceInputButton.tsxsrc/browser/components/ImageAttachments.tsxsrc/browser/components/Messages/QueuedMessage.tsxsrc/browser/components/ModelSelector.tsx,src/browser/components/ThinkingSlider.tsxsrc/browser/components/CommandSuggestions.tsxB) Streaming + usage + compaction
src/browser/components/Messages/ChatBarrier/StreamingBarrier.tsxmobile/src/screens/WorkspaceScreen.tsx(token/tps tracking)usage-delta+session-usage-delta; mobile ignores these events). Est: M/L (~+300–900 LoC)src/browser/stores/WorkspaceStore.tsmobile/src/messages/normalizeChatEvent.tsidle-compaction-needed; mobile ignores). Est: M (~+150–300 LoC)C) Workspace header / metadata
src/browser/components/RuntimeBadge.tsxsrc/browser/components/GitStatusIndicator.tsx,src/browser/components/BranchSelector.tsxsrc/browser/components/WorkspaceMCPModal.tsxD) Projects/workspace management
src/browser/components/ArchivedWorkspaces.tsxmobile/src/screens/ProjectsScreen.tsxsrc/browser/utils/ui/workspaceFiltering.ts(depth map)src/browser/components/ProjectSidebar.tsxsrc/browser/components/ArchivedWorkspaces.tsxE) Settings / configuration
src/browser/components/Settings/sections/ProvidersSection.tsxsrc/browser/components/Settings/sections/ModelsSection.tsxsrc/browser/components/Settings/sections/ExperimentsSection.tsxF) Tool card rendering
code_execution(desktop has dedicated UI; mobile falls back to generic). Est: S/M (~+100–250 LoC)src/browser/components/tools/CodeExecutionToolCall.tsxmobile/src/messages/tools/toolRenderers.tsxSuggested follow-up scopes (pick one)
code_executiontool card parity (net ~+150–300 LoC)Completed implementation (reference): green typecheck + task open-workspace + live bash output (net ~+450–600 LoC product code)
1) Fix the 3 TypeScript errors
1.1
workspace-initnow requiresdurationMsUpdate the shared init-state plumbing so mobile can populate the new field.
src/browser/utils/messages/ChatEventProcessor.tsInitStatewithdurationMs: number | null.init-start) instead of overwriting it oninit-end.durationMs = endTimestamp - startTimestamponinit-end.mobile/src/messages/normalizeChatEvent.tsemitInitMessage(), includedurationMs: initState.durationMs.1.2 Fix
sessionTimingServicetimer typingsrc/node/services/sessionTimingService.tsMap<string, NodeJS.Timeout>Map<string, ReturnType<typeof setInterval>>1.3 Add the new
bash-outputstream event to mobile’s exhaustive handler mapEven though we’ll handle
bash-outputas transient state (see §3), mobile still needs a handler for schema exhaustiveness.mobile/src/messages/normalizeChatEvent.ts"bash-output": () => []2) Task tool UI parity + “Open workspace” (mobile + desktop)
Key fact:
taskId==workspaceId(verified viasrc/node/services/taskService.ts).Desktop reference:
src/browser/components/Messages/ToolMessage.tsxsrc/browser/components/tools/TaskToolCall.tsx2.1 Mobile: render task tool cards + open workspace
mobile/src/messages/tools/toolRenderers.tsxrenderSpecializedToolCardcases for:tasktask_awaittask_listtask_terminateagent_reportisXToolArgs(...)type guardscoerceXToolResult(...)coercersbuildXViewModel(...)returningToolCardViewModelUI requirements:
taskrouter.push(/workspace/${taskId}).task_awaittaskId.task_listtask_terminateDefensive UX
taskIdis missing or malformed, hide the button.2.2 Desktop/Web: add “Open workspace” affordance in task tool UI
src/browser/components/tools/TaskToolCall.tsxTaskIdrendering (or call-sites) to add an Open workspace link/button.useWorkspaceContext():workspaceMetadatabytaskIdsetSelectedWorkspace(...)to select/navigate.Design constraints:
workspaceMetadata.get(taskId)exists.3) Live bash output parity on mobile (stream event
bash-output)Desktop already supports this via:
src/browser/stores/WorkspaceStore.tstransient stateliveBashOutputsrc/browser/components/tools/BashToolCall.tsx+useBashToolLiveOutput(...)src/browser/utils/messages/liveBashOutputBuffer.ts(appendLiveBashOutputChunk)src/common/constants/toolLimits.ts(BASH_TRUNCATE_MAX_TOTAL_BYTES)3.1 Intercept
bash-outputevents outside the timelinemobile/src/screens/WorkspaceScreen.tsxhandlePayload, detectpayload.type === "bash-output":toolCallIdtimelinestate for high-frequency chunks.Also clear output when the bash tool finishes:
tool-call-endfor thebashtool (or when we observe a completed tool message with a final output).3.2 Implement a transient store + hook for mobile bash output
BashOutputContext(or extendWorkspaceChatContext) that provides:appendChunk({ toolCallId, text, isError })getLiveOutput(toolCallId)→{ combined, stdout, stderr, truncated } | undefinedclear(toolCallId)Reuse existing, platform-agnostic helpers:
appendLiveBashOutputChunk+toLiveBashOutputViewfromsrc/browser/utils/messages/liveBashOutputBuffer.tsBASH_TRUNCATE_MAX_TOTAL_BYTESfromsrc/common/constants/toolLimits.tsRN compatibility note (TextEncoder)
liveBashOutputBuffer.tsusesTextEncoderto measure UTF-8 bytes. If Hermes lacksTextEncoderin our RN runtime, add a small fallback (best-effort) or a polyfill. Prefer a defensive runtime check with a clear error message in dev builds.3.3 Render live output in the existing mobile bash tool card
mobile/src/messages/tools/toolRenderers.tsxstatus === "executing":liveOutput.combinedin a scrollable code blockliveOutput.truncated === trueresult.output(existing behavior).4) Validation
make typecheck-react-nativemake typecheckOptional low-effort tests (only if they’re easy/pure):
src/browser/utils/messages/ChatEventProcessor.test.ts: durationMs calculation.src/browser/utils/messages/liveBashOutputBuffer.test.ts: truncation + interleaving logic.Generated with
mux• Model:openai:gpt-5.2• Thinking:xhigh