mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-11 08:42:45 +00:00
14 lines
596 B
TypeScript
14 lines
596 B
TypeScript
/** Resolve an explicit placement request without silently changing its target. */
|
|
export function resolveAgentHostWorkspace(
|
|
requested: string | undefined,
|
|
activeTabId: string | undefined,
|
|
workspaceIds: readonly string[],
|
|
): { workspaceId?: string; error?: string } {
|
|
if (requested === undefined) return {};
|
|
const workspaceId = requested === 'current' ? activeTabId : requested.trim();
|
|
if (!workspaceId || !workspaceIds.includes(workspaceId)) {
|
|
return { error: `Workspace "${requested}" is not available. Select a workspace or provide its id.` };
|
|
}
|
|
return { workspaceId };
|
|
}
|