Files
PaperClipAI/ui/src/lib/new-agent-adapters.ts
T
Devin FoleyandPaperclip ae2afd525b Make harness choices deployment-configurable
Managed deployments need to control harness availability without changing Core policy. Add a generic environment contract and apply it across harness and model selectors, preserving saved supported profiles and validating import, team, and invite selections. Document deployment ownership in agent guidance.

Validation: focused local tests and typechecks passed; all applicable CI checks passed on the reviewed head. Greptile scored 5/5 with no unresolved comments.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-11-20 15:45:36 -08:00

30 lines
1.5 KiB
TypeScript

import { PAPERCLIP_RUNNER_ACPX_PROFILES } from "@paperclipai/adapter-utils";
import { unrestrictedCloudHarnessPolicy, type CloudHarnessPolicy } from "./cloud-harness-policy";
/** Creation policy shared by the picker and direct setup links. */
export function isNewAgentAdapterAllowed(
type: string,
{
cloud,
harnessPolicy = unrestrictedCloudHarnessPolicy,
nativeRunnerEnabled,
openAiDotEnabled = false,
museEnabled = false,
runnerProvider,
candidateHarnesses,
}: { cloud: boolean; harnessPolicy?: CloudHarnessPolicy; nativeRunnerEnabled: boolean; openAiDotEnabled?: boolean; museEnabled?: boolean; runnerProvider?: string;
candidateHarnesses?: readonly { agent: "antigravity"; model: string }[] },
) {
if (cloud && !(type === "paperclip_runner"
? harnessPolicy.isCloudRunnerProviderAllowed(runnerProvider ?? "codex")
: harnessPolicy.isCloudHarnessAllowed(type))) return false;
if (type === "openai_dot" || (type === "paperclip_runner" && runnerProvider === "openai_dot")) {
return openAiDotEnabled;
}
if (type === "muse" || (type === "paperclip_runner" && runnerProvider === "muse")) return museEnabled && nativeRunnerEnabled;
if (type === "paperclip_runner" && runnerProvider === "antigravity") return PAPERCLIP_RUNNER_ACPX_PROFILES.some(profile => profile.value === "antigravity" && profile.qualified)
|| Boolean(candidateHarnesses?.some(candidate => candidate.agent === "antigravity" && candidate.model));
if (type === "paperclip_runner") return runnerProvider === "copilot" || nativeRunnerEnabled;
return true;
}