mirror of
https://github.com/stablyai/orca.git
synced 2026-10-27 08:02:51 +00:00
* Revert "feat(orcad): source-side dormant export of a relay-hosted SSH target (#16741 T6-8) (#24519)" This reverts commit783101b304. * Revert "feat(ssh): update, roll back, recover and stop a managed orcad server (#16741 T6-5 follow-up) (#24463)" This reverts commit38c2d1dcb9. * Revert "feat(ssh): deploy and pair an empty managed orcad server over SSH (#16741 T6-5) (#24453)" This reverts commit8b76683b40. * Revert "fix(ssh): orcad GC honors the activation journal; readiness requires proven daemon coverage (#16741 T6 follow-up) (#24451)" This reverts commitd3f8c5063b. * Revert "feat(ssh): remote orcad stop by request file and journaled decommission (#16741 T6-4) (#24449)" This reverts commit43d9b43d3f. * Revert "feat(orcad): supervisable server: stop requests, managed stop receipts and a lifetime that keeps its lock on failed teardown (#16741 T6-3) (#24433)" This reverts commitb093d3ab20. * Revert "feat(ssh): crash-safe orcad activation, rollback and recovery (#16741 T6-2) (#24423)" This reverts commit1a9ac0e955. * Revert "feat(runtime): SSH access links for paired servers in a downgrade-safe sidecar (#16741 T5-1+T5-2) (#24420)" This reverts commit99db2bfae4. * Revert "feat(relay): capability-gated owner reset with a durable preparation journal (#16741 T3 R1) (#24418)" This reverts commit34a582bd39. * Revert "feat(ssh): track connection-manager drains, test probes and provider continuations (#16741 T2 P3+P8a) (#24407)" This reverts commitd53063d2b1. * Revert "feat(daemon): idle retirement, session census and recovery-only provider (#16741 T2 P4b) (#24409)" This reverts commitff212dbbef. * Revert "feat(ssh): add pty.resumeClient and split SSH PTY process listing (#16741 T2 P5+P6) (#24414)" This reverts commit92cb71765e. * Revert "feat(relay): await owned watcher and agent children on shutdown (#16741 T2 P1) (#24400)" This reverts commit6b36e4f85b. * Revert "feat(session): retry failed renderer session writes and verify local folder PTYs (#16741 T2 P9) (#24406)" This reverts commitd23ecef301. * Revert "feat(ssh): remote orcad primitives on the pinned Node runtime (#16741 T6-1) (#24419)" This reverts commitdd87ae578d. * Revert "fix(runtime): fence runtime-environment subscriptions and status probes by identity (#16741 T5-3) (#24421)" This reverts commitece9e4d2e3. * Revert "feat(orcad): migration manifest and dormant-state contracts (#16741 T6-7) (#24422)" This reverts commit3fbdaba262. * Revert "feat(ssh): wire SshConnection through the work and transport close ledgers (#16741 T2 P2) (#24401)" This reverts commit4e8edc8872. * Revert "feat(profiles): carry markdown frontmatter visibility in project transfers (#16741 T2 P7) (#24405)" This reverts commit60c93263cc. * Revert "fix(runtime): project the PTY incarnation onto mobile session tabs (#24413)" This reverts commit99e0303572. * Revert "feat(daemon): tag daemon stream data with the PTY incarnation id (#16741 T2 P4a) (#24402)" This reverts commit817af768b0. * Revert "feat(ssh): port the SSH connection work ledger and transport close ledger (#16741 T2) (#24210)" This reverts commitc9918931c8. * Revert "feat(relay): fence and drain file and git response streams on shutdown (#24185)" This reverts commitdc08ffeba9. * Revert "refactor(runtime-rpc): extract the Node WebSocket lifecycle; opt-in pinned port (#24186)" This reverts commita789233bbb. * Revert "feat(relay): route relay handlers through work admission; producer publication drain (#24181)" This reverts commit0b812bd698. * Revert "feat(relay): land the #16741 T1 seam (work drain, publication drain, release gate) (#24156)" This reverts commit3aa2d3af7c. --------- Co-authored-by: m4air <m4air@Mac.localdomain>
67 lines
2.4 KiB
TypeScript
67 lines
2.4 KiB
TypeScript
import type { SshGitProvider } from './ssh-git-provider'
|
|
import { getSshPlainSshMode, PlainSshUnsupportedError } from '../ssh/ssh-plain-ssh-mode'
|
|
|
|
const sshProviders = new Map<string, SshGitProvider>()
|
|
const sshProviderGenerations = new Map<string, number>()
|
|
const SSH_PROVIDER_GENERATION_MAX_ENTRIES = 512
|
|
let providerGenerationSequence = 0
|
|
let evictedProviderGeneration = 0
|
|
|
|
export const SSH_GIT_PROVIDER_UNAVAILABLE_MESSAGE =
|
|
'Remote connection dropped. Click Reconnect on the SSH target before retrying.'
|
|
|
|
export function registerSshGitProvider(connectionId: string, provider: SshGitProvider): void {
|
|
sshProviders.set(connectionId, provider)
|
|
sshProviderGenerations.set(connectionId, ++providerGenerationSequence)
|
|
pruneProviderGenerations()
|
|
}
|
|
|
|
export function unregisterSshGitProvider(connectionId: string): void {
|
|
if (sshProviders.delete(connectionId)) {
|
|
sshProviderGenerations.set(connectionId, ++providerGenerationSequence)
|
|
pruneProviderGenerations()
|
|
}
|
|
}
|
|
|
|
// Connection ids are externally supplied and can churn across repeated SSH
|
|
// sessions. Keep recent generations for cache invalidation without retaining
|
|
// every retired target for the lifetime of the main process.
|
|
function pruneProviderGenerations(): void {
|
|
while (sshProviderGenerations.size > SSH_PROVIDER_GENERATION_MAX_ENTRIES) {
|
|
const oldest = sshProviderGenerations.keys().next()
|
|
if (oldest.done) {
|
|
return
|
|
}
|
|
evictedProviderGeneration = Math.max(
|
|
evictedProviderGeneration,
|
|
sshProviderGenerations.get(oldest.value) ?? 0
|
|
)
|
|
sshProviderGenerations.delete(oldest.value)
|
|
}
|
|
}
|
|
|
|
export function getSshGitProviderGeneration(connectionId: string): number {
|
|
return sshProviderGenerations.get(connectionId) ?? evictedProviderGeneration
|
|
}
|
|
|
|
/** @internal - exposed for cache-bound regression tests. */
|
|
export function _getSshGitProviderGenerationCacheSize(): number {
|
|
return sshProviderGenerations.size
|
|
}
|
|
|
|
export function getSshGitProvider(connectionId: string): SshGitProvider | undefined {
|
|
return sshProviders.get(connectionId)
|
|
}
|
|
|
|
export function requireSshGitProvider(connectionId: string): SshGitProvider {
|
|
const provider = getSshGitProvider(connectionId)
|
|
if (!provider) {
|
|
const plainMode = getSshPlainSshMode(connectionId)
|
|
if (plainMode) {
|
|
throw new PlainSshUnsupportedError('Git', plainMode)
|
|
}
|
|
throw new Error(SSH_GIT_PROVIDER_UNAVAILABLE_MESSAGE)
|
|
}
|
|
return provider
|
|
}
|