mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
* Split speech session lifecycle * Split terminal output scheduler pipeline * Split mobile browser pane modules * Prune resolved max-lines suppressions * Split pane tree equalization logic * Extract mobile troubleshoot screen styles * Split external automation manager * Split main window service attachments * Split hosted review creation checks * Split automation dispatch event handling * Split settings navigation metadata * Split daemon initialization lifecycle * Split GitLab item dialog * Split relay dispatcher layers * Split mobile host screen * Retarget mobile view settings source test * Split runtime file client layers * Split ports panel layers * Split runtime environments pane layers * Split local PTY provider responsibilities * Split CDP bridge responsibilities * Split relay Git handler responsibilities * Track moved relay Git fetch audit * Fix F3-speech for #17123 * Fix F1-cycle for #17131 * Fix F4-navtest for #17157 * Fix F2-allowlist for #17161
109 lines
3.2 KiB
TypeScript
109 lines
3.2 KiB
TypeScript
import type { RequestContext } from './dispatcher'
|
|
import type { InFlightPromiseDedupe } from '../shared/in-flight-promise-dedupe'
|
|
import type { GitCapabilityCache } from '../shared/git-capability-cache'
|
|
import type { SubmodulePathsCache } from './git-handler-submodule-ops'
|
|
import type { RelayFilesystemWatchRegistry } from './relay-filesystem-watch-registry'
|
|
|
|
export const GIT_BULK_CHUNK_SIZE = 100
|
|
|
|
export type GitHandlerCommandOptions = {
|
|
maxBuffer?: number
|
|
disableOptionalLocks?: boolean
|
|
signal?: AbortSignal
|
|
nonInteractive?: boolean
|
|
stdin?: string
|
|
timeout?: number
|
|
terminationBarrier?: boolean
|
|
}
|
|
|
|
export type GitHandlerCommandResult = { stdout: string; stderr: string }
|
|
export type GitHandlerWatcherRegistry = Pick<RelayFilesystemWatchRegistry, 'runWithRemovalFence'>
|
|
|
|
export type GitHandlerOperationHost = {
|
|
readonly gitDiffReadDedupe: InFlightPromiseDedupe<unknown>
|
|
readonly gitCapabilities: GitCapabilityCache
|
|
readonly submodulePathsCache: SubmodulePathsCache
|
|
readonly watcherRegistry: GitHandlerWatcherRegistry | undefined
|
|
git(
|
|
args: string[],
|
|
cwd: string,
|
|
opts?: GitHandlerCommandOptions
|
|
): Promise<GitHandlerCommandResult>
|
|
gitBuffer(args: string[], cwd: string): Promise<Buffer>
|
|
spawnClone(
|
|
args: string[],
|
|
cwd: string,
|
|
progressId: string,
|
|
context?: RequestContext
|
|
): Promise<GitHandlerCommandResult>
|
|
clearGitMutationReadCaches(): void
|
|
runWithGitReadCacheClear<T>(run: () => Promise<T>): Promise<T>
|
|
maybeStreamResponse(
|
|
result: unknown,
|
|
params: Record<string, unknown>,
|
|
context: RequestContext | undefined
|
|
): unknown
|
|
}
|
|
|
|
export abstract class GitHandlerOperationContext {
|
|
constructor(private readonly host: GitHandlerOperationHost) {}
|
|
|
|
protected get gitDiffReadDedupe(): InFlightPromiseDedupe<unknown> {
|
|
return this.host.gitDiffReadDedupe
|
|
}
|
|
|
|
protected get gitCapabilities(): GitCapabilityCache {
|
|
return this.host.gitCapabilities
|
|
}
|
|
|
|
protected get submodulePathsCache(): SubmodulePathsCache {
|
|
return this.host.submodulePathsCache
|
|
}
|
|
|
|
protected get watcherRegistry(): GitHandlerWatcherRegistry | undefined {
|
|
return this.host.watcherRegistry
|
|
}
|
|
|
|
protected git(
|
|
args: string[],
|
|
cwd: string,
|
|
opts?: GitHandlerCommandOptions
|
|
): Promise<GitHandlerCommandResult> {
|
|
return this.host.git(args, cwd, opts)
|
|
}
|
|
|
|
protected gitBuffer(args: string[], cwd: string): Promise<Buffer> {
|
|
return this.host.gitBuffer(args, cwd)
|
|
}
|
|
|
|
protected spawnClone(
|
|
args: string[],
|
|
cwd: string,
|
|
progressId: string,
|
|
context?: RequestContext
|
|
): Promise<GitHandlerCommandResult> {
|
|
return this.host.spawnClone(args, cwd, progressId, context)
|
|
}
|
|
|
|
protected clearGitMutationReadCaches(): void {
|
|
this.host.clearGitMutationReadCaches()
|
|
}
|
|
|
|
protected runWithGitReadCacheClear<T>(run: () => Promise<T>): Promise<T> {
|
|
return this.host.runWithGitReadCacheClear(run)
|
|
}
|
|
|
|
protected maybeStreamResponse(
|
|
result: unknown,
|
|
params: Record<string, unknown>,
|
|
context: RequestContext | undefined
|
|
): unknown {
|
|
return this.host.maybeStreamResponse(result, params, context)
|
|
}
|
|
|
|
protected literalPathspec(filePath: string): string {
|
|
// Why: source-control selections are concrete paths, not user-authored Git globs.
|
|
return `:(literal)${filePath}`
|
|
}
|
|
}
|