mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-02 02:30:43 +01:00
Finish Copilot production setup on current master
Preserve the reviewed candidate source and mainline provider behavior. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
cc1670aa56
commit
aaa65bbfbf
74 files changed
+57873
-251
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { Agent } from "@paperclipai/shared";
|
||||
import { copilotTaskModelCatalogOptions } from "./copilot-task-model-catalog";
|
||||
|
||||
describe("Copilot task model catalog identity", () => {
|
||||
const agent = { id: "copilot", adapterType: "paperclip_runner", adapterConfig: {
|
||||
provider: "acpx", acpxAgent: "copilot",
|
||||
} } as unknown as Agent;
|
||||
it("changes the catalog identity when a saved connection changes", () => {
|
||||
const a = copilotTaskModelCatalogOptions({ ...agent, runtimeConfig: { aiConnection: {
|
||||
provider: "github", method: "api_key", mode: "shared", connectionId: "11111111-1111-4111-8111-111111111111", grantId: "33333333-3333-4333-8333-333333333333",
|
||||
} } });
|
||||
const b = copilotTaskModelCatalogOptions({ ...agent, runtimeConfig: { aiConnection: {
|
||||
provider: "github", method: "api_key", mode: "shared", connectionId: "22222222-2222-4222-8222-222222222222", grantId: "33333333-3333-4333-8333-333333333333",
|
||||
} } });
|
||||
expect(a).not.toEqual(b);
|
||||
});
|
||||
it("allows normal responsible-user discovery when no explicit binding is saved", () => {
|
||||
expect(copilotTaskModelCatalogOptions(agent)).toEqual({ acpxAgent: "copilot", agentId: "copilot", aiConnection: undefined });
|
||||
});
|
||||
it("does not change catalogs for other runners", () => {
|
||||
expect(copilotTaskModelCatalogOptions({ ...agent, adapterConfig: { provider: "acpx", acpxAgent: "claude" } })).toBeUndefined();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
import { aiConnectionBindingSchema, type Agent } from "@paperclipai/shared";
|
||||
|
||||
/** Task overrides must discover models through the assignee's saved connection. */
|
||||
export function copilotTaskModelCatalogOptions(agent: Agent | null | undefined) {
|
||||
if (agent?.adapterType !== "paperclip_runner"
|
||||
|| agent.adapterConfig.provider !== "acpx"
|
||||
|| agent.adapterConfig.acpxAgent !== "copilot") return undefined;
|
||||
return {
|
||||
acpxAgent: "copilot",
|
||||
agentId: agent.id,
|
||||
aiConnection: aiConnectionBindingSchema.safeParse(agent.runtimeConfig?.aiConnection).data,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user