Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
8373cbe
feat(agent-session): shared durable session record, lease, and fence …
brennanb2025 Aug 7, 2026
a54b938
feat(agent-session): persist session records and the single-writer lease
brennanb2025 Aug 7, 2026
b71ee7e
test(agent-session): pin the single-writer lease contract
brennanb2025 Aug 7, 2026
d4727e1
feat(native-chat): canonical agent-session journal with crash-safe re…
brennanb2025 Aug 7, 2026
a0c9600
fix(native-chat): keep journal blob reads and writes inside the blob …
brennanb2025 Aug 7, 2026
99d853e
refactor(agent-session): encode the NUL key separator as an escape se…
brennanb2025 Aug 7, 2026
6a70390
fix(agent-session): enforce durable cross-process ownership
brennanb2025 Aug 7, 2026
7c49048
fix(agent-session): harden persisted ownership invariants
brennanb2025 Aug 7, 2026
b82f73a
fix(agent-session): fail closed on persisted authority
brennanb2025 Aug 7, 2026
d213829
fix(agent-session): fail closed on recovered identity
brennanb2025 Aug 7, 2026
ce06e50
Merge branch 'brennanb2025/native-chat-1a-session-store' into brennan…
brennanb2025 Aug 9, 2026
a2b20ac
Merge branch 'brennanb2025/native-chat-1c-journal' into brennanb2025/…
brennanb2025 Aug 9, 2026
c69b12b
Enforce the agent-session lease at every PTY write choke point
brennanb2025 Aug 9, 2026
0f97a94
Fence PTY writes across async admission gaps
brennanb2025 Aug 9, 2026
2cda9b8
Merge remote-tracking branch 'origin/brennanb2025/native-chat-1b-leas…
brennanb2025 Aug 9, 2026
a0d8291
Define the structured agent-session wire contract
brennanb2025 Aug 9, 2026
fc36d58
Add the structured agent-session host
brennanb2025 Aug 9, 2026
7924a33
Publish agentSession.* behind the structured capability
brennanb2025 Aug 9, 2026
775fee7
Pair the agent-session wire across versions
brennanb2025 Aug 9, 2026
1a4cea1
Merge remote-tracking branch 'origin/brennanb2025/native-chat-structu…
brennanb2025 Aug 9, 2026
c82bcbb
Reuse the shared lease fixture in the envelope tests
brennanb2025 Aug 9, 2026
3e4fa05
Harden structured agent-session wire recovery
brennanb2025 Aug 9, 2026
2d66ded
Merge remote-tracking branch 'origin/brennanb2025/native-chat-1d-wire…
brennanb2025 Aug 9, 2026
8b86ac3
Open a long-lived codex app-server connection
brennanb2025 Aug 9, 2026
a32e11b
Reply to Codex approval and input requests
brennanb2025 Aug 9, 2026
b6c98f8
Run a Codex session under the agent-session lease
brennanb2025 Aug 9, 2026
4d70b18
Harden the Codex app-server session against partial acquisition
brennanb2025 Aug 9, 2026
4a9004f
Buffer the provider events an adapter streams before its journal exists
brennanb2025 Aug 9, 2026
5b34f31
Coalesce streamed agent text on a short server-side window
brennanb2025 Aug 9, 2026
115ef40
Key a Codex journal row by thread, turn, and ordinal
brennanb2025 Aug 9, 2026
61cb67c
Translate Codex app-server events into journal rows
brennanb2025 Aug 9, 2026
d28861f
Resolve a Codex launch from the durable session record
brennanb2025 Aug 9, 2026
b4ed53f
Install the structured agent-session host on first use
brennanb2025 Aug 9, 2026
76cce58
Drive a structured Codex session end to end over agentSession.*
brennanb2025 Aug 9, 2026
b4bcd20
Add mobile structured session read flow
brennanb2025 Aug 10, 2026
59ad53f
Add mobile structured session write flow
brennanb2025 Aug 10, 2026
bbc6aba
Resolve structured mobile read review blockers
brennanb2025 Aug 10, 2026
8778fde
Harden structured mobile writes before RC
brennanb2025 Aug 10, 2026
19df0ce
Align mobile wire fixtures with create intents
brennanb2025 Aug 10, 2026
ec91718
Satisfy the changed-line React Doctor gate
brennanb2025 Aug 10, 2026
dcd26ef
Close remaining structured mobile RC blockers
brennanb2025 Aug 10, 2026
cbd79a6
Keep mutation context updates out of render
brennanb2025 Aug 10, 2026
73c7f95
Join structured session teardown work
brennanb2025 Aug 10, 2026
8623f12
Fix paired mobile structured session creation
brennanb2025 Aug 10, 2026
5435cf7
Join structured attach teardown through journal bind
brennanb2025 Aug 10, 2026
9202192
fix: restore structured chat parity
brennanb2025 Aug 10, 2026
ac82bc1
fix: keep scoped RPC tests native-free
brennanb2025 Aug 10, 2026
2689a9b
fix: secure mobile structured image delivery
brennanb2025 Aug 10, 2026
4185fd4
fix: close structured session data-loss gaps
brennanb2025 Aug 10, 2026
42df910
fix: consume pre-spawn proof before retry
brennanb2025 Aug 10, 2026
c62f782
Merge remote-tracking branch 'origin/main' into brennanb2025/codex-st…
brennanb2025 Aug 10, 2026
c3f8a98
Merge remote-tracking branch 'origin/main' into brennanb2025/native-c…
brennanb2025 Aug 10, 2026
b94b4b6
Merge remote-tracking branch 'origin/brennanb2025/native-chat-structu…
brennanb2025 Aug 10, 2026
f763791
Merge remote-tracking branch 'origin/brennanb2025/codex-structured' i…
brennanb2025 Aug 10, 2026
1a9a91e
Merge remote-tracking branch 'origin/brennanb2025/codex-structured-jo…
brennanb2025 Aug 10, 2026
02a8b78
Merge remote-tracking branch 'origin/brennanb2025/codex-structured-mo…
brennanb2025 Aug 10, 2026
3a6eb1e
feat(native-chat): add desktop structured sessions
brennanb2025 Aug 10, 2026
c25a329
fix(native-chat): satisfy structured session cleanup gates
brennanb2025 Aug 10, 2026
67a5516
fix(native-chat): keep structured renders pure
brennanb2025 Aug 10, 2026
398d380
Merge remote-tracking branch 'origin/main' into brennanb2025/codex-st…
brennanb2025 Aug 10, 2026
75b3a20
Merge remote-tracking branch 'origin/main' into brennanb2025/codex-st…
brennanb2025 Aug 11, 2026
5acca9f
fix(native-chat): open composer pickers upward
brennanb2025 Aug 11, 2026
7523442
fix(native-chat): use existing view for structured sessions
brennanb2025 Aug 11, 2026
e504fb4
Merge codex structured stack tip into desktop
brennanb2025 Aug 11, 2026
e935e95
Merge remote-tracking branch 'origin/brennanb2025/fix-picker-dropdown…
brennanb2025 Aug 11, 2026
07af7c9
Merge remote-tracking branch 'origin/main' into brennanb2025/codex-st…
brennanb2025 Aug 11, 2026
c243916
fix: harden structured desktop status projection
brennanb2025 Aug 11, 2026
7887382
fix: close structured desktop lifecycle gaps
brennanb2025 Aug 11, 2026
03d5373
fix: fence structured AI Vault resumes
brennanb2025 Aug 11, 2026
0cf5179
fix: preserve structured tabs during activation
brennanb2025 Aug 11, 2026
827e4a1
feat: toggle structured sessions between chat and TUI
brennanb2025 Aug 11, 2026
1ab28b5
fix: harden structured session handoffs
brennanb2025 Aug 11, 2026
6bc0108
fix: bind structured TUI before rollout proof
brennanb2025 Aug 11, 2026
9d8857c
fix: complete structured chat round trips
brennanb2025 Aug 11, 2026
34635ae
fix: align structured TUI return readiness
brennanb2025 Aug 11, 2026
438d256
Merge remote-tracking branch 'origin/main' into brennanb2025/codex-st…
brennanb2025 Aug 11, 2026
c0f6e42
fix(native-chat): make reverse handoff transactional
brennanb2025 Aug 11, 2026
c18e81c
fix(native-chat): clear sticky handoff recovery
brennanb2025 Aug 12, 2026
7316ac3
fix(native-chat): complete mobile reverse after TUI exit
brennanb2025 Aug 12, 2026
ed78cfd
fix(native-chat): keep TUI transcripts readable
brennanb2025 Aug 12, 2026
ff35abf
fix(native-chat): recover TUI transcript gaps
brennanb2025 Aug 12, 2026
eac2520
fix(native-chat): recover claimed TUI owners
brennanb2025 Aug 12, 2026
c8a67dc
fix(native-chat): retain cold TUI proof authority
brennanb2025 Aug 12, 2026
6456b4c
fix(native-chat): recover TUI transcripts read-only
brennanb2025 Aug 12, 2026
7b3144c
Merge remote-tracking branch 'origin/brennanb2025/native-chat-toggle'…
brennanb2025 Aug 12, 2026
1cf45ca
fix(native-chat): route structured Codex options directly
brennanb2025 Aug 12, 2026
5971fcb
fix(native-chat): persist structured session options
brennanb2025 Aug 12, 2026
2c8b009
fix(native-chat): hydrate resumed structured options
brennanb2025 Aug 12, 2026
973dd58
fix(native-chat): preserve options across structured handoffs
brennanb2025 Aug 12, 2026
7f4a1d1
fix(native-chat): replay pending option mutations
brennanb2025 Aug 12, 2026
d82d807
fix(native-chat): rotate settled handoff operations
brennanb2025 Aug 13, 2026
2355a20
fix(native-chat): rotate refused send operations
brennanb2025 Aug 13, 2026
5fc6f7a
test(native-chat): derive refusal retry state from host
brennanb2025 Aug 13, 2026
d53823a
test(native-chat): give the host-oracle matrix test an explicit timeout
brennanb2025 Aug 13, 2026
8b2601b
fix mobile structured first-send hydration race
brennanb2025 Aug 13, 2026
53a3a94
fix(native-chat): preserve handoff launch authority
brennanb2025 Aug 13, 2026
2d3b082
fix(native-chat): harden shared handoff recovery
brennanb2025 Aug 13, 2026
62b26c5
fix(native-chat): serialize structured handoff recovery
brennanb2025 Aug 13, 2026
e2b3600
fix(native-chat): close handoff admission races
brennanb2025 Aug 13, 2026
35fb039
fix(native-chat): validate pinned launch environment
brennanb2025 Aug 13, 2026
a03beee
fix(native-chat): revalidate restored and retried owners
brennanb2025 Aug 13, 2026
c231394
fix(native-chat): gate restart recovery publications
brennanb2025 Aug 13, 2026
6f30927
fix(i18n): catalog structured session recovery control
brennanb2025 Aug 13, 2026
4446a46
fix(native-chat): wait for structured TUI process proof
brennanb2025 Aug 13, 2026
20c2ded
fix(native-chat): queue stale idle TUI handoffs
brennanb2025 Aug 13, 2026
1377932
fix(native-chat): keep structured recovery provider-neutral
brennanb2025 Aug 13, 2026
e444d4b
fix(native-chat): drop local terminal topology from structured sync
brennanb2025 Aug 13, 2026
b8d9062
fix structured outbox and tab restore races
brennanb2025 Aug 13, 2026
114eee2
fix structured provider visibility and request handling
brennanb2025 Aug 13, 2026
ecdd5c8
fix structured session TUI handoff recovery
brennanb2025 Aug 13, 2026
84727e6
fix reverse structured session handoff
brennanb2025 Aug 13, 2026
d00af4d
fix structured session startup chrome
brennanb2025 Aug 13, 2026
ce1f4a9
fix structured session reveal races
brennanb2025 Aug 13, 2026
92c2aae
fix structured completion focus scope
brennanb2025 Aug 13, 2026
52a62b4
fix structured provider error visibility
brennanb2025 Aug 13, 2026
737d37a
fix agent activation adoption and structured shell env
brennanb2025 Aug 13, 2026
57cdaf8
Merge PR 14358: payload-aware notifications and zero-turn TUI guards
brennanb2025 Aug 13, 2026
57cc51e
Merge PR 14362: scoped reverse-reveal focus and bounded vault activation
brennanb2025 Aug 13, 2026
023f0df
fix structured activation composition follow-ups
brennanb2025 Aug 13, 2026
839acf7
fix(runtime): recover daemon TUI across packaged restart
brennanb2025 Aug 13, 2026
a4b2a83
fix(renderer): defer agent activation until restore
brennanb2025 Aug 14, 2026
fd45107
fix(renderer): gate startup agent restore
brennanb2025 Aug 14, 2026
dcbf5a0
fix(runtime): make restart adoption session-exact
brennanb2025 Aug 14, 2026
20b8e3d
fix structured session adoption races
brennanb2025 Aug 14, 2026
af0d2f6
fix structured notification classification
brennanb2025 Aug 14, 2026
b9f30aa
fix(agent-sessions): preserve adopted lifecycle intent
brennanb2025 Aug 14, 2026
ca00509
fix(agent-sessions): restore provider-aware tabs
brennanb2025 Aug 14, 2026
bfdf02e
fix: reconcile packaged terminal restoration
brennanb2025 Aug 14, 2026
7b81915
Merge remote-tracking branch 'origin/main' into brennanb2025/codex-st…
brennanb2025 Aug 14, 2026
affec14
fix: preserve shell-ready Codex resume delivery
brennanb2025 Aug 14, 2026
6b96761
fix: resolve structured chat overnight anomalies
brennanb2025 Aug 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions config/packaged-runtime-node-modules.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const PACKAGED_RUNTIME_PACKAGE_ROOTS = [
'jsonc-parser',
'node-pty',
'posthog-node',
'proper-lockfile',
// serve-sim (for CLI JS entry + closure + state/middleware + to make packaged require('serve-sim') + its internal relatives work; mirrors other runtime JS like ws/yaml/zod. Natives/dylibs still via extraResources + the node_modules/serve-sim copy in resources from builder. Client if added too.
'serve-sim',
'qrcode',
Expand Down
3 changes: 2 additions & 1 deletion config/scripts/electron-builder-config.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ describe('electron-builder config', () => {
}
})

