Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 20 additions & 2 deletions packages/mobile/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,31 @@
"web": {
"favicon": "./assets/favicon.png"
},
"plugins": ["expo-router", "expo-secure-store", "expo-local-authentication"],
"plugins": [
"expo-router",
"expo-secure-store",
"expo-local-authentication",
[
"expo-build-properties",
{
"android": {
"usesCleartextTraffic": true
}
}
]
],
"experiments": {
"typedRoutes": true,
"reactCompiler": true
},
"ios": {
"bundleIdentifier": "ai.opencode.mobile"
"bundleIdentifier": "ai.opencode.mobile",
"infoPlist": {
"NSAppTransportSecurity": {
"NSAllowsArbitraryLoads": true,
"NSAllowsLocalNetworking": true
}
}
}
}
}
32 changes: 11 additions & 21 deletions packages/mobile/app/session/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import {
type Attachment,
} from "../../src/components/chat"
import { AtPopover, type FileItem } from "../../src/components/chat/AtPopover"
import { FileContextPills, type FileContextItem } from "../../src/components/chat/FileContextPills"
import { useSessions } from "../../src/stores/sessions"
import { useEvents, refreshPending } from "../../src/stores/events"
import { useConnections } from "../../src/stores/connections"
Expand Down Expand Up @@ -166,7 +165,6 @@ export default function SessionScreen() {
const [atQuery, setAtQuery] = useState("")
const [atResults, setAtResults] = useState<FileItem[]>([])
const [atLoading, setAtLoading] = useState(false)
const [fileContext, setFileContext] = useState<FileContextItem[]>([])
const atControllerRef = useRef<AbortController | null>(null)

const allCommands = useMemo<SlashCommand[]>(() => {
Expand Down Expand Up @@ -302,27 +300,16 @@ export default function SessionScreen() {
// @ file selection handler
const handleAtSelect = useCallback(
(file: FileItem) => {
// Remove the @query from input
const newInput = input.replace(/@(\S*)$/, "")
// Replace the @query with @filepath + space
const newInput = input.replace(/@(\S*)$/, `@${file.display} `)
setInput(newInput)

// Add to file context if not already there
setFileContext((prev) => {
const exists = prev.some((f) => f.path === file.path)
if (exists) return prev
return [...prev, { path: file.path, display: file.display }]
})

// Close popover
setAtActive(false)
},
[input],
)

const removeFileContext = useCallback((index: number) => {
setFileContext((prev) => prev.filter((_, i) => i !== index))
}, [])

// --- Image picking ---

// Convert any image (including HEIC/HEIF from iOS) to guaranteed JPEG bytes
Expand Down Expand Up @@ -410,16 +397,22 @@ export default function SessionScreen() {

// --- Send ---
const handleSend = async () => {
if (!input.trim() && attachments.length === 0 && fileContext.length === 0) return
if (!input.trim() && attachments.length === 0) return
const authenticated = await authenticateForMessage()
if (!authenticated) return

const text = input.trim()
const files = [...attachments]
const context = [...fileContext]

// Parse @filepath mentions from input text
const atMatches = text.match(/@(\S+)/g) || []
const context = atMatches.map((match) => ({
path: match.slice(1), // Remove @ prefix
display: match.slice(1),
}))

setInput("")
setAttachments([])
setFileContext([])

// Server slash commands (no attachments for commands)
if (text.startsWith("/") && files.length === 0 && context.length === 0) {
Expand Down Expand Up @@ -697,9 +690,6 @@ export default function SessionScreen() {
{/* Attachment preview */}
<ImageAttachments attachments={attachments} isDark={isDark} onRemove={removeAttachment} />

{/* File context pills */}
<FileContextPills files={fileContext} onRemove={removeFileContext} />

{/* Input */}
<View
style={[
Expand Down
1 change: 1 addition & 0 deletions packages/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
},
"devDependencies": {
"@types/react": "~19.1.10",
"expo-build-properties": "1.0.10",
"typescript": "~5.9.2"
},
"expo": {
Expand Down
56 changes: 0 additions & 56 deletions packages/mobile/src/components/chat/FileContextPills.tsx

This file was deleted.

Loading