mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-29 06:50:43 +01:00
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - The Harness / Runtime settings page (`/agents/:id/runtime`) lets
people choose or change an agent's harness, model, AI connection, and
execution environment
> - Qualified native ACPX harnesses (`antigravity_runtime` and
`copilot_runtime`) appeared in the New Agent wizard, but
`AdapterTypeDropdown` in `AgentConfigForm` only listed top-level UI
adapters plus `openai_dot` and `muse`
> - People configuring an agent on `/agents/:id/runtime` could not find
Google Antigravity or GitHub Copilot in the Harness dropdown, and
existing Antigravity agents displayed as `Paperclip Runner` instead of
their own harness and logo
> - This pull request exposes qualified `antigravity_runtime` and
`copilot_runtime` entries directly in `AdapterTypeDropdown`, hides the
redundant inner Runner/ACP pickers when selected, and persists the
native `paperclip_runner` ACPX configuration cleanly
> - The benefit is that people can configure and switch agents to
Antigravity or Copilot directly from `/agents/:id/runtime` across local,
Daytona, and Unikraft environments
## Linked Issues or Issue Description
**What existing behavior does this improve?**
Harness selection and display on the agent Harness / Runtime settings
page (`/agents/:id/runtime`).
**Subsystem affected**
UI: `AgentConfigForm` (`AdapterTypeDropdown`) and `AdapterMark`
(`ui/src/components/`).
**Current behavior**
The Harness dropdown on `/agents/:id/runtime` omits Google Antigravity
(`antigravity_runtime`) and GitHub Copilot (`copilot_runtime`). Existing
Antigravity agents show `Paperclip Runner` with nested `ACP agents`
pickers instead of `Google Antigravity` with its logo.
**Proposed behavior**
Qualified native ACPX harnesses (`Google Antigravity` and `GitHub
Copilot`) appear directly in the Harness dropdown with their logos,
gated by qualification, server adapter disablement, and Cloud
`availableHarnesses` policy. Selecting one persists `adapterType:
"paperclip_runner"` with `{ provider: "acpx", acpxAgent: "antigravity" |
"copilot", lifecycleMode: "per_turn" }`, exposes all supported
environments (including Daytona and Unikraft plugin computers), and
hides redundant inner Runner/ACP pickers.
**Reason and benefit**
Matches the New Agent picker so users configuring an agent from
`/agents/:id/runtime` see consistent harness choices, logos, model
pickers, and environment options without needing the experimental
`enableNativeRunner` flag.
**Breaking changes**
None. Existing `paperclip_runner` agent records keep the same schema and
stored `adapterConfig`.
## What Changed
- Added qualified `antigravity_runtime` and `copilot_runtime` options to
`AdapterTypeDropdown` in `ui/src/components/AgentConfigForm.tsx`,
respecting server `disabledTypes` and Cloud `availableHarnesses` policy
without requiring `enableNativeRunner`.
- Mapped saved `antigravity_runtime` and `copilot_runtime`
`paperclip_runner` agents to display as their dedicated harness in
`AdapterTypeDropdown`, hid redundant inner Runner/ACP pickers
(`hideRunnerHarness`), and guarded against no-op re-selection clearing
the current model.
- Handled selecting `antigravity_runtime` or `copilot_runtime` in create
and edit modes by setting `adapterType: "paperclip_runner"` and `{
provider: "acpx", acpxAgent, lifecycleMode: "per_turn" }`.
- Fixed a latent bug in `adapterPickerDisabledTypes` where
`disabledTypes` (an array from `useDisabledAdaptersSync`) was checked
with `.has(...)` instead of a `Set`.
- Added `copilot_runtime` light/dark brand icons to
`ui/src/components/AdapterMark.tsx`.
- Added render tests in
`ui/src/components/AgentConfigForm.render.test.tsx` covering Antigravity
selection, logo rendering, Daytona/Unikraft environment availability,
native ACPX save payload, and display of existing Antigravity agents.
## Verification
- `pnpm exec vitest run
ui/src/components/AgentConfigForm.render.test.tsx
ui/src/components/AgentConfigForm.test.ts
ui/src/adapters/codex-local/config-fields.test.tsx` — 58/58 passed.
- `pnpm exec vitest run ui/src/` — 578 test files (7,191 tests) passed.
- `pnpm --filter @paperclipai/ui typecheck` — passed (including
Storybook catalog check).
## Risks
- Low risk. UI-only harness selection change; server-side validation,
Cloud `availableHarnesses` enforcement, and stored `adapterConfig`
format remain unchanged.
## Model Used
- Google Gemini (Antigravity agent with tool use and code execution).
## Checklist
- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
---------
Co-authored-by: Paperclip <noreply@paperclip.ing>
481 lines
18 KiB
TypeScript
481 lines
18 KiB
TypeScript
// @vitest-environment jsdom
|
|
import { createRoot, type Root } from "react-dom/client";
|
|
import { flushSync } from "react-dom";
|
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
import type { Agent, Environment } from "@paperclipai/shared";
|
|
import { getEnvironmentCapabilities } from "@paperclipai/shared";
|
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
import { ToastProvider } from "../context/ToastContext";
|
|
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";
|
|
import type { AdapterConfigFieldsProps } from "../adapters/types";
|
|
|
|
const mockAgentsApi = vi.hoisted(() => ({
|
|
get: vi.fn(),
|
|
adapterModels: vi.fn(),
|
|
detectModel: vi.fn(),
|
|
list: vi.fn(),
|
|
testEnvironment: vi.fn(),
|
|
qualifyRunner: vi.fn(),
|
|
startAdapterAuthLogin: vi.fn(),
|
|
getAdapterAuthLoginStatus: vi.fn(),
|
|
getActiveAdapterAuthLoginSession: vi.fn(),
|
|
cancelAdapterAuthLogin: vi.fn(),
|
|
startClaudeSetupTokenLogin: vi.fn(),
|
|
getClaudeSetupTokenLoginStatus: vi.fn(),
|
|
getActiveClaudeSetupTokenLoginSession: vi.fn(),
|
|
getClaudeSetupTokenLoginPrompt: vi.fn(),
|
|
submitClaudeSetupTokenBrowserCode: vi.fn(),
|
|
completeClaudeSetupTokenLogin: vi.fn(),
|
|
cancelClaudeSetupTokenLogin: vi.fn(),
|
|
getClaudeOAuthTokenStatus: vi.fn(),
|
|
}));
|
|
|
|
const mockEnvironmentsApi = vi.hoisted(() => ({
|
|
list: vi.fn(),
|
|
capabilities: vi.fn(),
|
|
probe: vi.fn(),
|
|
}));
|
|
|
|
const mockInstanceSettingsApi = vi.hoisted(() => ({
|
|
get: vi.fn(),
|
|
getExperimental: vi.fn(),
|
|
getGeneral: vi.fn(),
|
|
}));
|
|
|
|
const mockSecretsApi = vi.hoisted(() => ({
|
|
list: vi.fn(),
|
|
listProposals: vi.fn(),
|
|
listUserSecretDefinitions: vi.fn(async () => [] as unknown[]),
|
|
}));
|
|
|
|
const mockAdaptersApi = vi.hoisted(() => ({
|
|
list: vi.fn(async () => [{ type: "codex_local", supportedRunners: ["legacy", "paperclip"], defaultRunner: "legacy" }]),
|
|
}));
|
|
|
|
vi.mock("../api/agents", () => ({ agentsApi: mockAgentsApi }));
|
|
vi.mock("../api/grokBot", () => ({
|
|
grokBotApi: { connection: async () => ({ enabled: true, canConfigureConnection: true, binding: null }) },
|
|
}));
|
|
vi.mock("../api/adapters", () => ({ adaptersApi: mockAdaptersApi }));
|
|
vi.mock("../api/environments", () => ({ environmentsApi: mockEnvironmentsApi }));
|
|
vi.mock("../api/instanceSettings", () => ({ instanceSettingsApi: mockInstanceSettingsApi }));
|
|
vi.mock("../api/secrets", () => ({ secretsApi: mockSecretsApi }));
|
|
vi.mock("../lib/clipboard", () => ({ copyTextToClipboard: vi.fn() }));
|
|
vi.mock("../context/CompanyContext", () => ({
|
|
useCompany: () => ({
|
|
companies: [{ id: "company-1", name: "Paperclip", issuePrefix: "CO" }],
|
|
selectedCompanyId: "company-1",
|
|
selectedCompany: { id: "company-1", name: "Paperclip", issuePrefix: "CO" },
|
|
selectionSource: "bootstrap",
|
|
loading: false,
|
|
error: null,
|
|
setSelectedCompanyId: vi.fn(),
|
|
reloadCompanies: vi.fn(),
|
|
createCompany: vi.fn(),
|
|
}),
|
|
}));
|
|
vi.mock("../adapters", () => ({
|
|
getUIAdapter: (type: string) => ({
|
|
type,
|
|
label: "Codex",
|
|
ConfigFields: (props: AdapterConfigFieldsProps) =>
|
|
type === "paperclip_runner" ? <CodexLocalConfigFields {...props} /> : <div data-testid="adapter-config-fields" />,
|
|
buildAdapterConfig: (values: { model?: string }) => ({ model: values.model || undefined }),
|
|
parseStdoutLine: () => [],
|
|
}),
|
|
}));
|
|
vi.mock("../adapters/use-adapter-capabilities", () => ({
|
|
useAdapterCapabilities: () => () => ({
|
|
supportsInstructionsBundle: true,
|
|
supportsSkills: true,
|
|
supportsLocalAgentJwt: true,
|
|
requiresMaterializedRuntimeSkills: false,
|
|
supportsAcp: true,
|
|
login: { panelMode: "displayed_code", timeoutPolicy: "caller_bounded" },
|
|
}),
|
|
}));
|
|
vi.mock("../adapters/use-disabled-adapters", () => ({ useDisabledAdaptersSync: () => [] }));
|
|
vi.mock("./MarkdownEditor", () => ({
|
|
MarkdownEditor: ({ value, onChange, placeholder }: { value: string; onChange: (value: string) => void; placeholder?: string }) => (
|
|
<textarea aria-label={placeholder ?? "Markdown"} value={value} onChange={(event) => onChange(event.currentTarget.value)} />
|
|
),
|
|
}));
|
|
|
|
async function act(callback: () => void | Promise<void>) {
|
|
let result: void | Promise<void> = undefined;
|
|
flushSync(() => {
|
|
result = callback();
|
|
});
|
|
await result;
|
|
}
|
|
|
|
async function flushReact() {
|
|
await act(async () => {
|
|
for (let i = 0; i < 4; i += 1) {
|
|
await Promise.resolve();
|
|
await new Promise((resolve) => window.setTimeout(resolve, 0));
|
|
}
|
|
});
|
|
}
|
|
|
|
function makeAgent(overrides: Partial<Agent> = {}): Agent {
|
|
return {
|
|
id: "agent-1",
|
|
companyId: "company-1",
|
|
name: "Cody",
|
|
role: "Engineer",
|
|
title: null,
|
|
icon: null,
|
|
status: "idle",
|
|
reportsTo: null,
|
|
capabilities: null,
|
|
adapterType: "codex_local",
|
|
adapterConfig: {},
|
|
runtimeConfig: {},
|
|
defaultEnvironmentId: null,
|
|
contextMode: "thin",
|
|
budgetMonthlyCents: 0,
|
|
spentMonthlyCents: 0,
|
|
permissions: {},
|
|
lastHeartbeatAt: null,
|
|
metadata: null,
|
|
createdAt: new Date(0),
|
|
updatedAt: new Date(0),
|
|
...overrides,
|
|
} as Agent;
|
|
}
|
|
|
|
function makeEnvironment(overrides: Partial<Environment>): Environment {
|
|
return {
|
|
id: "env-1",
|
|
name: "Local",
|
|
description: null,
|
|
driver: "local",
|
|
status: "active",
|
|
config: {},
|
|
envVars: {},
|
|
metadata: null,
|
|
createdAt: new Date(0),
|
|
updatedAt: new Date(0),
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
const AUTH_MISSING_RESULT = {
|
|
adapterType: "codex_local",
|
|
status: "fail",
|
|
checks: [{ code: "adapter_auth_missing", level: "error", message: "The sandbox has no ready authentication." }],
|
|
testedAt: new Date(0).toISOString(),
|
|
};
|
|
|
|
const SANDBOX_CAPABILITIES = getEnvironmentCapabilities(["claude_local", "codex_local"], {
|
|
sandboxProviders: { daytona: { supportsLoginPty: true, displayName: "Daytona" } },
|
|
});
|
|
|
|
function noActiveSession() {
|
|
return Promise.reject(
|
|
new ApiError("Adapter login session not found", 404, { error: "Adapter login session not found" }),
|
|
);
|
|
}
|
|
|
|
async function clickByText(container: HTMLElement, label: string) {
|
|
const button = Array.from(container.querySelectorAll("button")).find((b) => b.textContent?.trim() === label);
|
|
await act(async () => {
|
|
button?.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
});
|
|
await flushReact();
|
|
}
|
|
|
|
describe("AgentConfigForm session replay masking", () => {
|
|
let roots: Root[] = [];
|
|
|
|
beforeEach(() => {
|
|
mockEnvironmentsApi.list.mockResolvedValue([
|
|
makeEnvironment({ id: "local-1", name: "Local", driver: "local" }),
|
|
makeEnvironment({ id: "sandbox-1", name: "Daytona", driver: "sandbox", config: { provider: "daytona" } }),
|
|
]);
|
|
mockEnvironmentsApi.capabilities.mockResolvedValue(SANDBOX_CAPABILITIES);
|
|
mockAgentsApi.adapterModels.mockResolvedValue([]);
|
|
mockAgentsApi.detectModel.mockResolvedValue(null);
|
|
mockAgentsApi.list.mockResolvedValue([]);
|
|
mockAgentsApi.testEnvironment.mockResolvedValue(AUTH_MISSING_RESULT);
|
|
mockInstanceSettingsApi.get.mockResolvedValue({ defaultEnvironmentId: null });
|
|
mockInstanceSettingsApi.getExperimental.mockResolvedValue({ enableEnvironments: true });
|
|
mockInstanceSettingsApi.getGeneral.mockResolvedValue({ executionMode: "any" });
|
|
mockSecretsApi.list.mockResolvedValue([]);
|
|
mockSecretsApi.listProposals.mockResolvedValue([]);
|
|
mockAgentsApi.getActiveAdapterAuthLoginSession.mockImplementation(noActiveSession);
|
|
mockAgentsApi.getActiveClaudeSetupTokenLoginSession.mockImplementation(noActiveSession);
|
|
mockAgentsApi.startAdapterAuthLogin.mockResolvedValue({
|
|
sessionId: "session-1",
|
|
environmentId: "sandbox-1",
|
|
status: "starting",
|
|
expiresAt: null,
|
|
failure: null,
|
|
});
|
|
mockAgentsApi.getAdapterAuthLoginStatus.mockResolvedValue({
|
|
sessionId: "session-1",
|
|
environmentId: "sandbox-1",
|
|
status: "waiting_for_user",
|
|
expiresAt: null,
|
|
failure: null,
|
|
prompt: { url: "https://auth.example.test/device", code: "WXYZ-1234" },
|
|
});
|
|
});
|
|
|
|
afterEach(async () => {
|
|
for (const root of roots) {
|
|
await act(async () => root.unmount());
|
|
}
|
|
roots = [];
|
|
document.body.innerHTML = "";
|
|
vi.clearAllMocks();
|
|
});
|
|
|
|
it("blocks the displayed login code from session replay", 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(
|
|
<QueryClientProvider client={queryClient}>
|
|
<ToastProvider>
|
|
<TooltipProvider>
|
|
<AgentConfigForm
|
|
mode="edit"
|
|
agent={makeAgent({ defaultEnvironmentId: "sandbox-1" })}
|
|
onSave={vi.fn()}
|
|
hidePromptTemplate
|
|
showAdapterTypeField={false}
|
|
showAdapterTestEnvironmentButton
|
|
/>
|
|
</TooltipProvider>
|
|
</ToastProvider>
|
|
</QueryClientProvider>,
|
|
);
|
|
});
|
|
await flushReact();
|
|
|
|
await clickByText(container, "Test");
|
|
await clickByText(container, "Sign in");
|
|
await flushReact();
|
|
|
|
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(
|
|
<QueryClientProvider client={queryClient}>
|
|
<ToastProvider>
|
|
<TooltipProvider>
|
|
<AgentConfigForm
|
|
mode="edit"
|
|
agent={makeAgent({ adapterType: "process", adapterConfig: {} })}
|
|
onSave={onSave}
|
|
hidePromptTemplate
|
|
showAdapterTypeField
|
|
/>
|
|
</TooltipProvider>
|
|
</ToastProvider>
|
|
</QueryClientProvider>,
|
|
);
|
|
});
|
|
await flushReact();
|
|
|
|
const harnessTrigger = container.querySelector<HTMLButtonElement>('button[aria-label="Harness"]');
|
|
expect(harnessTrigger).not.toBeNull();
|
|
await act(async () => {
|
|
harnessTrigger!.click();
|
|
});
|
|
await flushReact();
|
|
|
|
const antigravityOption = Array.from(document.body.querySelectorAll<HTMLElement>('[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<HTMLButtonElement>("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(
|
|
<QueryClientProvider client={queryClient}>
|
|
<ToastProvider>
|
|
<TooltipProvider>
|
|
<AgentConfigForm
|
|
mode="edit"
|
|
agent={makeAgent({
|
|
adapterType: "paperclip_runner",
|
|
adapterConfig: { provider: "acpx", acpxAgent: "antigravity", model: "gemini-3.8-flash-low", lifecycleMode: "per_turn" },
|
|
})}
|
|
onSave={vi.fn()}
|
|
hidePromptTemplate
|
|
showAdapterTypeField
|
|
/>
|
|
</TooltipProvider>
|
|
</ToastProvider>
|
|
</QueryClientProvider>,
|
|
);
|
|
});
|
|
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(
|
|
<QueryClientProvider client={queryClient}>
|
|
<ToastProvider>
|
|
<TooltipProvider>
|
|
<AgentConfigForm
|
|
mode="edit"
|
|
agent={makeAgent({
|
|
adapterType: "paperclip_runner",
|
|
adapterConfig: { provider: "acpx", acpxAgent: "copilot", model: "gpt-5.4", lifecycleMode: "per_turn" },
|
|
})}
|
|
onSave={onSave}
|
|
hidePromptTemplate
|
|
showAdapterTypeField
|
|
/>
|
|
</TooltipProvider>
|
|
</ToastProvider>
|
|
</QueryClientProvider>,
|
|
);
|
|
});
|
|
await flushReact();
|
|
|
|
const harnessTrigger = container.querySelector<HTMLButtonElement>('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<HTMLElement>('[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(
|
|
<QueryClientProvider client={queryClient}>
|
|
<AdapterTypeDropdown value="codex_local" onChange={vi.fn()} disabledTypes={new Set()} />
|
|
</QueryClientProvider>,
|
|
);
|
|
});
|
|
await flushReact();
|
|
|
|
const trigger = container.querySelector<HTMLButtonElement>('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();
|
|
});
|
|
});
|