@lightupai/polaris 0.0.97 → 0.0.98
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/.github/workflows/ci.yml +0 -26
- package/package.json +1 -1
- package/skills/polaris/SKILL.md +1 -1
- package/src/cli/cli.ts +94 -14
- package/src/client/client.ts +1 -1
package/.github/workflows/ci.yml
CHANGED
|
@@ -43,32 +43,6 @@ jobs:
|
|
|
43
43
|
|
|
44
44
|
- run: bun test
|
|
45
45
|
|
|
46
|
-
publish:
|
|
47
|
-
needs: test
|
|
48
|
-
runs-on: ubuntu-latest
|
|
49
|
-
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
|
50
|
-
|
|
51
|
-
steps:
|
|
52
|
-
- uses: actions/checkout@v4
|
|
53
|
-
|
|
54
|
-
- uses: oven-sh/setup-bun@v2
|
|
55
|
-
with:
|
|
56
|
-
bun-version: latest
|
|
57
|
-
|
|
58
|
-
- run: bun install
|
|
59
|
-
|
|
60
|
-
- name: Bump version from npm registry and publish
|
|
61
|
-
run: |
|
|
62
|
-
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
|
|
63
|
-
PUBLISHED=$(npm view @lightupai/polaris version 2>/dev/null || echo "0.0.0")
|
|
64
|
-
# Bump patch from the latest published version
|
|
65
|
-
IFS='.' read -r MAJOR MINOR PATCH <<< "$PUBLISHED"
|
|
66
|
-
NEW="$MAJOR.$MINOR.$((PATCH + 1))"
|
|
67
|
-
echo "Published: $PUBLISHED → Publishing: $NEW"
|
|
68
|
-
# Set version in package.json for this publish only (not committed)
|
|
69
|
-
npm version "$NEW" --no-git-tag-version
|
|
70
|
-
npm publish --access public
|
|
71
|
-
|
|
72
46
|
deploy:
|
|
73
47
|
needs: test
|
|
74
48
|
runs-on: ubuntu-latest
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightupai/polaris",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.98",
|
|
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/skills/polaris/SKILL.md
CHANGED
|
@@ -47,6 +47,6 @@ Based on the arguments provided, do ONE of the following:
|
|
|
47
47
|
|
|
48
48
|
### Daemon
|
|
49
49
|
|
|
50
|
-
The Polaris daemon runs locally and is managed automatically — do NOT
|
|
50
|
+
The Polaris daemon runs locally and is managed automatically — do NOT manually configure launchd or systemd. If the user reports the daemon is down or not starting at login, tell them to run `polaris install` which sets up auto-restart (launchd on macOS, systemd user service on Linux).
|
|
51
51
|
|
|
52
52
|
### Arguments: $ARGUMENTS
|
package/src/cli/cli.ts
CHANGED
|
@@ -107,16 +107,13 @@ function appToApi(appUrl: string): string {
|
|
|
107
107
|
return appUrl.replace("app.", "api.");
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
// ---
|
|
110
|
+
// --- Daemon auto-restart (macOS: launchd, Linux: systemd user service) ---
|
|
111
111
|
|
|
112
|
+
// macOS: LaunchAgent
|
|
112
113
|
const LAUNCH_AGENT_LABEL = "ai.withpolaris.daemon";
|
|
113
114
|
const LAUNCH_AGENT_PLIST = join(homedir(), "Library", "LaunchAgents", `${LAUNCH_AGENT_LABEL}.plist`);
|
|
114
115
|
|
|
115
|
-
// Writes a runner script + launchd plist so the daemon survives crashes and
|
|
116
|
-
// starts automatically at login. No-op on non-macOS platforms.
|
|
117
116
|
async function installLaunchAgent(daemonSecret?: string): Promise<void> {
|
|
118
|
-
if (process.platform !== "darwin") return;
|
|
119
|
-
|
|
120
117
|
const binDir = join(POLARIS_DIR, "bin");
|
|
121
118
|
const runnerPath = join(binDir, "run-daemon.sh");
|
|
122
119
|
const daemonTsPath = join(
|
|
@@ -175,11 +172,94 @@ async function installLaunchAgent(daemonSecret?: string): Promise<void> {
|
|
|
175
172
|
}
|
|
176
173
|
|
|
177
174
|
async function removeLaunchAgent(): Promise<void> {
|
|
178
|
-
if (process.platform !== "darwin") return;
|
|
179
175
|
Bun.spawnSync(["launchctl", "unload", "-w", LAUNCH_AGENT_PLIST], { stdout: "ignore", stderr: "ignore" });
|
|
180
176
|
try { await rm(LAUNCH_AGENT_PLIST); } catch { /* already gone */ }
|
|
181
177
|
}
|
|
182
178
|
|
|
179
|
+
// Linux: systemd user service
|
|
180
|
+
const SYSTEMD_SERVICE_NAME = "polaris-daemon";
|
|
181
|
+
const SYSTEMD_USER_DIR = join(homedir(), ".config", "systemd", "user");
|
|
182
|
+
const SYSTEMD_SERVICE_FILE = join(SYSTEMD_USER_DIR, `${SYSTEMD_SERVICE_NAME}.service`);
|
|
183
|
+
|
|
184
|
+
async function installSystemdService(daemonSecret?: string): Promise<void> {
|
|
185
|
+
const binDir = join(POLARIS_DIR, "bin");
|
|
186
|
+
const runnerPath = join(binDir, "run-daemon.sh");
|
|
187
|
+
const daemonTsPath = join(
|
|
188
|
+
POLARIS_DIR, "mcp", "node_modules", "@lightupai", "polaris", "src", "daemon", "daemon.ts"
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
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
|
|
194
|
+
const runner = [
|
|
195
|
+
"#!/bin/sh",
|
|
196
|
+
`# 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
|
+
].join("\n") + "\n";
|
|
202
|
+
await writeFile(runnerPath, runner);
|
|
203
|
+
await chmod(runnerPath, 0o755);
|
|
204
|
+
|
|
205
|
+
const secretLine = daemonSecret ? `Environment=POLARIS_DAEMON_SECRET=${daemonSecret}\n` : "";
|
|
206
|
+
const unit = `[Unit]
|
|
207
|
+
Description=Polaris daemon
|
|
208
|
+
After=network.target
|
|
209
|
+
|
|
210
|
+
[Service]
|
|
211
|
+
Type=simple
|
|
212
|
+
ExecStart=${runnerPath}
|
|
213
|
+
Restart=always
|
|
214
|
+
RestartSec=5
|
|
215
|
+
${secretLine}StandardOutput=append:/tmp/polaris-daemon.log
|
|
216
|
+
StandardError=append:/tmp/polaris-daemon.log
|
|
217
|
+
|
|
218
|
+
[Install]
|
|
219
|
+
WantedBy=default.target
|
|
220
|
+
`;
|
|
221
|
+
|
|
222
|
+
await mkdir(SYSTEMD_USER_DIR, { recursive: true });
|
|
223
|
+
await writeFile(SYSTEMD_SERVICE_FILE, unit);
|
|
224
|
+
|
|
225
|
+
// Reload unit files, enable (start-at-login) and start/restart the service
|
|
226
|
+
Bun.spawnSync(["systemctl", "--user", "daemon-reload"], { stdout: "ignore", stderr: "ignore" });
|
|
227
|
+
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()}`);
|
|
231
|
+
console.error(` Try manually: systemctl --user restart ${SYSTEMD_SERVICE_NAME}`);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Enable lingering so the user service survives logout and starts at boot
|
|
235
|
+
// (best-effort — requires sudo-less loginctl or appropriate privileges)
|
|
236
|
+
Bun.spawnSync(["loginctl", "enable-linger"], { stdout: "ignore", stderr: "ignore" });
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
async function removeSystemdService(): Promise<void> {
|
|
240
|
+
Bun.spawnSync(["systemctl", "--user", "disable", "--now", SYSTEMD_SERVICE_NAME], { stdout: "ignore", stderr: "ignore" });
|
|
241
|
+
try { await rm(SYSTEMD_SERVICE_FILE); } catch { /* already gone */ }
|
|
242
|
+
Bun.spawnSync(["systemctl", "--user", "daemon-reload"], { stdout: "ignore", stderr: "ignore" });
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Platform dispatcher
|
|
246
|
+
async function installDaemonService(daemonSecret?: string): Promise<void> {
|
|
247
|
+
if (process.platform === "darwin") return installLaunchAgent(daemonSecret);
|
|
248
|
+
if (process.platform === "linux") return installSystemdService(daemonSecret);
|
|
249
|
+
// Windows and others: no managed service; daemon is started manually
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
async function removeDaemonService(): Promise<void> {
|
|
253
|
+
if (process.platform === "darwin") return removeLaunchAgent();
|
|
254
|
+
if (process.platform === "linux") return removeSystemdService();
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function daemonServiceLabel(): string {
|
|
258
|
+
if (process.platform === "darwin") return "launchd (auto-restarts on crash, starts at login)";
|
|
259
|
+
if (process.platform === "linux") return "systemd user service (auto-restarts on crash, starts at login)";
|
|
260
|
+
return "background process";
|
|
261
|
+
}
|
|
262
|
+
|
|
183
263
|
// --- Daemon secret ---
|
|
184
264
|
|
|
185
265
|
// Shared local secret for daemon HTTP auth. Stored in ~/.polaris/config.json
|
|
@@ -347,7 +427,7 @@ Based on the arguments provided, do ONE of the following:
|
|
|
347
427
|
|
|
348
428
|
### Daemon
|
|
349
429
|
|
|
350
|
-
The Polaris daemon runs locally and is managed automatically — do NOT
|
|
430
|
+
The Polaris daemon runs locally and is managed automatically — do NOT manually configure launchd or systemd. If the user reports the daemon is down or not starting at login, tell them to run \`polaris install\` which sets up auto-restart (launchd on macOS, systemd user service on Linux).
|
|
351
431
|
|
|
352
432
|
### Arguments: $ARGUMENTS
|
|
353
433
|
`;
|
|
@@ -859,7 +939,7 @@ async function recover() {
|
|
|
859
939
|
|
|
860
940
|
async function logout(all = false) {
|
|
861
941
|
if (all) {
|
|
862
|
-
await
|
|
942
|
+
await removeDaemonService();
|
|
863
943
|
try {
|
|
864
944
|
await rm(POLARIS_DIR, { recursive: true });
|
|
865
945
|
console.log("All profiles and credentials removed.");
|
|
@@ -962,8 +1042,8 @@ switch (command) {
|
|
|
962
1042
|
case "install":
|
|
963
1043
|
console.log("Polaris — installing local components\n");
|
|
964
1044
|
await install();
|
|
965
|
-
await
|
|
966
|
-
console.log(
|
|
1045
|
+
await installDaemonService(await ensureDaemonSecret());
|
|
1046
|
+
console.log(` ✓ Daemon registered with ${daemonServiceLabel()}`);
|
|
967
1047
|
console.log("\nInstall complete.");
|
|
968
1048
|
break;
|
|
969
1049
|
|
|
@@ -973,8 +1053,8 @@ switch (command) {
|
|
|
973
1053
|
console.log("Polaris — authenticating\n");
|
|
974
1054
|
await login(appUrl, profileName);
|
|
975
1055
|
console.log("\n✓ Login complete!");
|
|
976
|
-
await
|
|
977
|
-
console.log(
|
|
1056
|
+
await installDaemonService(await ensureDaemonSecret());
|
|
1057
|
+
console.log(` ✓ Daemon registered with ${daemonServiceLabel()}`);
|
|
978
1058
|
|
|
979
1059
|
console.log("\nNext: restart Claude Code, then run `/polaris join #channel-name` in your AI agent.");
|
|
980
1060
|
break;
|
|
@@ -1027,8 +1107,8 @@ switch (command) {
|
|
|
1027
1107
|
console.log("[2/2] Authenticating...\n");
|
|
1028
1108
|
await login(DEFAULT_APP_URL);
|
|
1029
1109
|
console.log("\n✓ Polaris is set up on this machine!");
|
|
1030
|
-
await
|
|
1031
|
-
console.log(
|
|
1110
|
+
await installDaemonService(await ensureDaemonSecret());
|
|
1111
|
+
console.log(` ✓ Daemon registered with ${daemonServiceLabel()}`);
|
|
1032
1112
|
|
|
1033
1113
|
console.log("\nNext: restart Claude Code, then run `/polaris join #channel-name` in your AI agent.");
|
|
1034
1114
|
break;
|
package/src/client/client.ts
CHANGED
|
@@ -102,7 +102,7 @@ const mcp = new Server(
|
|
|
102
102
|
},
|
|
103
103
|
instructions: `You are connected to Polaris — a multiplayer collaboration system. Messages from advisors and teammates may arrive as <channel source="polaris" from="..."> tags. Use /polaris commands to manage your session, or call the polaris tools directly.
|
|
104
104
|
|
|
105
|
-
If the user reports the Polaris daemon is not running or keeps crashing, tell them to run \`polaris install\` — it registers the daemon with launchd
|
|
105
|
+
If the user reports the Polaris daemon is not running or keeps crashing, tell them to run \`polaris install\` — it registers the daemon with launchd on macOS or a systemd user service on Linux for auto-restart on crash and at login. Do NOT suggest manually configuring launchd or systemd — \`polaris install\` handles it.`,
|
|
106
106
|
}
|
|
107
107
|
);
|
|
108
108
|
|