fix: gate direct session creation by workspace policy
This commit is contained in:
@@ -9,6 +9,9 @@ export interface WorkspaceDraft {
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export const WORKSPACE_SUMMARY_ERROR = "Could not load workspace registry. Please retry.";
|
||||
export const WORKSPACE_POLICY_ERROR = "Could not load selected workspace policy. Please retry.";
|
||||
|
||||
export class WorkspaceSelectionError extends Error {}
|
||||
|
||||
type PolicySelection = {
|
||||
@@ -70,7 +73,7 @@ export const workspacePolicyGate = {
|
||||
rejectSummary(workspaceId: string): void {
|
||||
if (!selection || selection.workspaceId !== workspaceId || selection.state !== "summary") return;
|
||||
selection.state = "error";
|
||||
selection.error = new WorkspaceSelectionError("Could not load workspace registry. Please retry.");
|
||||
selection.error = new WorkspaceSelectionError(WORKSPACE_SUMMARY_ERROR);
|
||||
selection.settle();
|
||||
},
|
||||
|
||||
@@ -88,7 +91,7 @@ export const workspacePolicyGate = {
|
||||
reject(workspaceId: string): void {
|
||||
if (!selection || selection.workspaceId !== workspaceId || selection.state !== "pending") return;
|
||||
selection.state = "error";
|
||||
selection.error = new WorkspaceSelectionError("Could not load selected workspace policy. Please retry.");
|
||||
selection.error = new WorkspaceSelectionError(WORKSPACE_POLICY_ERROR);
|
||||
selection.settle();
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user