mirror of
https://github.com/stablyai/orca.git
synced 2026-09-28 16:02:45 +00:00
fix mobile project payload and account fixtures
Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
This commit is contained in:
@@ -54,19 +54,6 @@ vi.mock('expo-router', async () => {
|
||||
|
||||
vi.mock('expo-crypto', () => ({ randomUUID: dependencies.randomUUID }))
|
||||
|
||||
// The account adapter reaches device operations for its idempotency nonce, which pulls the
|
||||
// native expo modules into this module graph.
|
||||
vi.mock('expo-clipboard', () => ({ setStringAsync: vi.fn() }))
|
||||
vi.mock('expo-haptics', () => ({
|
||||
AndroidHaptics: {},
|
||||
ImpactFeedbackStyle: {},
|
||||
NotificationFeedbackType: {},
|
||||
impactAsync: vi.fn(),
|
||||
notificationAsync: vi.fn(),
|
||||
performAndroidHapticsAsync: vi.fn(),
|
||||
selectionAsync: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('lucide-react-native', () => ({
|
||||
Check: 'Check',
|
||||
ChevronLeft: 'ChevronLeft',
|
||||
|
||||
@@ -27,6 +27,7 @@ export function nativeHostSessionNativeChatOperations(
|
||||
// `@` autocomplete in a second workspace suggest the first workspace's files.
|
||||
const legacyPathsByWorkspace = new Map<string, string[]>()
|
||||
const legacyLoadByWorkspace = new Map<string, Promise<string[] | null>>()
|
||||
const legacyGenerationByWorkspace = new Map<string, number>()
|
||||
return {
|
||||
async readability(workspaceId) {
|
||||
if (isFloatingWorkspaceWorktreeId(workspaceId)) {
|
||||
@@ -72,7 +73,10 @@ export function nativeHostSessionNativeChatOperations(
|
||||
resetFileSearchCache(workspaceId) {
|
||||
searchSupported = null
|
||||
legacyPathsByWorkspace.delete(workspaceId)
|
||||
legacyLoadByWorkspace.delete(workspaceId)
|
||||
legacyGenerationByWorkspace.set(
|
||||
workspaceId,
|
||||
(legacyGenerationByWorkspace.get(workspaceId) ?? 0) + 1
|
||||
)
|
||||
},
|
||||
async searchFiles(target, query) {
|
||||
if (searchSupported !== false) {
|
||||
@@ -98,22 +102,31 @@ export function nativeHostSessionNativeChatOperations(
|
||||
if (!legacyLoad) {
|
||||
// Older hosts expose only the full inventory RPC; overlapping queries must
|
||||
// share one slow local/SSH read.
|
||||
legacyLoad = client
|
||||
const generation = legacyGenerationByWorkspace.get(target.workspaceId) ?? 0
|
||||
const request = client
|
||||
.sendRequest('files.list', {
|
||||
worktree: `id:${target.workspaceId}`
|
||||
})
|
||||
.then((response) => (response.ok ? extractPaths(response.result) : null))
|
||||
.finally(() => {
|
||||
legacyLoad = request.finally(() => {
|
||||
if (legacyLoadByWorkspace.get(target.workspaceId) === legacyLoad) {
|
||||
legacyLoadByWorkspace.delete(target.workspaceId)
|
||||
})
|
||||
}
|
||||
})
|
||||
legacyLoadByWorkspace.set(target.workspaceId, legacyLoad)
|
||||
const paths = await legacyLoad
|
||||
if ((legacyGenerationByWorkspace.get(target.workspaceId) ?? 0) !== generation) {
|
||||
return null
|
||||
}
|
||||
if (!paths) return null
|
||||
legacyPaths = paths
|
||||
legacyPathsByWorkspace.set(target.workspaceId, paths)
|
||||
} else {
|
||||
const paths = await legacyLoad
|
||||
if (!paths) return null
|
||||
legacyPaths = paths
|
||||
legacyPathsByWorkspace.set(target.workspaceId, paths)
|
||||
}
|
||||
const paths = await legacyLoad
|
||||
if (!paths) {
|
||||
return null
|
||||
}
|
||||
legacyPaths = paths
|
||||
legacyPathsByWorkspace.set(target.workspaceId, paths)
|
||||
}
|
||||
return rankSuggestions(legacyPaths, query, FILE_RESULT_LIMIT)
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ export type HostTaskProjectResolveResult = {
|
||||
export type HostTaskProjectTablePayload = GitHubProjectRef & {
|
||||
viewId: string
|
||||
queryOverride?: string
|
||||
cursor?: string
|
||||
}
|
||||
|
||||
export type HostTaskProjectSlugPayload = {
|
||||
|
||||
@@ -17,7 +17,7 @@ export type HostTaskProjectReadOperations = {
|
||||
listAccessible(host: string): Promise<HostTaskProjectListResult>
|
||||
listViews(project: GitHubProjectRef): Promise<GitHubProjectViewSummary[]>
|
||||
resolveRef(payload: HostTaskProjectResolvePayload): Promise<HostTaskProjectResolveResult>
|
||||
loadTable(payload: Omit<HostTaskProjectTablePayload, 'cursor'>): Promise<GitHubProjectTable>
|
||||
loadTable(payload: HostTaskProjectTablePayload): Promise<GitHubProjectTable>
|
||||
loadItemDetail(payload: HostTaskProjectItemDetailPayload): Promise<HostTaskGitHubDetail>
|
||||
listItemLabels(payload: HostTaskProjectSlugPayload): Promise<string[]>
|
||||
listItemAssignableUsers(
|
||||
|
||||
@@ -21,20 +21,7 @@ import type { GitRemoteIdentity } from '../../../src/shared/git-remote-identity'
|
||||
import type { RepoIcon } from '../../../src/shared/repo-icon'
|
||||
import type { RetiredNameRegistry } from '../../../src/shared/worktree/retired-name-registry'
|
||||
|
||||
export type NewWorkspaceRepository = {
|
||||
id: string
|
||||
displayName: string
|
||||
path: string
|
||||
badgeColor?: string
|
||||
connectionId?: string | null
|
||||
executionHostId?: ExecutionHostId | null
|
||||
executionHostLabel?: string
|
||||
projectId?: string
|
||||
kind?: 'git' | 'folder'
|
||||
upstream?: { owner: string; repo: string; host?: string } | null
|
||||
repoIcon?: RepoIcon | null
|
||||
gitRemoteIdentity?: GitRemoteIdentity | null
|
||||
}
|
||||
export type { MobileWorkspaceRepo as NewWorkspaceRepository } from '../components/new-worktree-modal-types'
|
||||
|
||||
export type NewWorkspaceRuntimeSettings = {
|
||||
defaultTuiAgent?: TuiAgent | 'blank' | null
|
||||
|
||||
Reference in New Issue
Block a user