heyio 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/copilot/client.js +10 -3
- package/package.json +1 -1
package/dist/copilot/client.js
CHANGED
|
@@ -2,10 +2,17 @@ import { CopilotClient } from "@github/copilot-sdk";
|
|
|
2
2
|
let client;
|
|
3
3
|
export async function getClient() {
|
|
4
4
|
if (!client) {
|
|
5
|
-
|
|
5
|
+
const opts = {
|
|
6
6
|
autoStart: true,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
};
|
|
8
|
+
// Pass explicit token if available (env vars are also auto-detected by the SDK)
|
|
9
|
+
const token = process.env.COPILOT_GITHUB_TOKEN
|
|
10
|
+
|| process.env.GH_TOKEN
|
|
11
|
+
|| process.env.GITHUB_TOKEN;
|
|
12
|
+
if (token) {
|
|
13
|
+
opts.githubToken = token;
|
|
14
|
+
}
|
|
15
|
+
client = new CopilotClient(opts);
|
|
9
16
|
await client.start();
|
|
10
17
|
}
|
|
11
18
|
return client;
|