Files
openclaw/scripts/copy-copilot-sdk-manifest.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

62 lines
2.1 KiB
TypeScript

#!/usr/bin/env tsx
/**
* Copy the Copilot SDK install manifest (package.json + package-lock.json)
* from src/commands/copilot-sdk-install-manifest/ to dist/commands/copilot-sdk-install-manifest/.
*
* The Copilot agent runtime's on-demand SDK installer
* (src/commands/copilot-sdk-install.ts) resolves the manifest dir
* relative to its compiled location via `import.meta.url`. tsdown does
* not copy non-source files alongside compiled output, so we mirror the
* manifest here as part of the build chain. Mirrors the precedent set
* by scripts/copy-hook-metadata.ts.
*/
import fs from "node:fs";
import path from "node:path";
import { ensureDirectory, logVerboseCopy, resolveBuildCopyContext } from "./lib/copy-assets.ts";
const context = resolveBuildCopyContext(import.meta.url);
const SRC_MANIFEST_DIR = path.join(
context.projectRoot,
"src",
"commands",
"copilot-sdk-install-manifest",
);
const DIST_MANIFEST_DIR = path.join(
context.projectRoot,
"dist",
"commands",
"copilot-sdk-install-manifest",
);
const MANIFEST_FILES = ["package.json", "package-lock.json"];
function copyCopilotSdkManifest(): void {
if (!fs.existsSync(SRC_MANIFEST_DIR)) {
throw new Error(
`${context.prefix} Source manifest dir missing: ${SRC_MANIFEST_DIR}. This directory is part of the Copilot agent runtime pinned install graph and must exist in the repo.`,
);
}
ensureDirectory(DIST_MANIFEST_DIR);
for (const fileName of MANIFEST_FILES) {
const sourcePath = path.join(SRC_MANIFEST_DIR, fileName);
const destPath = path.join(DIST_MANIFEST_DIR, fileName);
if (!fs.existsSync(sourcePath)) {
throw new Error(
`${context.prefix} Missing manifest file ${sourcePath}. Re-generate with \`npm install --package-lock-only\` in src/commands/copilot-sdk-install-manifest/.`,
);
}
fs.copyFileSync(sourcePath, destPath);
logVerboseCopy(context, `Copied copilot-sdk-install-manifest/${fileName}`);
}
console.log(
`${context.prefix} Copied Copilot SDK install manifest (${MANIFEST_FILES.length} files).`,
);
}
copyCopilotSdkManifest();