Add OpenClaw Paperclip API URL override for onboarding

This commit is contained in:
Dotta
2026-03-06 08:39:29 -06:00
parent 854e818b74
commit b213eb695b
6 changed files with 101 additions and 1 deletions

View File

@@ -45,6 +45,8 @@ describe("buildInviteOnboardingTextDocument", () => {
expect(text).toContain("Suggested Paperclip base URLs to try");
expect(text).toContain("http://localhost:3100");
expect(text).toContain("host.docker.internal");
expect(text).toContain("paperclipApiUrl");
expect(text).toContain("set the first reachable candidate as agentDefaultsPayload.paperclipApiUrl");
});
it("includes loopback diagnostics for authenticated/private onboarding", () => {

View File

@@ -198,6 +198,31 @@ describe("openclaw adapter execute", () => {
expect(text).toContain("PAPERCLIP_LINKED_ISSUE_IDS=issue-123");
});
it("uses paperclipApiUrl override when provided", async () => {
const fetchMock = vi.fn().mockResolvedValue(
sseResponse([
"event: response.completed\n",
'data: {"type":"response.completed","status":"completed"}\n\n',
]),
);
vi.stubGlobal("fetch", fetchMock);
const result = await execute(
buildContext({
url: "https://agent.example/sse",
method: "POST",
paperclipApiUrl: "http://dotta-macbook-pro:3100",
}),
);
expect(result.exitCode).toBe(0);
const body = JSON.parse(String(fetchMock.mock.calls[0]?.[1]?.body ?? "{}")) as Record<string, unknown>;
const paperclip = body.paperclip as Record<string, unknown>;
const env = paperclip.env as Record<string, unknown>;
expect(env.PAPERCLIP_API_URL).toBe("http://dotta-macbook-pro:3100/");
expect(String(body.text ?? "")).toContain("PAPERCLIP_API_URL=http://dotta-macbook-pro:3100/");
});
it("derives issue session keys when configured", async () => {
const fetchMock = vi.fn().mockResolvedValue(
sseResponse([