Files
openclaw/extensions/copilot/index.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

36 lines
1.0 KiB
TypeScript

import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
import { createCopilotAgentHarness } from "./harness.js";
function isRecord(value: unknown): value is Record<string, unknown> {
return typeof value === "object" && value !== null && !Array.isArray(value);
}
function readPoolOptions(pluginConfig: unknown): { idleTtlMs: number } | undefined {
if (!isRecord(pluginConfig)) {
return undefined;
}
const pool = pluginConfig.pool;
if (!isRecord(pool)) {
return undefined;
}
const idleTtlMs = pool.idleTtlMs;
if (typeof idleTtlMs !== "number" || !Number.isFinite(idleTtlMs) || idleTtlMs < 1) {
return undefined;
}
return { idleTtlMs };
}
export default definePluginEntry({
id: "copilot",
name: "GitHub Copilot agent runtime",
description: "Registers the GitHub Copilot agent runtime.",
register(api) {
const poolOptions = readPoolOptions(api.pluginConfig);
api.registerAgentHarness(createCopilotAgentHarness(poolOptions ? { poolOptions } : undefined));
},
});