@lightupai/polaris 0.0.98 → 0.0.99

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli/cli.ts +23 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightupai/polaris",
3
- "version": "0.0.98",
3
+ "version": "0.0.99",
4
4
  "description": "Record and stream Claude Code sessions to Slack. Like Gong for AI coding — capture every prompt, response, and tool call. Multiplayer collaboration across AI coding agents.",
5
5
  "keywords": [
6
6
  "claude-code",
package/src/cli/cli.ts CHANGED
@@ -182,6 +182,11 @@ const SYSTEMD_USER_DIR = join(homedir(), ".config", "systemd", "user");
182
182
  const SYSTEMD_SERVICE_FILE = join(SYSTEMD_USER_DIR, `${SYSTEMD_SERVICE_NAME}.service`);
183
183
 
184
184
  async function installSystemdService(daemonSecret?: string): Promise<void> {
185
+ // Resolve bun's absolute path at install time so systemd's minimal PATH
186
+ // doesn't matter. Bun.which() searches PATH; process.execPath is the
187
+ // interpreter we're already running under — use whichever looks like bun.
188
+ const bunPath = Bun.which("bun") ?? process.execPath;
189
+
185
190
  const binDir = join(POLARIS_DIR, "bin");
186
191
  const runnerPath = join(binDir, "run-daemon.sh");
187
192
  const daemonTsPath = join(
@@ -189,15 +194,12 @@ async function installSystemdService(daemonSecret?: string): Promise<void> {
189
194
  );
190
195
 
191
196
  await mkdir(binDir, { recursive: true });
192
- // Runner searches common bun install locations — systemd user units inherit a
193
- // minimal PATH that may not include ~/.bun/bin
197
+ // Bun path is baked in at install time — no runtime search needed
194
198
  const runner = [
195
199
  "#!/bin/sh",
196
200
  `# Polaris daemon — managed by systemd (${SYSTEMD_SERVICE_NAME}.service)`,
197
- `for BUNPATH in "$HOME/.bun/bin/bun" /usr/local/bin/bun /usr/bin/bun; do`,
198
- ` [ -x "$BUNPATH" ] && break`,
199
- `done`,
200
- `exec "$BUNPATH" run "${daemonTsPath}"`,
201
+ `# bun path resolved at install time: ${bunPath}`,
202
+ `exec "${bunPath}" run "${daemonTsPath}"`,
201
203
  ].join("\n") + "\n";
202
204
  await writeFile(runnerPath, runner);
203
205
  await chmod(runnerPath, 0o755);
@@ -222,12 +224,24 @@ WantedBy=default.target
222
224
  await mkdir(SYSTEMD_USER_DIR, { recursive: true });
223
225
  await writeFile(SYSTEMD_SERVICE_FILE, unit);
224
226
 
227
+ // Stop any existing manually-started daemon so it releases port 4322
228
+ // before systemd takes over
229
+ await killExistingDaemon();
230
+
225
231
  // Reload unit files, enable (start-at-login) and start/restart the service
226
232
  Bun.spawnSync(["systemctl", "--user", "daemon-reload"], { stdout: "ignore", stderr: "ignore" });
227
233
  Bun.spawnSync(["systemctl", "--user", "enable", SYSTEMD_SERVICE_NAME], { stdout: "ignore", stderr: "ignore" });
228
- const start = Bun.spawnSync(["systemctl", "--user", "restart", SYSTEMD_SERVICE_NAME], { stdout: "pipe", stderr: "pipe" });
229
- if (start.exitCode !== 0) {
230
- console.error(` Warning: could not start daemon service: ${start.stderr.toString().trim()}`);
234
+ Bun.spawnSync(["systemctl", "--user", "restart", SYSTEMD_SERVICE_NAME], { stdout: "ignore", stderr: "ignore" });
235
+
236
+ // Verify the service came up
237
+ const check = Bun.spawnSync(["systemctl", "--user", "is-active", SYSTEMD_SERVICE_NAME], { stdout: "pipe", stderr: "ignore" });
238
+ if (check.stdout.toString().trim() !== "active") {
239
+ console.error(` Warning: daemon service did not start. Check logs:`);
240
+ const journal = Bun.spawnSync(
241
+ ["journalctl", "--user", "-u", SYSTEMD_SERVICE_NAME, "-n", "10", "--no-pager"],
242
+ { stdout: "pipe", stderr: "ignore" }
243
+ );
244
+ console.error(journal.stdout.toString().trim());
231
245
  console.error(` Try manually: systemctl --user restart ${SYSTEMD_SERVICE_NAME}`);
232
246
  }
233
247