@tpsdev-ai/flair 0.4.12 → 0.4.13
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/cli.js +40 -26
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -380,11 +380,22 @@ program
|
|
|
380
380
|
// Register launchd service on macOS so Harper survives reboots
|
|
381
381
|
// and `flair restart` / `flair stop` work via launchctl.
|
|
382
382
|
if (process.platform === "darwin") {
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
383
|
+
const harperBinPath = harperBin();
|
|
384
|
+
if (harperBinPath) {
|
|
385
|
+
const label = "ai.tpsdev.flair";
|
|
386
|
+
const plistDir = join(homedir(), "Library", "LaunchAgents");
|
|
387
|
+
mkdirSync(plistDir, { recursive: true });
|
|
388
|
+
const plistPath = join(plistDir, `${label}.plist`);
|
|
389
|
+
const opsSocket = join(dataDir, "operations-server");
|
|
390
|
+
const setConfig = JSON.stringify({
|
|
391
|
+
rootPath: dataDir,
|
|
392
|
+
http: { port: httpPort, cors: true, corsAccessList: [`http://127.0.0.1:${httpPort}`, `http://localhost:${httpPort}`] },
|
|
393
|
+
operationsApi: { network: { port: opsPort, cors: true }, domainSocket: opsSocket },
|
|
394
|
+
mqtt: { network: { port: null }, webSocket: false },
|
|
395
|
+
localStudio: { enabled: false },
|
|
396
|
+
authentication: { authorizeLocal: true, enableSessions: true },
|
|
397
|
+
});
|
|
398
|
+
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
388
399
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
389
400
|
<plist version="1.0">
|
|
390
401
|
<dict>
|
|
@@ -392,7 +403,7 @@ program
|
|
|
392
403
|
<key>ProgramArguments</key>
|
|
393
404
|
<array>
|
|
394
405
|
<string>${process.execPath}</string>
|
|
395
|
-
<string>${
|
|
406
|
+
<string>${harperBinPath}</string>
|
|
396
407
|
<string>run</string>
|
|
397
408
|
<string>.</string>
|
|
398
409
|
</array>
|
|
@@ -400,7 +411,7 @@ program
|
|
|
400
411
|
<key>EnvironmentVariables</key>
|
|
401
412
|
<dict>
|
|
402
413
|
<key>ROOTPATH</key><string>${dataDir}</string>
|
|
403
|
-
<key>HARPER_SET_CONFIG</key><string>${
|
|
414
|
+
<key>HARPER_SET_CONFIG</key><string>${setConfig.replace(/&/g, "&").replace(/</g, "<").replace(/"/g, """)}</string>
|
|
404
415
|
<key>DEFAULTS_MODE</key><string>dev</string>
|
|
405
416
|
<key>HDB_ADMIN_USERNAME</key><string>${adminUser}</string>
|
|
406
417
|
<key>HDB_ADMIN_PASSWORD</key><string>${adminPass}</string>
|
|
@@ -416,27 +427,28 @@ program
|
|
|
416
427
|
<key>StandardErrorPath</key><string>${join(dataDir, "log", "launchd-stderr.log")}</string>
|
|
417
428
|
</dict>
|
|
418
429
|
</plist>`;
|
|
419
|
-
|
|
420
|
-
try {
|
|
421
|
-
const { execSync } = await import("node:child_process");
|
|
422
|
-
// Stop the detached process — launchd will manage it from here
|
|
430
|
+
writeFileSync(plistPath, plist);
|
|
423
431
|
try {
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
+
const { execSync } = await import("node:child_process");
|
|
433
|
+
// Stop the detached process — launchd will manage it from here
|
|
434
|
+
try {
|
|
435
|
+
const lsof = execSync(`lsof -ti :${httpPort}`, { encoding: "utf-8" }).trim();
|
|
436
|
+
if (lsof)
|
|
437
|
+
for (const pid of lsof.split("\n"))
|
|
438
|
+
try {
|
|
439
|
+
process.kill(Number(pid.trim()), "SIGTERM");
|
|
440
|
+
}
|
|
441
|
+
catch { }
|
|
442
|
+
await new Promise(r => setTimeout(r, 1000));
|
|
443
|
+
}
|
|
444
|
+
catch { }
|
|
445
|
+
execSync(`launchctl load "${plistPath}"`, { stdio: "pipe" });
|
|
446
|
+
await waitForHealth(httpPort, adminUser, adminPass, STARTUP_TIMEOUT_MS);
|
|
447
|
+
console.log("Launchd service registered ✓");
|
|
448
|
+
}
|
|
449
|
+
catch (err) {
|
|
450
|
+
console.log(`Note: launchd registration failed (${err.message}) — Harper is running but won't auto-start on reboot`);
|
|
432
451
|
}
|
|
433
|
-
catch { }
|
|
434
|
-
execSync(`launchctl load "${plistPath}"`, { stdio: "pipe" });
|
|
435
|
-
await waitForHealth(httpPort, adminUser, adminPass, STARTUP_TIMEOUT_MS);
|
|
436
|
-
console.log("Launchd service registered ✓");
|
|
437
|
-
}
|
|
438
|
-
catch (err) {
|
|
439
|
-
console.log(`Note: launchd registration failed (${err.message}) — Harper is running but won't auto-start on reboot`);
|
|
440
452
|
}
|
|
441
453
|
}
|
|
442
454
|
}
|
|
@@ -1148,6 +1160,8 @@ program
|
|
|
1148
1160
|
}
|
|
1149
1161
|
catch { }
|
|
1150
1162
|
}
|
|
1163
|
+
// Wait for process to release file handles (RocksDB)
|
|
1164
|
+
await new Promise(r => setTimeout(r, 2000));
|
|
1151
1165
|
console.log("✅ Flair process stopped");
|
|
1152
1166
|
}
|
|
1153
1167
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tpsdev-ai/flair",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.13",
|
|
4
4
|
"description": "Identity, memory, and soul for AI agents. Cryptographic identity (Ed25519), semantic memory with local embeddings, and persistent personality — all in a single process.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|