diff --git a/ui/src/components/AdapterMark.tsx b/ui/src/components/AdapterMark.tsx index 8865b6e977d..ed82690b504 100644 --- a/ui/src/components/AdapterMark.tsx +++ b/ui/src/components/AdapterMark.tsx @@ -7,6 +7,10 @@ const brandMarks: Record = { codex_local: { src: "/brands/codex-color.svg" }, gemini_local: { src: "/brands/adapters/gemini-color.svg" }, antigravity_runtime: { src: "/brands/apps/antigravity.svg" }, + copilot_runtime: { + src: "/brands/apps/github-copilot.svg", + dark: "/brands/apps/github-copilot-dark.svg", + }, kimi_local: { src: "/brands/adapters/kimi-color-light.svg", dark: "/brands/adapters/kimi-color.svg", diff --git a/ui/src/components/AgentConfigForm.render.test.tsx b/ui/src/components/AgentConfigForm.render.test.tsx index 6766e864144..1b96a837463 100644 --- a/ui/src/components/AgentConfigForm.render.test.tsx +++ b/ui/src/components/AgentConfigForm.render.test.tsx @@ -7,7 +7,7 @@ import type { Agent, Environment } from "@paperclipai/shared"; import { getEnvironmentCapabilities } from "@paperclipai/shared"; import { TooltipProvider } from "@/components/ui/tooltip"; import { ToastProvider } from "../context/ToastContext"; -import { AgentConfigForm } from "./AgentConfigForm"; +import { AdapterTypeDropdown, AgentConfigForm } from "./AgentConfigForm"; import { isBlockedFromReplay } from "@/lib/analytics/replay-recording.test-utils"; import { ApiError } from "../api/client"; import { CodexLocalConfigFields } from "../adapters/codex-local/config-fields"; @@ -271,4 +271,210 @@ describe("AgentConfigForm session replay masking", () => { expect(isBlockedFromReplay("WXYZ-1234", document.body)).toBe(true); }); + + it("offers Google Antigravity in the Harness dropdown, displays its logo, exposes Daytona and Unikraft environments, and saves native ACPX config", async () => { + mockEnvironmentsApi.list.mockResolvedValue([ + makeEnvironment({ id: "local-1", name: "Local", driver: "local" }), + makeEnvironment({ id: "daytona-sbx", name: "Paperclip Sandbox", driver: "sandbox", config: { provider: "daytona" } }), + makeEnvironment({ id: "daytona-plugin", name: "Paperclip Sandbox (Daytona)", driver: "plugin", config: { pluginKey: "paperclip-cloud.plugin-agent-computer", driverKey: "daytona-tasks" } }), + makeEnvironment({ id: "unikraft-computer", name: "Paperclip Computer", driver: "plugin", config: { pluginKey: "paperclip-cloud.plugin-agent-computer", driverKey: "tasks" } }), + ]); + mockInstanceSettingsApi.getExperimental.mockResolvedValue({ + enableEnvironments: true, + enableNativeRunner: false, + }); + const onSave = vi.fn().mockResolvedValue(undefined); + const container = document.createElement("div"); + document.body.appendChild(container); + const root = createRoot(container); + roots.push(root); + const queryClient = new QueryClient({ + defaultOptions: { queries: { retry: false }, mutations: { retry: false } }, + }); + + await act(async () => { + root.render( + + + + + + + , + ); + }); + await flushReact(); + + const harnessTrigger = container.querySelector('button[aria-label="Harness"]'); + expect(harnessTrigger).not.toBeNull(); + await act(async () => { + harnessTrigger!.click(); + }); + await flushReact(); + + const antigravityOption = Array.from(document.body.querySelectorAll('[data-value="antigravity_runtime"]'))[0]; + expect(antigravityOption).toBeDefined(); + expect(antigravityOption!.textContent).toContain("Google Antigravity"); + expect(antigravityOption!.querySelector('img[src="/brands/apps/antigravity.svg"]')).not.toBeNull(); + + await act(async () => { + antigravityOption!.click(); + }); + await flushReact(); + + // Top Harness trigger displays Google Antigravity with its logo, and redundant inner ACP agent dropdown is hidden. + expect(container.querySelector('button[aria-label="Harness"]')?.textContent).toContain("Google Antigravity"); + expect(container.querySelector('button[aria-label="Harness"] img[src="/brands/apps/antigravity.svg"]')).not.toBeNull(); + expect(container.querySelector('button[aria-label="ACP agent"]')).toBeNull(); + + // Both Daytona sandbox/plugin and Unikraft Paperclip Computer environments are selectable. + const envTrigger = Array.from(container.querySelectorAll("button")).find( + (button) => button.textContent?.includes("Default: Local"), + ); + expect(envTrigger).toBeDefined(); + await act(async () => { + envTrigger!.click(); + }); + await flushReact(); + expect(document.body.textContent).toContain("Paperclip Sandbox"); + expect(document.body.textContent).toContain("Paperclip Sandbox (Daytona)"); + expect(document.body.textContent).toContain("Paperclip Computer"); + + await clickByText(container, "Save"); + expect(onSave).toHaveBeenCalledTimes(1); + expect(onSave).toHaveBeenCalledWith(expect.objectContaining({ + adapterType: "paperclip_runner", + replaceAdapterConfig: true, + adapterConfig: expect.objectContaining({ + provider: "acpx", + acpxAgent: "antigravity", + lifecycleMode: "per_turn", + }), + })); + }); + + it("displays an existing Antigravity paperclip_runner agent as Google Antigravity without exposing internal runner harness pickers", async () => { + const container = document.createElement("div"); + document.body.appendChild(container); + const root = createRoot(container); + roots.push(root); + const queryClient = new QueryClient({ + defaultOptions: { queries: { retry: false }, mutations: { retry: false } }, + }); + + await act(async () => { + root.render( + + + + + + + , + ); + }); + await flushReact(); + + expect(container.querySelector('button[aria-label="Harness"]')?.textContent).toContain("Google Antigravity"); + expect(container.querySelector('button[aria-label="Harness"] img[src="/brands/apps/antigravity.svg"]')).not.toBeNull(); + expect(container.querySelector('button[aria-label="ACP agent"]')).toBeNull(); + }); + + it("displays an existing Copilot paperclip_runner agent as GitHub Copilot and keeps its saved model on re-selection", async () => { + const onSave = vi.fn().mockResolvedValue(undefined); + const container = document.createElement("div"); + document.body.appendChild(container); + const root = createRoot(container); + roots.push(root); + const queryClient = new QueryClient({ + defaultOptions: { queries: { retry: false }, mutations: { retry: false } }, + }); + + await act(async () => { + root.render( + + + + + + + , + ); + }); + await flushReact(); + + const harnessTrigger = container.querySelector('button[aria-label="Harness"]'); + expect(harnessTrigger?.textContent).toContain("GitHub Copilot"); + expect(harnessTrigger?.querySelector('img[src="/brands/apps/github-copilot.svg"]')).not.toBeNull(); + expect(container.querySelector('button[aria-label="ACP agent"]')).toBeNull(); + expect(container.textContent).toContain("gpt-5.4"); + + await act(async () => { + harnessTrigger!.click(); + }); + await flushReact(); + const copilotOption = document.body.querySelector('[data-value="copilot_runtime"]'); + expect(copilotOption).not.toBeNull(); + await act(async () => { + copilotOption!.click(); + }); + await flushReact(); + + // Re-selecting the active Copilot harness is a no-op and preserves the saved model. + expect(container.textContent).toContain("gpt-5.4"); + expect(container.textContent).not.toContain("Unsaved changes"); + }); + + it("keeps native ACPX harnesses opt-in on AdapterTypeDropdown so raw adapter callers never offer them", async () => { + const container = document.createElement("div"); + document.body.appendChild(container); + const root = createRoot(container); + roots.push(root); + const queryClient = new QueryClient({ + defaultOptions: { queries: { retry: false }, mutations: { retry: false } }, + }); + + await act(async () => { + root.render( + + + , + ); + }); + await flushReact(); + + const trigger = container.querySelector('button[aria-label="Harness"]'); + expect(trigger).not.toBeNull(); + await act(async () => { + trigger!.click(); + }); + await flushReact(); + + expect(document.body.querySelector('[data-value="antigravity_runtime"]')).toBeNull(); + expect(document.body.querySelector('[data-value="copilot_runtime"]')).toBeNull(); + }); }); diff --git a/ui/src/components/AgentConfigForm.tsx b/ui/src/components/AgentConfigForm.tsx index 8ccc88bb8c4..1ff59529eee 100644 --- a/ui/src/components/AgentConfigForm.tsx +++ b/ui/src/components/AgentConfigForm.tsx @@ -2,7 +2,7 @@ import { environmentSupportsLoginPty } from "@paperclipai/shared"; import { matchesAdapterLoginTarget, useAdapterLoginCancellation } from "./useAdapterLoginCancellation"; import { ACCOUNT_BOUND_MODEL_DISCOVERY_QUERY_OPTIONS, antigravityModelGroup, isAccountBoundAcpxAgent } from "@/lib/native-model-catalog"; import { useConnectionModels } from "./ai-connections/useConnectionModels"; -import { agentHarnessType, agentRunner, paperclipRunnerProfileForHarness, normalizeClaudeRunnerOptions, type AgentRunnerChoice } from "@paperclipai/shared"; +import { agentHarnessName, agentHarnessType, agentRunner, paperclipRunnerProfileForHarness, normalizeClaudeRunnerOptions, type AgentRunnerChoice } from "@paperclipai/shared"; import { adaptersApi } from "../api/adapters"; import { canQualifyRunnerEnvironment, qualifyRunnerEnvironment } from "../lib/qualify-claude-setup"; import { aiRoutingHarness } from "@paperclipai/shared"; @@ -31,6 +31,7 @@ import type { SecretVersionSelector, } from "@paperclipai/shared"; import { AGENT_DEFAULT_MAX_CONCURRENT_RUNS, supportedEnvironmentDriversForAdapter, isValidBrowserCode, ADAPTER_AUTH_MISSING_CHECK_CODE } from "@paperclipai/shared"; +import { PAPERCLIP_RUNNER_ACPX_PROFILES } from "@paperclipai/adapter-utils"; import type { AdapterModel } from "../api/agents"; import { agentsApi } from "../api/agents"; import { ApiError } from "../api/client"; @@ -440,16 +441,21 @@ export function AgentConfigForm(props: AgentConfigFormProps) { queryFn: () => instanceSettingsApi.getExperimental(), }); const adapterPickerDisabledTypes = useMemo(() => { - const next = new Set(disabledTypes); + const raw = new Set(disabledTypes); + const next = new Set(raw); // Fail closed while settings load. Existing native agents still render // their current value in edit mode, but the picker does not offer a fresh // native selection until the explicit experimental opt-in is known true. if (experimentalSettings?.enableNativeRunner !== true) { next.add("paperclip_runner"); } - if (experimentalSettings?.enableOpenAiDot !== true || disabledTypes.has("paperclip_runner")) { + if (experimentalSettings?.enableOpenAiDot !== true || raw.has("paperclip_runner")) { next.add("openai_dot"); } + if (raw.has("paperclip_runner")) { + next.add("antigravity_runtime"); + next.add("copilot_runtime"); + } return next; }, [disabledTypes, experimentalSettings?.enableNativeRunner, experimentalSettings?.enableOpenAiDot]); const environmentsEnabled = experimentalSettings?.enableEnvironments === true; @@ -815,6 +821,10 @@ export function AgentConfigForm(props: AgentConfigFormProps) { const isDotRunner = runnerProvider === "openai_dot"; const isGrokBotRunner = runnerProvider === "grok_bot"; const isMuseRunner = runnerProvider === "muse"; + const productHarnessName = agentHarnessName(adapterType, effectiveConfig); + const isAntigravityRunner = adapterType === "paperclip_runner" && productHarnessName === "antigravity_runtime"; + const isCopilotRunner = adapterType === "paperclip_runner" && productHarnessName === "copilot_runtime"; + const isDedicatedAcpxRunner = isAntigravityRunner || isCopilotRunner; const isExternalRunner = isDotRunner || isGrokBotRunner || isMuseRunner; const showAdapterTestEnvironmentButton = !isGrokBotRunner && (props.showAdapterTestEnvironmentButton ?? true); const showInlineAdapterTestEnvironmentButton = @@ -1273,7 +1283,7 @@ export function AgentConfigForm(props: AgentConfigFormProps) { mode, isCreate, adapterType: fieldsAdapterType, - hideRunnerHarness: isRunnerHarness, + hideRunnerHarness: isRunnerHarness || isDedicatedAcpxRunner, values: isCreate ? { ...props.values, ...(runnerProfile && fieldsAdapterType === "paperclip_runner" ? { adapterSchemaValues: { ...props.values.adapterSchemaValues, ...runnerProfile } } : {}) } : null, set: isCreate ? (patch: Partial) => props.onChange(patch) : null, config: runnerProfile && fieldsAdapterType === "paperclip_runner" ? { ...config, ...runnerProfile } : config, @@ -2056,19 +2066,36 @@ export function AgentConfigForm(props: AgentConfigFormProps) { )} - {showAdapterTypeField && !isGrokBotRunner && ( + {showAdapterTypeField && !isGrokBotRunner && (() => { + const currentHarnessChoice = isDotRunner + ? "openai_dot" + : isMuseRunner + ? "muse" + : isAntigravityRunner + ? "antigravity_runtime" + : isCopilotRunner + ? "copilot_runtime" + : isRunnerHarness + ? harnessType + : adapterType; + return ( { + if (choice === currentHarnessChoice) return; const dot = choice === "openai_dot"; const muse = choice === "muse"; + const antigravity = choice === "antigravity_runtime"; + const copilot = choice === "copilot_runtime"; const external = dot || muse; - const t = external ? "paperclip_runner" : choice; + const dedicatedAcpx = antigravity || copilot; + const t = external || dedicatedAcpx ? "paperclip_runner" : choice; if (isCreate) { // Reset all adapter-specific fields to defaults when switching adapter type const { adapterType: _at, ...defaults } = defaultCreateValues; @@ -2090,6 +2117,13 @@ export function AgentConfigForm(props: AgentConfigFormProps) { if (external) { nextValues.model = ""; nextValues.adapterSchemaValues = { provider: muse ? "muse" : "openai_dot" }; + } else if (dedicatedAcpx) { + nextValues.model = ""; + nextValues.adapterSchemaValues = { + provider: "acpx", + acpxAgent: antigravity ? "antigravity" : "copilot", + lifecycleMode: "per_turn", + }; } set!(nextValues); } else { @@ -2109,16 +2143,18 @@ export function AgentConfigForm(props: AgentConfigFormProps) { ? DEFAULT_OPENCODE_LOCAL_MODEL : t === "cursor" ? DEFAULT_CURSOR_LOCAL_MODEL - : external ? "" + : external || dedicatedAcpx ? "" : t === "paperclip_runner" ? resolvePaperclipRunnerTransitionModel(adapterType, config.model) : "", - effort: "", - modelReasoningEffort: "", - variant: "", - mode: "", + effort: dedicatedAcpx ? undefined : "", + modelReasoningEffort: dedicatedAcpx ? undefined : "", + variant: dedicatedAcpx ? undefined : "", + mode: dedicatedAcpx ? undefined : "", ...(external ? { provider: muse ? "muse" : "openai_dot", lifecycleMode: "per_turn", allowUnmeteredProvider: false, ...(dot ? { dotAttachmentAccess: false, dotWorkspaceAccess: false } : {}) } + : dedicatedAcpx + ? { provider: "acpx", acpxAgent: antigravity ? "antigravity" : "copilot", lifecycleMode: "per_turn" } : t === "paperclip_runner" ? { ...paperclipRunnerTransitionConfig(adapterType, eff("adapterConfig", "model", config.model)), @@ -2130,7 +2166,8 @@ export function AgentConfigForm(props: AgentConfigFormProps) { }} /> - )} + ); + })()} {isRunnerHarness && runnerDiscoveryView.kind === "error" && ( void; @@ -4318,17 +4356,22 @@ export function AdapterTypeDropdown({ openAiDotEnabled?: boolean; museEnabled?: boolean; nativeRunnerEnabled?: boolean; + nativeAcpxHarnessesEnabled?: boolean; }) { const cloud = Boolean(useCloudInstance()); const harnessPolicy = useCloudHarnessPolicy(); const selectedDisplay = getAdapterDisplay(value); + const antigravityQualified = nativeAcpxHarnessesEnabled && PAPERCLIP_RUNNER_ACPX_PROFILES.some(profile => profile.value === "antigravity" && profile.qualified); + const copilotQualified = nativeAcpxHarnessesEnabled && PAPERCLIP_RUNNER_ACPX_PROFILES.some(profile => profile.value === "copilot" && profile.qualified); const adapterList = useMemo(() => [...listAdapterOptions(type => adapterLabels[type] ?? getAdapterLabel(type)), + ...(antigravityQualified ? [{ value: "antigravity_runtime", label: adapterLabels.antigravity_runtime ?? getAdapterLabel("antigravity_runtime"), experimental: false, comingSoon: false }] : []), + ...(copilotQualified ? [{ value: "copilot_runtime", label: adapterLabels.copilot_runtime ?? getAdapterLabel("copilot_runtime"), experimental: false, comingSoon: false }] : []), ...(openAiDotEnabled ? [{ value: "openai_dot", label: "OpenAI Dot", experimental: true, comingSoon: false }] : []), ...(museEnabled ? [{ value: "muse", label: "Muse — Personal agent", experimental: true, comingSoon: false }] : []), ].filter(item => (!cloud || harnessPolicy.isCloudHarnessAllowed(item.value)) && !item.comingSoon && (item.value !== "paperclip_runner" || nativeRunnerEnabled) && !disabledTypes.has(item.value)) .sort((a, b) => Number(a.value === "paperclip_runner") - Number(b.value === "paperclip_runner")), - [cloud, harnessPolicy, disabledTypes, openAiDotEnabled, nativeRunnerEnabled, museEnabled]); + [cloud, harnessPolicy, disabledTypes, openAiDotEnabled, nativeRunnerEnabled, museEnabled, antigravityQualified, copilotQualified]); return