Files
PaperClipAI/packages/paperclip-runner/scripts/candidate-provider-pack.mjs
T
DottaandPaperclip 83841aecf6 Add GitHub Copilot 1.0.88 runtime on current master
Reviewed partition of the current-master Copilot integration. Complete v30 live qualification is retained; current v31 recovery compatibility, CI and review are tracked explicitly.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-08 07:35:26 -05:00

48 lines
2.5 KiB
JavaScript

import profiles from "../acpx-profiles.json" with { type: "json" };
import { materializePinnedCursorDistribution } from "./materialize-cursor-distribution.mjs";
const CANDIDATES = new Set(["cursor", "copilot", "pi"]);
/** Only materialized providers enter the serialized manifest and its digest. */
export function providerPackManifestFields(providers, candidates) {
return {
...(providers.cursor || providers.copilot ? { providers: { ...(providers.cursor ? { cursor: providers.cursor } : {}), ...(providers.copilot ? { copilot: providers.copilot } : {}) } } : {}),
...(candidates.length ? { candidateProviders: Object.fromEntries(candidates.filter(provider => provider !== "copilot").map(provider => [provider, providers[provider]])) } : {}),
};
}
export function providerPackProviders(platform, architecture, candidates) {
const cursorSupported = ["darwin-arm64", "darwin-x64", "linux-x64"].includes(`${platform}-${architecture}`);
return [...new Set([...(cursorSupported ? ["cursor", "copilot"] : []), ...candidates])];
}
export function parseProviderPackArguments(args) {
let output;
const candidates = [];
for (const value of args.filter(value => value !== "--")) {
if (value.startsWith("--candidate-providers=")) {
for (const provider of value.slice("--candidate-providers=".length).split(",").filter(Boolean)) {
if (!CANDIDATES.has(provider) || candidates.includes(provider)) throw new Error("Unknown or duplicate candidate provider");
candidates.push(provider);
}
} else if (value.startsWith("--") || output !== undefined) throw new Error("Invalid provider-pack arguments");
else output = value;
}
return { output, candidates };
}
/** Closed source-owned builder registry; provider branches add their exact pins. */
export async function materializeCandidateProviderPack({ provider, outputRoot }) {
if (!CANDIDATES.has(provider)) throw new Error("Unknown candidate provider");
if (provider === "copilot") {
const { buildPinnedCopilotDistribution } = await import("./build-copilot-distribution.mjs");
return buildPinnedCopilotDistribution({ outputRoot });
}
if (provider === "cursor") {
const result = await materializePinnedCursorDistribution({ destination: outputRoot });
return { version: result.version,
profileDigest: profiles.profiles.cursor.commandDigest,
closureDigest: `sha256:${result.closureSha256}` };
}
throw new Error(`The ${provider} candidate distribution builder is not included in this source revision`);
}