MCPcopy Create free account
hub / github.com/anomalyco/opencode / clearWorkspaceTerminals

Function clearWorkspaceTerminals

packages/app/src/context/terminal.tsx:120–144  ·  view source on GitHub ↗
(
  dir: string,
  sessionIDs?: string[],
  platform?: Platform,
  scope: ServerScopeValue = ServerScope.local,
)

Source from the content-addressed store, hash-verified

118}
119
120export function clearWorkspaceTerminals(
121 dir: string,
122 sessionIDs?: string[],
123 platform?: Platform,
124 scope: ServerScopeValue = ServerScope.local,
125) {
126 const key = getWorkspaceTerminalCacheKey(dir, scope)
127 for (const cache of caches) {
128 const entry = cache.get(key)
129 entry?.value.clear()
130 }
131
132 void removePersisted(terminalPersistTarget(scope, dir), platform)
133
134 if (scope !== ServerScope.local) return
135 const legacy = new Set(getLegacyTerminalStorageKeys(dir))
136 for (const id of sessionIDs ?? []) {
137 for (const key of getLegacyTerminalStorageKeys(dir, id)) {
138 legacy.add(key)
139 }
140 }
141 for (const key of legacy) {
142 void removePersisted({ key }, platform)
143 }
144}
145
146function createWorkspaceTerminalSession(
147 sdk: DirectorySDK,

Callers 1

resetWorkspaceFunction · 0.90

Calls 7

removePersistedFunction · 0.90
terminalPersistTargetFunction · 0.85
getMethod · 0.65
addMethod · 0.65
clearMethod · 0.45

Tested by

no test coverage detected