refactor(tui): improve workspace management (#22691)

This commit is contained in:
James Long
2026-04-16 12:24:40 -04:00
committed by GitHub
parent 305460b25f
commit 06afd33291
10 changed files with 349 additions and 37 deletions

View File

@@ -2,17 +2,17 @@ import { LocalContext } from "../util"
import type { WorkspaceID } from "../control-plane/schema"
export interface WorkspaceContext {
workspaceID: string
workspaceID: WorkspaceID
}
const context = LocalContext.create<WorkspaceContext>("instance")
export const WorkspaceContext = {
async provide<R>(input: { workspaceID: WorkspaceID; fn: () => R }): Promise<R> {
return context.provide({ workspaceID: input.workspaceID as string }, () => input.fn())
return context.provide({ workspaceID: input.workspaceID }, () => input.fn())
},
restore<R>(workspaceID: string, fn: () => R): R {
restore<R>(workspaceID: WorkspaceID, fn: () => R): R {
return context.provide({ workspaceID }, fn)
},