heyio 0.1.4 → 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.
@@ -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
- client = new CopilotClient({
5
+ const opts = {
6
6
  autoStart: true,
7
- autoRestart: true,
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;
package/dist/daemon.js CHANGED
@@ -44,17 +44,10 @@ function pruneOldSessions() {
44
44
  }
45
45
  export async function startDaemon() {
46
46
  console.log("[io] Starting IO daemon...");
47
- // Auto-update on startup
47
+ // Auto-update on startup — exit after update; systemd will restart us
48
48
  const updated = await autoUpdate();
49
49
  if (updated) {
50
- // Re-exec the process with the new version
51
- const { spawn } = await import("child_process");
52
- const child = spawn(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
53
- detached: true,
54
- stdio: "inherit",
55
- env: { ...process.env, IO_RESTARTED: "1" },
56
- });
57
- child.unref();
50
+ console.log("[io] Exiting for systemd restart with updated version...");
58
51
  process.exit(0);
59
52
  }
60
53
  if (config.selfEditEnabled) {
package/dist/update.js CHANGED
@@ -5,10 +5,11 @@ import { dirname, join } from "path";
5
5
  const PACKAGE_NAME = "heyio";
6
6
  function getInstalledVersion() {
7
7
  try {
8
- // Ask npm what version is installed globally — completely reliable
8
+ // Ask npm what version is installed globally — run from /tmp to avoid local package interference
9
9
  const output = execSync(`npm list -g ${PACKAGE_NAME} --depth=0 --json 2>/dev/null`, {
10
10
  encoding: "utf-8",
11
11
  timeout: 10_000,
12
+ cwd: "/tmp",
12
13
  });
13
14
  const data = JSON.parse(output);
14
15
  return data.dependencies?.[PACKAGE_NAME]?.version ?? "0.0.0";
@@ -32,6 +33,7 @@ export async function checkForUpdate() {
32
33
  const latest = execSync(`npm view ${PACKAGE_NAME} version 2>/dev/null`, {
33
34
  encoding: "utf-8",
34
35
  timeout: 10_000,
36
+ cwd: "/tmp",
35
37
  }).trim();
36
38
  if (!latest)
37
39
  return { updateAvailable: false, current, latest: current };
@@ -56,6 +58,7 @@ export async function autoUpdate() {
56
58
  encoding: "utf-8",
57
59
  timeout: 60_000,
58
60
  stdio: "pipe",
61
+ cwd: "/tmp",
59
62
  });
60
63
  console.log(`[io] ✓ Updated to v${info.latest}. Restarting...`);
61
64
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heyio",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "IO — a personal AI assistant built on the GitHub Copilot SDK",
5
5
  "bin": {
6
6
  "io": "dist/index.js"