heyio 0.1.3 → 0.1.5

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/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,14 +5,26 @@ import { dirname, join } from "path";
5
5
  const PACKAGE_NAME = "heyio";
6
6
  function getInstalledVersion() {
7
7
  try {
8
- // Resolve package.json relative to this file: dist/update.js ../package.json
9
- const __dirname = dirname(fileURLToPath(import.meta.url));
10
- const pkgPath = join(__dirname, "..", "package.json");
11
- const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
12
- return pkg.version ?? "0.0.0";
8
+ // Ask npm what version is installed globally — run from /tmp to avoid local package interference
9
+ const output = execSync(`npm list -g ${PACKAGE_NAME} --depth=0 --json 2>/dev/null`, {
10
+ encoding: "utf-8",
11
+ timeout: 10_000,
12
+ cwd: "/tmp",
13
+ });
14
+ const data = JSON.parse(output);
15
+ return data.dependencies?.[PACKAGE_NAME]?.version ?? "0.0.0";
13
16
  }
14
17
  catch {
15
- return "0.0.0";
18
+ // Fallback: read package.json relative to this file
19
+ try {
20
+ const __dirname = dirname(fileURLToPath(import.meta.url));
21
+ const pkgPath = join(__dirname, "..", "package.json");
22
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
23
+ return pkg.version ?? "0.0.0";
24
+ }
25
+ catch {
26
+ return "0.0.0";
27
+ }
16
28
  }
17
29
  }
18
30
  export async function checkForUpdate() {
@@ -21,6 +33,7 @@ export async function checkForUpdate() {
21
33
  const latest = execSync(`npm view ${PACKAGE_NAME} version 2>/dev/null`, {
22
34
  encoding: "utf-8",
23
35
  timeout: 10_000,
36
+ cwd: "/tmp",
24
37
  }).trim();
25
38
  if (!latest)
26
39
  return { updateAvailable: false, current, latest: current };
@@ -45,6 +58,7 @@ export async function autoUpdate() {
45
58
  encoding: "utf-8",
46
59
  timeout: 60_000,
47
60
  stdio: "pipe",
61
+ cwd: "/tmp",
48
62
  });
49
63
  console.log(`[io] ✓ Updated to v${info.latest}. Restarting...`);
50
64
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heyio",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "IO — a personal AI assistant built on the GitHub Copilot SDK",
5
5
  "bin": {
6
6
  "io": "dist/index.js"