Files
openclaw/extensions/copilot/doctor-contract-api.test.ts
Ramrajprabu f3cfd752d3 feat(copilot): add GitHub Copilot agent runtime
Adds the opt-in bundled GitHub Copilot agent runtime, pinned SDK install path, docs/inventory, SDK/tool/sandbox/auth wiring, and replay/tool-safety fixes.

Verification:
- Local: git diff --check; fnm exec --using 24.15.0 pnpm tsgo:extensions; fnm exec --using 24.15.0 pnpm check:test-types; fnm exec --using 24.15.0 pnpm build.
- Autoreview local: clean for the replay-safety fix; branch autoreview engine returned empty output twice, so local autoreview plus local/Crabbox/CI proof was used.
- Crabbox focused Copilot: run_2c0db9f48a4a, 19 files / 485 tests passed.
- Crabbox additional boundary shard: run_26a246a1aa24, prompt snapshots and plugin SDK boundary/export checks passed.
- Crabbox live Copilot: run_d128e4048b4e, real gpt-4.1 turn with live_echo phase-1-green and clean session-file check.
- GitHub checks: green on head 7cc8657e0d, including Dependency Guard after exact-head approval.

Co-authored-by: Ramraj Balasubramanian <ramrajba@microsoft.com>
2026-05-29 05:15:22 +01:00

43 lines
1.6 KiB
TypeScript
Executable File

import { describe, expect, it } from "vitest";
import {
legacyConfigRules,
normalizeCompatibilityConfig,
sessionRouteStateOwners,
} from "./doctor-contract-api.js";
describe("copilot doctor contract", () => {
it("has no legacy config rules at MVP (no retired fields exist yet)", () => {
expect(legacyConfigRules).toEqual([]);
});
it("normalizeCompatibilityConfig is a structural no-op when no migrations apply", () => {
const cfg = {
plugins: {
entries: { copilot: { enabled: true, config: { pool: { idleTtlMs: 12345 } } } },
},
} as unknown as Parameters<typeof normalizeCompatibilityConfig>[0]["cfg"];
const result = normalizeCompatibilityConfig({ cfg });
expect(result.config).toBe(cfg);
expect(result.changes).toEqual([]);
});
it("declares exactly one session route state owner for copilot", () => {
expect(sessionRouteStateOwners).toHaveLength(1);
const owner = sessionRouteStateOwners[0];
expect(owner.id).toBe("copilot");
expect(owner.label).toBe("GitHub Copilot agent runtime");
});
it("claims the subscription Copilot providers (matches attempt.ts SUPPORTED_PROVIDERS)", () => {
const owner = sessionRouteStateOwners[0];
expect(owner.providerIds).toEqual(["github-copilot"]);
});
it("claims the copilot runtime, session key, and auth profile prefix", () => {
const owner = sessionRouteStateOwners[0];
expect(owner.runtimeIds).toEqual(["copilot"]);
expect(owner.cliSessionKeys).toEqual(["copilot"]);
expect(owner.authProfilePrefixes).toEqual(["github-copilot:"]);
});
});