it('includes @parcel/watcher in the packaged runtime closure', () => {
it('includes external main dependencies in the packaged runtime closure', () => {
// Why: the main process imports '@parcel/watcher' for filesystem change
// events; if it is absent from the packaged closure the serve host silently
// stops propagating file changes to clients (regression guard for #4851).
Expand All @@ -407,6 +407,7 @@ describe('electron-builder config', () => {
target.startsWith(join('node_modules', '@parcel', 'watcher-'))
)
).toBe(true)
expect(packagedTargets).toContain(join('node_modules', 'proper-lockfile'))
})

it('prunes non-target @parcel/watcher architecture subpackages', async () => {
Expand Down
27 changes: 23 additions & 4 deletions docs/reference/remote-wire-compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,26 @@ negotiated capabilities differ from the contract. Adding an optional field keeps
green (Rule 1); making a client depend on that field turns the new-client/old-host
pairing red.

The harness covers the terminal stream only. It does **not** cover the session-tab
sync channel, agent-session publications, file or Git RPCs, mobile/E2EE framing, or
the relay transport. A change on those paths still needs its own reasoning against
the three rules above.
`tests/e2e/cross-version-wire/cross-version-agent-session-wire.unit.test.ts` pairs the
same two builds over the structured `agentSession.*` surface. Because a released build
cannot name a capability string its own source never contains, the old side's advertised
list and registered method names are read from the extracted checkout rather than
hand-written. It covers the three skews that surface can fail on:

- an old client — advertising only what the baseline build defines — is told the whole
surface does not exist and reaches no host method;
- a new client against the old dispatcher gets `method_not_found` on every method, and
can see the absence during negotiation instead of by calling;
- a cursor survives a host restart: the client's fence is refused as stale with the live
one attached, and resuming from the held cursor replays only what it missed.

Run it with:

```bash
pnpm exec vitest run --config config/vitest.config.ts tests/e2e/cross-version-wire/cross-version-agent-session-wire.unit.test.ts
```

The harness covers the terminal stream and the structured agent-session surface. It does
**not** cover the session-tab sync channel, legacy agent-session publications, file or Git
RPCs, mobile/E2EE framing, or the relay transport. A change on those paths still needs its
own reasoning against the three rules above.
154 changes: 135 additions & 19 deletions mobile/app/h/[hostId]/session/[worktreeId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ import { dismissTerminalKeyboard } from '../../../../src/terminal/terminal-keybo
import type { TerminalLiveInputSender } from '../../../../src/terminal/terminal-live-input-sender'
import { isTerminalSendRpcAccepted } from '../../../../src/terminal/terminal-send-rpc-response'
import { sendMobileTerminalQueryReply } from '../../../../src/terminal/mobile-terminal-query-reply'
import { TERMINAL_QUERY_REPLY_INPUT_RUNTIME_CAPABILITY } from '../../../../../src/shared/protocol-version'
import {
STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY,
TERMINAL_QUERY_REPLY_INPUT_RUNTIME_CAPABILITY
} from '../../../../../src/shared/protocol-version'
import { useTerminalLiveInputCommit } from '../../../../src/terminal/use-terminal-live-input-commit'
import { resolveMobileTerminalInputGate } from '../../../../src/terminal/terminal-input-connection-gate'
import {
Expand Down Expand Up @@ -224,6 +227,11 @@ import {
} from '../../../../src/dictation/mobile-dictation-setup'
import { TerminalPaneView } from '../../../../src/session/TerminalPaneView'
import { MobileNativeChatOverlay } from '../../../../src/session/MobileNativeChatOverlay'
import { MobileStructuredAgentSessionView } from '../../../../src/session/MobileStructuredAgentSessionView'
import { MobileStructuredSessionCreateError } from '../../../../src/session/MobileStructuredSessionCreateError'
import * as mobileStructuredTuiSend from '../../../../src/session/mobile-structured-tui-send'
import { useMobileStructuredSessionEntry } from '../../../../src/session/use-mobile-structured-session-entry'
import { showMobileStructuredChatChoice } from '../../../../src/session/mobile-structured-session-create'
import { MobileBrowserTabActionSheet } from '../../../../src/session/MobileBrowserTabActionSheet'
import { useMobileNativeChatController } from '../../../../src/session/use-mobile-native-chat-controller'
import { useMobileNativeChatReadability } from '../../../../src/session/use-mobile-native-chat-readability'
Expand Down Expand Up @@ -999,6 +1007,7 @@ export default function SessionScreen() {
null
)
const [quickCommandsSupported, setQuickCommandsSupported] = useState<boolean | null>(null)
const [structuredAgentSessionSupported, setStructuredAgentSessionSupported] = useState(false)
// Why: stable callbacks (handleFileTap) read the live value via this ref, since
// the capability probe resolves after the callbacks are created.
const browserScreencastSupportedRef = useRef(browserScreencastSupported)
Expand Down Expand Up @@ -2309,6 +2318,44 @@ export default function SessionScreen() {
getApplicationRevision: getSessionTabsApplicationRevision,
...sessionTabsFetchReporting
})
const getActiveWorktreeConnectionId = useCallback(async (): Promise<string | null> => {
// Why: the floating workspace always runs on the paired host itself, never an SSH repo target.
if (!client || isFloatingWorkspaceRoute) {
return null
}
const repoId = getRepoIdFromMobileWorktreeId(worktreeId)
const repoResponse = await client.sendRequest('repo.list')
if (!repoResponse.ok) {
throw new Error((repoResponse as RpcFailure).error.message)
}
const repos =
((repoResponse as RpcSuccess).result as { repos?: RuntimeRepoSummary[] }).repos ?? []
return repos.find((repo) => repo.id === repoId)?.connectionId?.trim() || null
}, [client, isFloatingWorkspaceRoute, worktreeId])
const structuredSessionEntry = useMobileStructuredSessionEntry({
client,
connected: connState === 'connected',
drawerOpen: showCreateTabDrawer,
hostSupported: structuredAgentSessionSupported,
worktreeId,
sessionId: activeSessionTab?.type === 'agent-session' ? activeSessionTab.sessionId : null,
creationGuardRef: creatingTerminalRef,
setCreating,
setCreateError,
closeDrawer: () => setShowCreateTabDrawer(false),
onCreated: (tabId) => {
pendingActiveSessionTabIdRef.current = tabId
activeSessionTabTypeRef.current = 'agent-session'
setActiveSessionTabId(tabId)
scheduleDelayedAction(() => void fetchSessionTabs(), 100)
scheduleDelayedAction(() => void fetchSessionTabs(), 600)
},
onError: (message) => {
triggerError()
showToast(message, 1800)
},
getConnectionId: getActiveWorktreeConnectionId
})

useEffect(() => {
if (connState === 'connected') {
Expand All @@ -2330,6 +2377,7 @@ export default function SessionScreen() {
setBrowserScreencastSupported(null)
setAgentSessionHistorySupported(null)
setQuickCommandsSupported(null)
setStructuredAgentSessionSupported(false)
setShowQuickCommands(false)
hostQueryReplyInputSupportedRef.current = false
return
Expand All @@ -2339,6 +2387,7 @@ export default function SessionScreen() {
setBrowserScreencastSupported(null)
setAgentSessionHistorySupported(null)
setQuickCommandsSupported(null)
setStructuredAgentSessionSupported(false)
setShowQuickCommands(false)
hostQueryReplyInputSupportedRef.current = false
// Why: the probe retries — a relay→direct cutover or request timeout rejects
Expand All @@ -2347,6 +2396,9 @@ export default function SessionScreen() {
setBrowserScreencastSupported(capabilities.includes('browser.screencast.v1'))
setAgentSessionHistorySupported(capabilities.includes(MOBILE_AI_VAULT_CAPABILITY))
setQuickCommandsSupported(supportsMobileQuickCommands(capabilities))
setStructuredAgentSessionSupported(
capabilities.includes(STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY)
)
// Why: hosts without this capability strip inputKind from terminal.send,
// so a forwarded xterm reply would become floor-stealing shell input.
hostQueryReplyInputSupportedRef.current = capabilities.includes(
Expand Down Expand Up @@ -2837,6 +2889,9 @@ export default function SessionScreen() {
intent: 'user'
}).catch(() => {})
}
if (tab.type === 'agent-session') {
return
}
if (tab.type === 'browser') {
return
}
Expand Down Expand Up @@ -3036,7 +3091,7 @@ export default function SessionScreen() {
setMarkdownActionTarget(tab)
} else if (tab.type === 'file') {
setFileActionTarget(tab)
} else {
} else if (tab.type === 'browser') {
setBrowserActionTarget(tab)
}
}, [])
Expand Down Expand Up @@ -3506,21 +3561,6 @@ export default function SessionScreen() {
}
}, [])

const getActiveWorktreeConnectionId = useCallback(async (): Promise<string | null> => {
// Why: the floating workspace always runs on the paired host itself, never an SSH repo target.
if (!client || isFloatingWorkspaceRoute) {
return null
}
const repoId = getRepoIdFromMobileWorktreeId(worktreeId)
const repoResponse = await client.sendRequest('repo.list')
if (!repoResponse.ok) {
throw new Error((repoResponse as RpcFailure).error.message)
}
const repos =
((repoResponse as RpcSuccess).result as { repos?: RuntimeRepoSummary[] }).repos ?? []
return repos.find((repo) => repo.id === repoId)?.connectionId?.trim() || null
}, [client, isFloatingWorkspaceRoute, worktreeId])

const refreshCanPaste = useCallback(() => {
void Promise.all([
Clipboard.hasStringAsync().catch(() => false),
Expand Down Expand Up @@ -4066,6 +4106,13 @@ export default function SessionScreen() {
const activeMarkdownTab = activeSessionTab?.type === 'markdown' ? activeSessionTab : null
const activeFileTab = activeSessionTab?.type === 'file' ? activeSessionTab : null
const activeBrowserTab = activeSessionTab?.type === 'browser' ? activeSessionTab : null
const activeStructuredTab = activeSessionTab?.type === 'agent-session' ? activeSessionTab : null
const showTerminalCommandDock =
!activeMarkdownTab &&
!activeFileTab &&
!activeBrowserTab &&
!activeStructuredTab &&
!showNativeChat
const activePendingTerminalTab =
activeSessionTab?.type === 'terminal' && typeof activeSessionTab.terminal !== 'string'
? activeSessionTab
Expand Down Expand Up @@ -4216,6 +4263,20 @@ export default function SessionScreen() {
}
]
: []
const structuredChatAction = showMobileStructuredChatChoice({
hostCapability: structuredAgentSessionSupported,
workspaceSupport: structuredSessionEntry.createSupported,
agent: createTabAgentOptions.some((option) => option.agent === 'codex') ? 'codex' : ''
})
? [
{
label: 'Chat session',
hint: 'Codex · structured chat',
icon: MessageSquare,
onPress: structuredSessionEntry.create
}
]
: []
const sendDiffNotesAgentActions =
pendingDiffNotesDelivery === null
? []
Expand Down Expand Up @@ -4420,6 +4481,9 @@ export default function SessionScreen() {
{t.type === 'file' && (
<File size={13} color={colors.textSecondary} strokeWidth={2.1} />
)}
{t.type === 'agent-session' && (
<MobileAgentIcon agentId={t.agent} size={13} />
)}
{t.type === 'terminal' &&
(() => {
const agentId = resolveMobileTerminalTabAgentId(t)
Expand Down Expand Up @@ -4497,14 +4561,18 @@ export default function SessionScreen() {
</View>
) : null}

<MobileStructuredSessionCreateError
message={createError}
onDismiss={() => setCreateError('')}
/>

{showLoadingState ? (
<View style={styles.emptyState}>
<ActivityIndicator size="small" color={colors.textSecondary} />
</View>
) : showEmptyState ? (
<View style={styles.emptyState}>
<Text style={styles.emptyText}>No tabs in this session</Text>
{createError ? <Text style={styles.createError}>{createError}</Text> : null}
<View style={styles.emptyActions}>
<Pressable
style={[
Expand Down Expand Up @@ -4586,6 +4654,53 @@ export default function SessionScreen() {
</Animated.View>
)}
</View>
) : activeStructuredTab ? (
<MobileStructuredAgentSessionView
key={activeStructuredTab.sessionId}
items={structuredSessionEntry.session.items}
status={structuredSessionEntry.session.status}
error={structuredSessionEntry.session.error}
hasOlder={structuredSessionEntry.session.hasOlder}
loadingOlder={structuredSessionEntry.session.loadingOlder}
onLoadOlder={structuredSessionEntry.session.loadOlder}
onOpenFile={handleNativeChatFileTap}
outbox={structuredSessionEntry.writes.outbox}
writeError={structuredSessionEntry.writes.error}
onSend={async (text, restored) => {
const accepted = await structuredSessionEntry.writes.send(text, [
...restored,
...structuredSessionEntry.attachments.attachments
])
if (accepted) {
structuredSessionEntry.attachments.clear()
}
return accepted
}}
onTuiSend={(text, restored) =>
mobileStructuredTuiSend.sendMobileStructuredTuiComposerMessage({
client,
connected: connState === 'connected',
agent: activeStructuredTab.agent,
handoff: structuredSessionEntry.session.handoff,
deviceToken: deviceTokenRef.current,
text,
attachments: [...restored, ...structuredSessionEntry.attachments.attachments],
onAccepted: structuredSessionEntry.attachments.clear,
onToast: showToast
})
}
onTakeQueuedForEdit={structuredSessionEntry.writes.takeQueuedForEdit}
onRetry={structuredSessionEntry.writes.retry}
onRespondToPrompt={structuredSessionEntry.writes.respondToPrompt}
sessionOptions={structuredSessionEntry.sessionOptions}
attachments={structuredSessionEntry.attachments.attachments}
isAttaching={structuredSessionEntry.attachments.attaching}
onAttachImage={() => void structuredSessionEntry.attachments.attach('library')}
onRemoveAttachment={structuredSessionEntry.attachments.remove}
onCancel={structuredSessionEntry.writes.cancel}
handoff={structuredSessionEntry.session.handoff}
onRequestHandoff={structuredSessionEntry.writes.requestHandoff}
/>
) : activePendingTerminalTab ? (
<View style={styles.emptyState}>
<ActivityIndicator size="small" color={colors.textSecondary} />
Expand Down Expand Up @@ -4656,7 +4771,7 @@ export default function SessionScreen() {
)}

{/* Why: translate instead of resize so keyboard toggles don't trigger a server-side PTY viewport change. */}
{!activeMarkdownTab && !activeFileTab && !activeBrowserTab && !showNativeChat && (
{showTerminalCommandDock && (
<View
style={[
styles.commandDock,
Expand Down Expand Up @@ -5018,6 +5133,7 @@ export default function SessionScreen() {
title="New Tab"
actions={[
...createTabAgentActions,
...structuredChatAction,
{
label: 'Terminal',
icon: SquareTerminal,
Expand Down
16 changes: 10 additions & 6 deletions mobile/src/agent-history/MobileAgentSessionHistoryPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { RpcSuccess } from '../transport/types'
import type { RpcClient } from '../transport/rpc-client'
import { getWorktreeLabel } from '../session/worktree-label'
import {
activateStructuredAiVaultSession,
buildMobileAiVaultResumeLaunch,
createMobileAiVaultResumeMutationRegistry,
readMobileRuntimeHostPlatform,
Expand Down Expand Up @@ -154,16 +155,19 @@ export function MobileAgentSessionHistoryPanel({
triggerError()
return
}
if (!session.sessionId) {
setResumeMessage('This session is missing a resume id.')
triggerError()
return
}

resumeLaunchInFlightRef.current = true
setResumingSessionId(session.id)
setResumeMessage(null)
try {
const structuredWorkspaceId = await activateStructuredAiVaultSession(client, session)
if (structuredWorkspaceId) {
router.push(
`/h/${encodeURIComponent(hostId)}/session/${encodeURIComponent(structuredWorkspaceId)}` as Parameters<
typeof router.push
>[0]
)
return
}
const {
repos,
folderWorkspaces,
Expand Down
Loading
Loading