@tpsdev-ai/flair 0.4.12 → 0.4.14
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 +21 -27
- 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,28 +427,9 @@ 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
|
|
423
|
-
try {
|
|
424
|
-
const lsof = execSync(`lsof -ti :${httpPort}`, { encoding: "utf-8" }).trim();
|
|
425
|
-
if (lsof)
|
|
426
|
-
for (const pid of lsof.split("\n"))
|
|
427
|
-
try {
|
|
428
|
-
process.kill(Number(pid.trim()), "SIGTERM");
|
|
429
|
-
}
|
|
430
|
-
catch { }
|
|
431
|
-
await new Promise(r => setTimeout(r, 1000));
|
|
432
|
-
}
|
|
433
|
-
catch { }
|
|
434
|
-
execSync(`launchctl load "${plistPath}"`, { stdio: "pipe" });
|
|
435
|
-
await waitForHealth(httpPort, adminUser, adminPass, STARTUP_TIMEOUT_MS);
|
|
430
|
+
writeFileSync(plistPath, plist);
|
|
436
431
|
console.log("Launchd service registered ✓");
|
|
437
432
|
}
|
|
438
|
-
catch (err) {
|
|
439
|
-
console.log(`Note: launchd registration failed (${err.message}) — Harper is running but won't auto-start on reboot`);
|
|
440
|
-
}
|
|
441
433
|
}
|
|
442
434
|
}
|
|
443
435
|
// Persist port to config so other commands can find this instance
|
|
@@ -1148,6 +1140,8 @@ program
|
|
|
1148
1140
|
}
|
|
1149
1141
|
catch { }
|
|
1150
1142
|
}
|
|
1143
|
+
// Wait for process to release file handles (RocksDB)
|
|
1144
|
+
await new Promise(r => setTimeout(r, 2000));
|
|
1151
1145
|
console.log("✅ Flair process stopped");
|
|
1152
1146
|
}
|
|
1153
1147
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tpsdev-ai/flair",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.14",
|
|
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",
|