Files
orca/src/main/runtime/construction/runtime-store-contract.ts
T
Kelvin AmoabaandMax Hsu 11403c1475 feat(workspace-cleanup): delete Codex chat history with the workspace (#43000)
The sweep now also deletes Codex rollouts whose workspace folder is gone,
under the same folder rule. A rollout is deleted under every name it has
across the host's Codex homes (sessions and archived_sessions, .jsonl and
.jsonl.zst), only when every copy is idle, its last turn ran in the gone
folder and Codex holds no writer lock for the thread. History link passes,
backfill and resume skip a rollout while it is being deleted, and no longer
leave a dangling symlink when the source is gone.

Fixes #16776

Co-authored-by: Max Hsu <maxmilian@gmail.com>
2026-11-16 23:10:41 +00:00

227 lines
14 KiB
TypeScript

import type { Store } from '../../persistence/loading-store/store'
import type { GlobalSettings } from '../../../shared/settings/global-settings-types'
import type { VoiceSettings } from '../../../shared/speech/speech-types'
export type RuntimeStore = {
getRepos: Store['getRepos']
getSshTargets?: Store['getSshTargets']
getRepo: Store['getRepo']
getRepoForHost?: Store['getRepoForHost']
addRepo: Store['addRepo']
updateRepo: Store['updateRepo']
addRetiredWorktreeName?: Store['addRetiredWorktreeName']
mergeRetiredWorktreeNames?: Store['mergeRetiredWorktreeNames']
getRetiredWorktreeNameRegistry?: Store['getRetiredWorktreeNameRegistry']
getRetiredWorktreeNameRegistryForNamespace?: Store['getRetiredWorktreeNameRegistryForNamespace']
getProjects?: Store['getProjects']
updateProject?: Store['updateProject']
getProjectHostSetups?: Store['getProjectHostSetups']
createProjectHostSetup?: Store['createProjectHostSetup']
updateProjectHostSetup?: Store['updateProjectHostSetup']
deleteProjectHostSetup?: Store['deleteProjectHostSetup']
getProjectGroups?: Store['getProjectGroups']
createProjectGroup?: Store['createProjectGroup']
updateProjectGroup?: Store['updateProjectGroup']
updateProjectGroups?: Store['updateProjectGroups']
deleteProjectGroup?: Store['deleteProjectGroup']
moveProjectToGroup?: Store['moveProjectToGroup']
getFolderWorkspace?: Store['getFolderWorkspace']
getFolderWorkspaces?: Store['getFolderWorkspaces']
createFolderWorkspace?: Store['createFolderWorkspace']
updateFolderWorkspace?: Store['updateFolderWorkspace']
removeFolderWorkspace?: Store['removeFolderWorkspace']
removeProjectForHost?: Store['removeProjectForHost']
reorderRepos?: Store['reorderRepos']
getAllWorktreeMeta: Store['getAllWorktreeMeta']
getWorkspaceMetadataCursor?: Store['getWorkspaceMetadataCursor']
getAllWorktreeMetaForHost?: Store['getAllWorktreeMetaForHost']
captureNativeLocalWorktreeMetadataScanExpectation?: Store['captureNativeLocalWorktreeMetadataScanExpectation']
pruneSessionlessMissingLocalWorktreeMetadataForRepo?: Store['pruneSessionlessMissingLocalWorktreeMetadataForRepo']
getProfileStorageDirectory?: Store['getProfileStorageDirectory']
getWorktreeMeta: Store['getWorktreeMeta']
setWorktreeMeta: Store['setWorktreeMeta']
getWorktreeMetaForHost?: Store['getWorktreeMetaForHost']
removeWorktreeMeta: Store['removeWorktreeMeta']
removeUnhostedWorktreeMeta?: Store['removeUnhostedWorktreeMeta']
getWorktreeLineage?: Store['getWorktreeLineage']
getAllWorktreeLineage?: Store['getAllWorktreeLineage']
setWorktreeLineage?: Store['setWorktreeLineage']
removeWorktreeLineage?: Store['removeWorktreeLineage']
getWorkspaceLineage?: Store['getWorkspaceLineage']
getAllWorkspaceLineage?: Store['getAllWorkspaceLineage']
setWorkspaceLineage?: Store['setWorkspaceLineage']
setFolderParentLineage?: Store['setFolderParentLineage']
getCrossStoreWorkspaceLineage?: Store['getCrossStoreWorkspaceLineage']
getAllCrossStoreWorkspaceLineage?: Store['getAllCrossStoreWorkspaceLineage']
setCrossStoreWorkspaceLineage?: Store['setCrossStoreWorkspaceLineage']
getGitHubCache: Store['getGitHubCache']
onGitHubCacheWritten?: Store['onGitHubCacheWritten']
getWorkspaceSession?: Store['getWorkspaceSession']
getWorkspaceSessionHostIds?: Store['getWorkspaceSessionHostIds']
onWorkspaceSessionWritten?: Store['onWorkspaceSessionWritten']
onWorkspaceSessionOperationEnded?: Store['onWorkspaceSessionOperationEnded']
onStateWritten?: Store['onStateWritten']
setWorkspaceSession?: Store['setWorkspaceSession']
getRemoteLayoutSnapshots?: Store['getRemoteLayoutSnapshots']
readTerminalScrollbackSnapshotAsync?: Store['readTerminalScrollbackSnapshotAsync']
statTerminalScrollbackSnapshotSize?: Store['statTerminalScrollbackSnapshotSize']
runDurableMutation?: Store['runDurableMutation']
flushOrThrow?: Store['flushOrThrow']
flushPendingOrThrowAsync?: Store['flushPendingOrThrowAsync']
stageOrcadMigrationCatalog?: Store['stageOrcadMigrationCatalog']
commitStagedOrcadMigrationCatalog?: Store['commitStagedOrcadMigrationCatalog']
stageOrcadMigrationSnapshotChunk?: Store['stageOrcadMigrationSnapshotChunk']
stageOrcadMigrationBlobChunk?: Store['stageOrcadMigrationBlobChunk']
abortStagedOrcadMigrationCatalog?: Store['abortStagedOrcadMigrationCatalog']
abortStagedOrcadMigrationCatalogByReference?: Store['abortStagedOrcadMigrationCatalogByReference']
getOrcadMigrationCatalogState?: Store['getOrcadMigrationCatalogState']
installOrcadMigrationReceivedBlobs?: Store['installOrcadMigrationReceivedBlobs']
installPendingOrcadMigrationReceivedBlobs?: Store['installPendingOrcadMigrationReceivedBlobs']
installDeferredOrcadMigrationShellHistory?: Store['installDeferredOrcadMigrationShellHistory']
hasPendingOrcadMigrationShellHistory?: Store['hasPendingOrcadMigrationShellHistory']
peekOrcadMigrationTerminalRestoreHint?: Store['peekOrcadMigrationTerminalRestoreHint']
consumeOrcadMigrationTerminalRestoreHint?: Store['consumeOrcadMigrationTerminalRestoreHint']
persistPtyBinding?: Store['persistPtyBinding']
getPtyBindingGeneration?: Store['getPtyBindingGeneration']
getLayoutEditorViews?: Store['getLayoutEditorViews']
admitTerminalPane?: Store['admitTerminalPane']
withdrawTerminalPane?: Store['withdrawTerminalPane']
applyLayoutCommand?: Store['applyLayoutCommand']
applyTabRenames?: Store['applyTabRenames']
moveTerminalLeafToNewTab?: Store['moveTerminalLeafToNewTab']
moveTabToWorkspaceAcrossPartitions?: Store['moveTabToWorkspaceAcrossPartitions']
applyEditorFileRenamesAcrossPartitions?: Store['applyEditorFileRenamesAcrossPartitions']
getSshRemotePtyLeases?: Store['getSshRemotePtyLeases']
getUI?: Store['getUI']
onUIChanged?: Store['onUIChanged']
updateUI?: Store['updateUI']
recordFeatureInteraction?: Store['recordFeatureInteraction']
listAutomations?: Store['listAutomations']
listAutomationsForScope?: Store['listAutomationsForScope']
assertAutomationOwnerFence?: Store['assertAutomationOwnerFence']
automationOwnerPrecondition?: Store['automationOwnerPrecondition']
automationChangeSelector?: Store['automationChangeSelector']
listAutomationRuns?: Store['listAutomationRuns']
listAutomationRunsPage?: Store['listAutomationRunsPage']
createAutomation?: Store['createAutomation']
updateAutomation?: Store['updateAutomation']
updateAutomations?: Store['updateAutomations']
deleteAutomation?: Store['deleteAutomation']
getSparsePresets?: Store['getSparsePresets']
saveSparsePreset?: Store['saveSparsePreset']
getMobileClientTabSelections?: Store['getMobileClientTabSelections']
setMobileClientTabSelections?: Store['setMobileClientTabSelections']
getSettings(): {
browserClientHostedRemoteEnabled?: GlobalSettings['browserClientHostedRemoteEnabled']
autoRenameBranchFromWork?: GlobalSettings['autoRenameBranchFromWork']
nativeChatAutoName?: GlobalSettings['nativeChatAutoName']
notifications?: GlobalSettings['notifications']
claudeManagedAccounts?: GlobalSettings['claudeManagedAccounts']
activeClaudeManagedAccountId?: GlobalSettings['activeClaudeManagedAccountId']
activeClaudeManagedAccountIdsByRuntime?: GlobalSettings['activeClaudeManagedAccountIdsByRuntime']
activeCodexManagedAccountId?: GlobalSettings['activeCodexManagedAccountId']
activeCodexManagedAccountIdsByRuntime?: GlobalSettings['activeCodexManagedAccountIdsByRuntime']
agentWorkspaceTrustEnabled?: GlobalSettings['agentWorkspaceTrustEnabled']
codexManagedAccounts?: GlobalSettings['codexManagedAccounts']
codexShareHistoryAcrossAccounts?: GlobalSettings['codexShareHistoryAcrossAccounts']
codexSessionSourceHome?: GlobalSettings['codexSessionSourceHome']
deleteChatHistoryWithWorkspace?: GlobalSettings['deleteChatHistoryWithWorkspace']
nestedWorkerMaxDepth?: GlobalSettings['nestedWorkerMaxDepth']
orchestrationWorkerAutoReleaseEnabled?: GlobalSettings['orchestrationWorkerAutoReleaseEnabled']
orchestrationCoordinatorApprovalsEnabled?: GlobalSettings['orchestrationCoordinatorApprovalsEnabled']
workspaceDir: string
nestWorkspaces: boolean
workspaceDirHistory?: GlobalSettings['workspaceDirHistory']
// Read by worktree placement: decides whether this project's worktrees
// mirror into a WSL distro instead of the Windows drive.
localWindowsRuntimeDefault?: GlobalSettings['localWindowsRuntimeDefault']
// Stage 1 is opt-in: WSL-host-only explanations and routing need the setting on.
experimentalWslHosts?: GlobalSettings['experimentalWslHosts']
refreshLocalBaseRefOnWorktreeCreate: boolean
localBaseRefSuggestionDismissed?: boolean
branchPrefix: string
branchPrefixCustom: string
defaultTuiAgent?: GlobalSettings['defaultTuiAgent']
newWorkspaceSetupOnly?: GlobalSettings['newWorkspaceSetupOnly']
disabledTuiAgents?: GlobalSettings['disabledTuiAgents']
agentCmdOverrides?: GlobalSettings['agentCmdOverrides']
agentLaunchChoices?: GlobalSettings['agentLaunchChoices']
agentDefaultArgs?: GlobalSettings['agentDefaultArgs']
agentDefaultEnv?: GlobalSettings['agentDefaultEnv']
agentPermissionDefault?: GlobalSettings['agentPermissionDefault']
agentPermissionOverrides?: GlobalSettings['agentPermissionOverrides']
terminalWindowsShell?: GlobalSettings['terminalWindowsShell']
// Read by the launch-line carry rule to name the shell a local line is typed into.
terminalDefaultShell?: GlobalSettings['terminalDefaultShell']
floatingTerminalEnabled?: GlobalSettings['floatingTerminalEnabled']
floatingTerminalCwd?: GlobalSettings['floatingTerminalCwd']
floatingTerminalTrustedCwds?: GlobalSettings['floatingTerminalTrustedCwds']
agentStatusHooksEnabled?: GlobalSettings['agentStatusHooksEnabled']
claudeSubagentNavigationEnabled?: GlobalSettings['claudeSubagentNavigationEnabled']
followSymlinkedDirectories?: GlobalSettings['followSymlinkedDirectories']
tabAutoGenerateTitle?: GlobalSettings['tabAutoGenerateTitle']
terminalCopyTrimsGutter?: GlobalSettings['terminalCopyTrimsGutter']
agentDefaultSurface?: GlobalSettings['agentDefaultSurface']
nativeChatProviders?: GlobalSettings['nativeChatProviders']
antigravityChatAuth?: GlobalSettings['antigravityChatAuth']
defaultTaskSource?: GlobalSettings['defaultTaskSource']
defaultTaskViewPreset?: GlobalSettings['defaultTaskViewPreset']
visibleTaskProviders?: GlobalSettings['visibleTaskProviders']
defaultRepoSelection?: GlobalSettings['defaultRepoSelection']
defaultLinearTeamSelection?: GlobalSettings['defaultLinearTeamSelection']
githubProjects?: GlobalSettings['githubProjects']
experimentalNewWorktreeCardStyle?: GlobalSettings['experimentalNewWorktreeCardStyle']
worktreeCardDetailsRow?: GlobalSettings['worktreeCardDetailsRow']
compactWorktreeCards?: GlobalSettings['compactWorktreeCards']
minimaxGroupId?: GlobalSettings['minimaxGroupId']
minimaxUsageModels?: GlobalSettings['minimaxUsageModels']
minimaxEndpoint?: GlobalSettings['minimaxEndpoint']
zcodePlanSite?: GlobalSettings['zcodePlanSite']
prBotAuthorOverrides?: GlobalSettings['prBotAuthorOverrides']
sourceControlGroupOrder?: GlobalSettings['sourceControlGroupOrder']
sourceControlCompareAgainstUpstream?: GlobalSettings['sourceControlCompareAgainstUpstream']
prAutoRefresh?: GlobalSettings['prAutoRefresh']
diffShowWhitespace?: GlobalSettings['diffShowWhitespace']
newTabMenuLayout?: GlobalSettings['newTabMenuLayout']
floatingTerminalNewTabMenuLayout?: GlobalSettings['floatingTerminalNewTabMenuLayout']
artifactSharingEnabled?: GlobalSettings['artifactSharingEnabled']
terminalQuickCommands?: GlobalSettings['terminalQuickCommands']
gitlabProjects?: GlobalSettings['gitlabProjects']
mobileAutoRestoreFitMs?: number | null
mobileEmulatorEnabled?: boolean
mobileEmulatorDefaultDeviceUdid?: string | null
machineName?: GlobalSettings['machineName']
voice?: VoiceSettings
claudeAgentTeamsMode?: GlobalSettings['claudeAgentTeamsMode']
// Read query-responder kill switches per ingested chunk to capture reply ownership.
terminalMainSideEffectAuthority?: GlobalSettings['terminalMainSideEffectAuthority']
terminalHiddenDeliveryGate?: GlobalSettings['terminalHiddenDeliveryGate']
terminalModelQueryAuthority?: GlobalSettings['terminalModelQueryAuthority']
worktreeVisibilityDefaults?: GlobalSettings['worktreeVisibilityDefaults']
workspaceCleanupPolicy?: GlobalSettings['workspaceCleanupPolicy']
hostSettingOverrides?: GlobalSettings['hostSettingOverrides']
activeRuntimeEnvironmentId?: GlobalSettings['activeRuntimeEnvironmentId']
showPinnedWorktreesInGroups?: GlobalSettings['showPinnedWorktreesInGroups']
agentSkillSharingEnabled?: GlobalSettings['agentSkillSharingEnabled']
nativeChatSessionOptions?: GlobalSettings['nativeChatSessionOptions']
nativeChatPermissionMode?: GlobalSettings['nativeChatPermissionMode']
nativeChatQueueFollowUps?: GlobalSettings['nativeChatQueueFollowUps']
nativeChatCiResultLines?: GlobalSettings['nativeChatCiResultLines']
nativeChatAutoContinueAfterUsageLimit?: GlobalSettings['nativeChatAutoContinueAfterUsageLimit']
nativeChatIdleStopMinutes?: GlobalSettings['nativeChatIdleStopMinutes']
nativeChatInlineVisuals?: GlobalSettings['nativeChatInlineVisuals']
nativeChatInheritShellEnvironment?: GlobalSettings['nativeChatInheritShellEnvironment']
nativeChatShellEnvironmentVariables?: GlobalSettings['nativeChatShellEnvironmentVariables']
aiVaultSearch?: GlobalSettings['aiVaultSearch']
sourceControlAi?: GlobalSettings['sourceControlAi']
commitMessageAi?: GlobalSettings['commitMessageAi']
}
// Unknown return lets mocks return void; runtime reads persisted settings on next access, never this return.
updateSettings?: (
updates: Partial<GlobalSettings>,
options?: { notifyListeners?: boolean; originWebContentsId?: number }
) => unknown
updateSettingsAndFlush?: Store['updateSettingsAndFlush']
onSettingsChanged?: Store['onSettingsChanged']
}