Desktop app that records your on-screen work session and uses the GitHub Copilot SDK to reconstruct it as an intent + ordered steps, then builds a reusable Skill or Automation for Microsoft Autopilots like Scout, Microsoft Copilot Cowork, or Copilot Studio.
TypeScript agent-skillsai-agentsautomationcopilotcopilot-clicopilot-coworkcopilot-studioelectronmicrosoft-scoutscreen-recording
Fix Copilot SDK CLI path resolution in bundled Electron context
Adi Leibowitz (from Dev Box)a44998aac258
diff --git a/electron/describer/describer.ts b/electron/describer/describer.tsindex 32fbeab..f84bd52 100644--- a/electron/describer/describer.ts+++ b/electron/describer/describer.ts@@ -1,7 +1,8 @@import { existsSync, readFileSync, writeFileSync } from "node:fs";+import { createRequire } from "node:module";import path from "node:path";-import { approveAll, CopilotClient, type CopilotSession } from "@github/copilot-sdk";+import { approveAll, CopilotClient, type CopilotSession, RuntimeConnection } from "@github/copilot-sdk";import {AnalysisSchema,@@ -19,6 +20,33 @@ import { DESCRIBER_INSTRUCTIONS } from "./instructions";import { createDescriberTools } from "./tools";const log = createLogger("Describer");+const require = createRequire(import.meta.url);++/**+ * Resolve the path to the bundled Copilot CLI binary. The SDK's own resolution+ * (`getBundledCliPath`) uses `import.meta.resolve` relative to its bundle location,+ * which fails when the SDK is externalized by Vite (the bundle lives in dist-electron/+ * but node_modules is a sibling). We resolve it ourselves via createRequire anchored+ * to *this* file's pre-bundle location, which correctly finds node_modules.+ */+function resolveCopilotCliPath(): string | undefined {+ const platform = process.platform === "win32" ? "win32" : process.platform === "darwin" ? "darwin" : "linux";+ const arch = process.arch;+ const packageName = `@github/copilot-${platform}-${arch}`;+ try {+ // The package's main export points directly to the native binary (e.g. copilot.exe)+ const resolved = require.resolve(packageName);+ if (existsSync(resolved)) return resolved;+ } catch {}+ // Fallback: look for copilot binary by known path in node_modules+ try {+ const pkgDir = path.dirname(require.resolve(`${packageName}/package.json`));+ const binName = process.platform === "win32" ? "copilot.exe" : "copilot";+ const binPath = path.join(pkgDir, binName);+ if (existsSync(binPath)) return binPath;+ } catch {}+ return undefined;+}/** How long a single agent turn may run before we give up (multi-tool loop). */const TURN_TIMEOUT_MS = 180_000;@@ -195,7 +223,9 @@ export class Describer {if (this.client) return this.client;if (this.clientStart) return this.clientStart;this.clientStart = (async () => {- const client = new CopilotClient();+ const cliPath = resolveCopilotCliPath();+ if (cliPath) log.info("CLI path:", cliPath);+ const client = new CopilotClient(cliPath ? { connection: RuntimeConnection.forStdio({ path: cliPath }) } : undefined);await client.start();const auth = await client.getAuthStatus();if (!auth.isAuthenticated) {