mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-01 15:35:12 +01:00
Add the Kimi lifecycle and recovery qualification harness. Preserve original grades and cleanup evidence, strict native ownership audits, bounded startup and cleanup, and early rejection of unsupported local fault execution before credentials or resources. Co-Authored-By: Paperclip <noreply@paperclip.ing>
53 lines
2.7 KiB
TypeScript
53 lines
2.7 KiB
TypeScript
import type { MatrixExecution } from "./types.js";
|
|
import { supportsKimiLocalProviderFault } from "./kimi-local-provider-fault.js";
|
|
|
|
/** Explicit-only profiles blocked until complete identity/auth/session/billing qualification. */
|
|
export const PENDING_PROFILE_PREREQUISITES = {
|
|
"legacy-kimi-cli": "Kimi CLI identity/auth/skills/session/billing qualification is pending",
|
|
"legacy-kimi-acp": "Kimi ACP identity/auth/skills/session/billing qualification is pending",
|
|
"legacy-grok": "Grok identity/auth/skills/session/billing qualification is pending",
|
|
} as const;
|
|
|
|
/** Qualification fixtures use explicit models; there is no runtime model roster. */
|
|
export const UNQUALIFIED_PROFILE_GAPS = {
|
|
} as const;
|
|
|
|
/** Reject missing remote observer authority before creating a company or run. */
|
|
export function assertRemoteNativeEvidencePrerequisites(
|
|
executions: readonly MatrixExecution[],
|
|
environment: NodeJS.ProcessEnv,
|
|
): void {
|
|
if (!executions.some(execution => execution.environment.id === "daytona"
|
|
&& ["cursor_native", "pi_native", "pi_controls", "copilot_protection", "native_active_stop", "native_provider_loss", "kimi_native_lifecycle"].includes(execution.task.flow))) return;
|
|
const names = ["PAPERCLIP_E2E_DAYTONA_NODE_SHA256", "PAPERCLIP_E2E_DAYTONA_RUNNERD_SHA256"];
|
|
const invalid = names.filter(name => !/^sha256:[a-f0-9]{64}$/u.test(environment[name] ?? ""));
|
|
if (invalid.length) throw new Error(`Native Daytona evidence requires exact image executable digests: ${invalid.join(", ")}`);
|
|
}
|
|
|
|
export function assertRunnerE2EPrerequisites(
|
|
executions: readonly MatrixExecution[],
|
|
host: Pick<NodeJS.Process, "platform" | "arch"> = process,
|
|
): void {
|
|
if (!supportsKimiLocalProviderFault(host) && executions.some(execution =>
|
|
execution.environment.id === "local" && execution.profile.qualificationCandidate === "kimi"
|
|
&& execution.task.id === "native-write-provider-loss")) {
|
|
throw new Error(
|
|
`Local native Kimi provider-loss qualification requires darwin-arm64; selected host is ${host.platform}-${host.arch}. `
|
|
+ "Use its qualified local host or the Linux Daytona cell. No provider credentials were loaded or sent, and no execution resources were acquired.",
|
|
);
|
|
}
|
|
const blocked = [...new Set(
|
|
executions
|
|
.map((execution) => execution.profile.id)
|
|
.filter((profileId): profileId is keyof typeof PENDING_PROFILE_PREREQUISITES =>
|
|
profileId in PENDING_PROFILE_PREREQUISITES,
|
|
),
|
|
)];
|
|
if (blocked.length === 0) return;
|
|
throw new Error(
|
|
`Selected runner E2E profile prerequisite(s) are pending: ${blocked
|
|
.map((profileId) => `${profileId} (${PENDING_PROFILE_PREREQUISITES[profileId]})`)
|
|
.join("; ")}. No provider credentials were loaded or sent.`,
|
|
);
|
|
}
|