The open-source app everyone uses to manage agents at work
TypeScript acpxagent-orchestrationagent-skillsagentic-aiai-agentsai-engineeringai-governanceai-toolsautonomous-agentsclaudeclaude-codeclaude-skillscodexhermesllmmcpmulti-agentopenclawproject-managementworkflow-automation
import { readdirSync, readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
import { QUALIFIED_ACPX_PROFILE_DATA } from "./generated-profiles.js";
import { isSupportedAcpxProfileVersion } from "./profile-compatibility.js";
describe("historical ACPX profile decoding", () => {
it("retains each provider's existing revision boundary", () => {
expect(isSupportedAcpxProfileVersion("copilot", 17)).toBe(true);
expect(isSupportedAcpxProfileVersion("pi", 17)).toBe(true);
expect(isSupportedAcpxProfileVersion("pi", 18)).toBe(true);
expect(isSupportedAcpxProfileVersion("pi", 23)).toBe(true);
expect(isSupportedAcpxProfileVersion("cursor", 15)).toBe(true);
expect(isSupportedAcpxProfileVersion("cursor", 16)).toBe(false);
for (const agent of ["pi", "copilot"]) {
expect(isSupportedAcpxProfileVersion(agent, 16)).toBe(true);
const current = QUALIFIED_ACPX_PROFILE_DATA[agent as "pi" | "copilot"].agentProfileVersion;
expect(isSupportedAcpxProfileVersion(agent, current)).toBe(true);
expect(isSupportedAcpxProfileVersion(agent, Math.max(16, current) + 1)).toBe(false);
}
for (const agent of ["claude", "codex", "grok"]) {
expect(isSupportedAcpxProfileVersion(agent, 5)).toBe(true);
expect(isSupportedAcpxProfileVersion(agent, 6)).toBe(false);
}
});
it("decodes retained Copilot revisions and the current profile without widening other providers", () => {
for (const version of [1, 5, 6, 12, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]) {
expect(isSupportedAcpxProfileVersion("copilot", version)).toBe(true);
}
expect(isSupportedAcpxProfileVersion("copilot", QUALIFIED_ACPX_PROFILE_DATA.copilot.agentProfileVersion + 1)).toBe(false);
// Preserve Pi history and its current mainline release without admitting the next profile.
expect(isSupportedAcpxProfileVersion("pi", 23)).toBe(true);
expect(isSupportedAcpxProfileVersion("pi", QUALIFIED_ACPX_PROFILE_DATA.pi.agentProfileVersion)).toBe(true);
expect(isSupportedAcpxProfileVersion("pi", QUALIFIED_ACPX_PROFILE_DATA.pi.agentProfileVersion + 1)).toBe(false);
for (const agent of ["cursor", "claude", "codex", "grok"]) {
expect(isSupportedAcpxProfileVersion(agent, 23)).toBe(false);
expect(isSupportedAcpxProfileVersion(agent, 24)).toBe(false);
expect(isSupportedAcpxProfileVersion(agent, 25)).toBe(false);
expect(isSupportedAcpxProfileVersion(agent, 26)).toBe(false);
expect(isSupportedAcpxProfileVersion(agent, 27)).toBe(false);
}
});
it("decodes every retained Copilot identity so saved runs can reach recovery", () => {
const root = new URL("../../../test/fixtures/", import.meta.url);
const files = readdirSync(root).filter(name => /^copilot-profile-v\d+.*-identity\.json$/u.test(name));
expect(files.length).toBeGreaterThan(30);
for (const file of files) {
const identity = JSON.parse(readFileSync(new URL(file, root), "utf8"));
expect(isSupportedAcpxProfileVersion("copilot", identity.declaration.agentProfileVersion), file).toBe(true);
}
});
it.each([0, 1.5, "11", null, undefined, NaN])("rejects invalid revisions: %s", version => {
expect(isSupportedAcpxProfileVersion("cursor", version)).toBe(false);
});
it("decodes every current release while retaining exact launch admission separately", () => {
for (const [agent, current] of Object.entries(QUALIFIED_ACPX_PROFILE_DATA)) {
expect(isSupportedAcpxProfileVersion(agent, current.agentProfileVersion)).toBe(true);
}
});
it.each(["unknown", "toString", "__proto__"])("rejects unregistered providers: %s", agent => {
expect(isSupportedAcpxProfileVersion(agent, 1)).toBe(false);
});
});