Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

1.1 KB
Raw Blame
import { discardPreparedProjectWorktree, prepareProjectWorktree, type PreparedProjectWorktree } from "@/lib/host/project-worktree";
import { startWorkflow } from "@/lib/workflow";
import type { TaskClassification } from "@/lib/orchestration/types";

export async function prepareWorkflowStartWorkspace(
  projectPath: string | undefined,
  gitAvailable: boolean | undefined,
  isolation: TaskClassification["isolation"],
): Promise<PreparedProjectWorktree | undefined> {
  return projectPath && gitAvailable && isolation === "isolated-worktree"
    ? prepareProjectWorktree(projectPath)
    : undefined;
}

export function workflowWorkspaceResources(resources: string[], workspace?: PreparedProjectWorktree): string[] {
  return [...new Set([...resources, ...(workspace?.created ? [workspace.workspacePath] : [])])].slice(0, 40);
}

export async function startWorkflowWithWorkspace(
  input: Parameters<typeof startWorkflow>[0],
  workspace?: PreparedProjectWorktree,
) {
  try {
    return await startWorkflow(input);
  } catch (error) {
    if (workspace?.created) await discardPreparedProjectWorktree(workspace).catch(() => false);
    throw error;
  }
}