mirror of
https://github.com/stablyai/orca.git
synced 2026-11-01 09:37:33 +00:00
* feat(wsl): run Git for Windows for a WSL project on a Windows drive A project on C:\ whose runtime is WSL ran every Orca Git command through wsl.exe on /mnt/c: ~300x slower than Windows Git, and blind to Windows-side edits. The project's WSL runtime preference gains an optional `git: 'windows-host'`. With it, Orca's Git (and where new worktrees go) is Windows; terminals, agents, accounts and hooks still resolve to WSL, so nothing else changes. Older builds drop the field and go back to WSL Git. The conversion checks first, then the caller saves the returned preference through the normal project update: - Git for Windows must exist. - New worktrees must not be set to go inside the distro. - No linked worktree may have a Linux-path link. WSL Git made those; Windows Git sees them as prunable, and Orca's prune after a worktree removal would delete their metadata. - Optionally writes core.autocrlf=true into the repo when Windows Git uses it, so WSL Git in the project's terminals stops seeing CRLF changes. Never core.checkStat. IPC is refused off Windows and with the internal WSL hosts gate closed. Co-Authored-By: Claude <noreply@anthropic.com> * test(wsl): mock the drive-project IPC in the core handler registration test Co-Authored-By: Claude <noreply@anthropic.com> * test(wsl): pin WSL Git for a drive project that never chose Windows Git, and record which Git ran * fix(wsl): base-ref lookups and the remote-identity sweep run Git where the project's runtime does * fix(wsl): route base-ref and remote-identity reads by runtime only with WSL hosts on These reads ran host Git on main. Routing them into a WSL-runtime project's distro is part of D1c, so with the WSL hosts gate closed they run host Git exactly as before. (cherry picked from commit 2ed82987dc5b82c3a86ea7e03ce05e9efc3e77fb) * refactor(ipc): register the filesystem handlers in one call, keeping core registration under its line cap The optional commit-message resolvers pass straight through, so the call is the same with or without them. #34059 left this file at the 300-line cap and the WSL drive-project wiring adds to it. Co-Authored-By: Claude <noreply@anthropic.com> * fix(wsl): skip folder repos in the Windows Git check, and read worktree links with the prune guard's reader Folder repos run no Git, so rev-parse on them always failed the preview. The link reader and the WSL-authored test now come from worktree-prune-guard.ts; the copy's startsWith('/') wrongly refused //wsl.localhost links, which Windows Git writes itself. Co-Authored-By: Claude <noreply@anthropic.com> * fix(wsl): the remote-identity sweep checks the distro a drive project's Git runs in, so it never boots a stopped one --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
99 lines
3.5 KiB
TypeScript
99 lines
3.5 KiB
TypeScript
import { z } from 'zod'
|
||
import { OptionalString, requiredString } from './rpc-param-primitives'
|
||
import {
|
||
LOCAL_EXECUTION_HOST_ID,
|
||
normalizeExecutionHostId,
|
||
parseExecutionHostId
|
||
} from '../execution-host'
|
||
|
||
export const ProjectProviderIdentity = z.object({
|
||
provider: z.literal('github'),
|
||
owner: requiredString('Missing project owner'),
|
||
repo: requiredString('Missing project repository'),
|
||
host: OptionalString
|
||
})
|
||
|
||
// Client-minted runtime IDs address this machine, never a proxy. Persist local so clients share host identity
|
||
// and project/host deduplication works; readers project local back to each client’s own runtime ID.
|
||
// Legacy rows keep their existing stamps.
|
||
export const RequestedHostId = requiredString('Missing host ID').transform((value, ctx) => {
|
||
const hostId = normalizeExecutionHostId(value)
|
||
if (!hostId) {
|
||
ctx.addIssue({ code: 'custom', message: 'Invalid host ID' })
|
||
return z.NEVER
|
||
}
|
||
return parseExecutionHostId(hostId)?.kind === 'runtime' ? LOCAL_EXECUTION_HOST_ID : hostId
|
||
})
|
||
|
||
export const ProjectHostSetupExistingFolder = z.object({
|
||
projectId: requiredString('Missing project ID'),
|
||
projectProviderIdentity: ProjectProviderIdentity.optional(),
|
||
hostId: RequestedHostId,
|
||
path: requiredString('Missing project path'),
|
||
kind: z.enum(['git', 'folder']).optional(),
|
||
displayName: OptionalString,
|
||
setupMethod: z.enum(['imported-existing-folder', 'cloned']).optional()
|
||
})
|
||
|
||
export const ProjectHostSetupClone = z.object({
|
||
projectId: requiredString('Missing project ID'),
|
||
projectProviderIdentity: ProjectProviderIdentity.optional(),
|
||
hostId: RequestedHostId,
|
||
url: requiredString('Missing clone URL'),
|
||
destination: requiredString('Missing clone destination'),
|
||
displayName: OptionalString
|
||
})
|
||
|
||
export const LocalWindowsRuntimePreference = z.discriminatedUnion('kind', [
|
||
z.object({ kind: z.literal('inherit-global') }),
|
||
z.object({ kind: z.literal('windows-host') }),
|
||
z.object({
|
||
kind: z.literal('wsl'),
|
||
distro: requiredString('Missing WSL distro'),
|
||
git: z.literal('windows-host').optional()
|
||
})
|
||
])
|
||
|
||
export const ProjectUpdate = z.object({
|
||
projectId: requiredString('Missing project ID'),
|
||
updates: z.object({
|
||
localWindowsRuntimePreference: LocalWindowsRuntimePreference.optional()
|
||
})
|
||
})
|
||
|
||
export const ProjectHostSetupCreate = z.object({
|
||
projectId: requiredString('Missing project ID'),
|
||
hostId: RequestedHostId,
|
||
setupId: OptionalString,
|
||
path: OptionalString,
|
||
kind: z.enum(['git', 'folder']).optional(),
|
||
displayName: OptionalString,
|
||
worktreeBasePath: OptionalString,
|
||
gitUsername: OptionalString,
|
||
setupState: z.enum(['ready', 'not-set-up', 'setting-up', 'error', 'unsupported']).optional(),
|
||
setupMethod: z.enum(['imported-existing-folder', 'cloned', 'provisioned']).optional()
|
||
})
|
||
|
||
// Why `hostId` is optional: older clients omit it, and older hosts strip it (first match by id).
|
||
export const ProjectHostSetupUpdate = z.object({
|
||
setupId: requiredString('Missing setup ID'),
|
||
hostId: RequestedHostId.optional(),
|
||
updates: z.object({
|
||
displayName: OptionalString,
|
||
path: OptionalString,
|
||
worktreeBasePath: OptionalString,
|
||
setupState: z.enum(['ready', 'not-set-up', 'setting-up', 'error', 'unsupported']).optional(),
|
||
setupMethod: z
|
||
.enum(['legacy-repo', 'imported-existing-folder', 'cloned', 'provisioned'])
|
||
.optional(),
|
||
gitUsername: OptionalString,
|
||
kind: z.enum(['git', 'folder']).optional()
|
||
})
|
||
})
|
||
|
||
export const ProjectHostSetupDelete = z.object({
|
||
setupId: requiredString('Missing setup ID'),
|
||
hostId: RequestedHostId.optional(),
|
||
force: z.boolean().optional()
|
||
})
|