feat: default new Codex agents to the qualified Paperclip Runner

Resolve creation intent across onboarding, hires, imports, and the UI. Preserve existing execution and qualify automatic defaults for shipped Linux x64 artifacts.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-09 10:12:15 -05:00
1 parent 835a022936
commit aa879604ae
91 files changed
+2718 -884

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
import { describe, expect, it } from "vitest";
import { agentHarnessType, agentRunner, paperclipRunnerProfileForHarness, paperclipRunnerSupportsPlatform } from "./agent-runner.js";
import { createAgentSchema, updateAgentSchema, testAdapterEnvironmentSchema } from "./validators/agent.js";
describe("Codex creation runner contract", () => {
it("graduates only Codex and retains saved provider identity", () => {
expect(paperclipRunnerProfileForHarness("codex_local")).toEqual({ provider: "codex" });
for (const harness of ["claude_local", "opencode_local", "grok_local", "cursor", "pi_local", "process"]) expect(paperclipRunnerProfileForHarness(harness)).toBeUndefined();
expect(agentHarnessType("paperclip_runner", { provider: "codex" })).toBe("codex_local");
expect(agentHarnessType("paperclip_runner", { provider: "acpx", acpxAgent: "claude" })).toBe("claude_local");
expect(agentHarnessType("paperclip_runner", { provider: "unknown" })).toBe("unknown");
expect(agentHarnessType("paperclip_runner", { provider: "acpx", acpxAgent: "unknown" })).toBe("acpx:unknown");
expect(agentRunner("codex_local")).toBe("legacy");
expect(agentRunner("paperclip_runner")).toBe("paperclip");
});
it("qualifies only the daemon actually shipped in public server packages", () => {
expect(paperclipRunnerSupportsPlatform("codex_local", "linux", "x64")).toBe(true);
for (const [platform, architecture] of [["darwin", "arm64"], ["darwin", "x64"], ["linux", "arm64"], ["win32", "x64"], ["freebsd", "x64"]]) expect(paperclipRunnerSupportsPlatform("codex_local", platform, architecture)).toBe(false);
});
it("keeps auto out of saved update defaults and validates request intent", () => {
expect(createAgentSchema.parse({ name: "Codex", adapterType: "codex_local" }).runner).toBeUndefined();
expect(updateAgentSchema.parse({ title: "same execution" })).not.toHaveProperty("runner");
expect(testAdapterEnvironmentSchema.parse({ runner: "legacy" }).runner).toBe("legacy");
expect(createAgentSchema.safeParse({ name: "Codex", adapterType: "codex_local", runner: "other" }).success).toBe(false);
});
});
+35
View File
@@ -0,0 +1,35 @@
/** Request intent only. Agents persist the selected adapter, not an automatic choice. */
export type AgentRunnerChoice = "auto" | "paperclip" | "legacy";
export type AgentRunner = Exclude<AgentRunnerChoice, "auto">;
export interface AgentRunnerAvailability {
supportedRunners: AgentRunner[];
defaultRunner: AgentRunner;
}
/** Codex is the only harness whose creation default graduates in this release. */
export function paperclipRunnerProfileForHarness(harness: string): { provider: "codex" } | undefined {
return harness === "codex_local" ? { provider: "codex" } : undefined;
}
/** Public server packages currently ship a Linux x64 daemon; source-build targets are not release qualification. */
export function paperclipRunnerSupportsPlatform(harness: string, platform: string, architecture: string): boolean {
return !!paperclipRunnerProfileForHarness(harness)
&& platform === "linux" && architecture === "x64";
}
/** Recover harness identity without changing execution or guessing unknown providers. */
export function agentHarnessType(adapterType: string, config: Record<string, unknown> = {}): string {
if (adapterType !== "paperclip_runner") return adapterType;
if (config.provider === undefined || config.provider === "codex") return "codex_local";
if (config.provider === "opencode") return "opencode_local";
if (config.provider === "acpx") {
const agent = config.acpxAgent ?? "claude";
return ({ codex: "codex_local", claude: "claude_local", grok: "grok_local", cursor: "cursor", pi: "pi_local" } as Record<string, string>)[String(agent)] ?? `acpx:${String(agent)}`;
}
return String(config.provider);
}
export function agentRunner(adapterType: string): AgentRunner {
return adapterType === "paperclip_runner" ? "paperclip" : "legacy";
}
+1
View File
@@ -2858,3 +2858,4 @@ export { updatePrimaryAgentSchema, type UpdatePrimaryAgent, type PrimaryAgentPre
export * from "./agent-avatar-upload.js";
export type { DotBinding, DotInvitation, DotConnection, DotPairing } from "./dot-invitations.js";
export { agentHarnessType, agentRunner, paperclipRunnerProfileForHarness, paperclipRunnerSupportsPlatform, type AgentRunnerChoice, type AgentRunner, type AgentRunnerAvailability } from "./agent-runner.js";
@@ -1,4 +1,5 @@
import type { AgentAppearance } from "../agent-appearance.js";
import type { AgentRunnerChoice } from "../agent-runner.js";
import type { AgentEnvConfig } from "./secrets.js";
import type { RoutineVariable } from "./routine.js";
import type { IssueCommentAuthorType, PermissionKey } from "../constants.js";
@@ -211,6 +212,7 @@ export interface CompanyPortabilityIssueManifestEntry {
}
export interface CompanyPortabilityAgentManifestEntry {
runner?: AgentRunnerChoice;
slug: string;
name: string;
path: string;
@@ -387,6 +389,7 @@ export interface CompanyPortabilityPreviewResult {
}
export interface CompanyPortabilityAdapterOverride {
runner?: AgentRunnerChoice;
adapterType: string;
adapterConfig?: Record<string, unknown>;
}
+3
View File
@@ -94,6 +94,7 @@ export const createAgentSchema = z.object({
capabilities: z.string().optional().nullable(),
desiredSkills: z.array(agentDesiredSkillSelectionSchema).optional(),
adapterType: agentAdapterTypeSchema,
runner: z.enum(["auto", "paperclip", "legacy"]).optional(),
adapterConfig: adapterConfigSchema.optional().default({}),
instructionsBundle: createAgentInstructionsBundleSchema.optional(),
runtimeConfig: agentRuntimeConfigSchema.optional().default({}),
@@ -122,6 +123,7 @@ export type CreateAgent = z.infer<typeof createAgentSchema>;
export const builtInAgentProvisionSchema = z.object({
adapterType: agentAdapterTypeSchema.optional(),
runner: z.enum(["auto", "paperclip", "legacy"]).optional(),
adapterConfig: adapterConfigSchema.optional(),
budgetMonthlyCents: z.number().int().nonnegative().optional(),
}).strict();
@@ -257,6 +259,7 @@ export const resetAgentSessionSchema = z.object({
export type ResetAgentSession = z.infer<typeof resetAgentSessionSchema>;
export const testAdapterEnvironmentSchema = z.object({
runner: z.enum(["auto", "paperclip", "legacy"]).optional(),
aiConnection: aiConnectionBindingSchema.optional(),
/** Saved agent whose redacted environment entries are restored for this probe. */
agentId: z.string().guid().optional(),
@@ -71,6 +71,7 @@ export const portabilityBlobManifestEntrySchema = z.object({
});
export const portabilityAgentManifestEntrySchema = z.object({
runner: z.enum(["auto", "paperclip", "legacy"]).optional(),
slug: z.string().min(1),
name: z.string().min(1),
path: z.string().min(1),
@@ -324,6 +325,7 @@ export const companyPortabilityPreviewSchema = z.object({
export type CompanyPortabilityPreview = z.infer<typeof companyPortabilityPreviewSchema>;
export const portabilityAdapterOverrideSchema = z.object({
runner: z.enum(["auto", "paperclip", "legacy"]).optional(),
adapterType: z.string().min(1),
adapterConfig: z.record(z.string(), z.unknown()).optional(),
});