Skip to content

The open-source app everyone uses to manage agents at work

749 B
Raw Blame
import { safeWorkspaceRestorePath } from "@paperclipai/shared";

export function workspaceRestoreMarkerDetail(input: {
  result: Record<string, unknown> | null | undefined;
  savedPlan: boolean;
  hasResponse: boolean;
}): string {
  const parts = [input.savedPlan
    ? "Workspace restore failed after the plan was saved. The saved plan is available."
    : "Workspace restore failed."];
  parts.push("Workspace files need recovery.");
  if (!input.hasResponse && input.result?.finalResponseRecorded === false) {
    parts.push("No final response was recorded.");
  }
  const relativePath = safeWorkspaceRestorePath(input.result?.workspaceRestorePath);
  if (relativePath) parts.push(`Affected path: ${relativePath}.`);
  return parts.join(" ");
}