@tpsdev-ai/flair 0.3.4 → 0.3.6
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 +13 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8,6 +8,7 @@ import { spawn } from "node:child_process";
|
|
|
8
8
|
import { createPrivateKey, sign as nodeCryptoSign, randomUUID } from "node:crypto";
|
|
9
9
|
// ─── Defaults ────────────────────────────────────────────────────────────────
|
|
10
10
|
const DEFAULT_PORT = 9926;
|
|
11
|
+
const DEFAULT_OPS_PORT = 9925;
|
|
11
12
|
const DEFAULT_ADMIN_USER = "admin";
|
|
12
13
|
const STARTUP_TIMEOUT_MS = 60_000;
|
|
13
14
|
const HEALTH_POLL_INTERVAL_MS = 500;
|
|
@@ -23,6 +24,10 @@ function privKeyPath(agentId, keysDir) {
|
|
|
23
24
|
function pubKeyPath(agentId, keysDir) {
|
|
24
25
|
return join(keysDir, `${agentId}.pub`);
|
|
25
26
|
}
|
|
27
|
+
function flairPackageDir() {
|
|
28
|
+
// dist/cli.js → package root (one level up from dist/)
|
|
29
|
+
return join(import.meta.dirname ?? __dirname, "..");
|
|
30
|
+
}
|
|
26
31
|
function harperBin() {
|
|
27
32
|
// Resolve relative to this file's location (dist/cli.js → ../node_modules/...)
|
|
28
33
|
const candidates = [
|
|
@@ -171,6 +176,7 @@ program
|
|
|
171
176
|
.description("Bootstrap a local Flair (Harper) instance for an agent")
|
|
172
177
|
.option("--agent-id <id>", "Agent ID to register", "local")
|
|
173
178
|
.option("--port <port>", "Harper HTTP port", String(DEFAULT_PORT))
|
|
179
|
+
.option("--ops-port <port>", "Harper operations API port")
|
|
174
180
|
.option("--admin-pass <pass>", "Admin password (generated if omitted)")
|
|
175
181
|
.option("--keys-dir <dir>", "Directory for Ed25519 keys")
|
|
176
182
|
.option("--data-dir <dir>", "Harper data directory")
|
|
@@ -178,7 +184,7 @@ program
|
|
|
178
184
|
.action(async (opts) => {
|
|
179
185
|
const agentId = opts.agentId;
|
|
180
186
|
const httpPort = Number(opts.port);
|
|
181
|
-
const opsPort =
|
|
187
|
+
const opsPort = opts.opsPort ? Number(opts.opsPort) : DEFAULT_OPS_PORT;
|
|
182
188
|
const keysDir = opts.keysDir ?? defaultKeysDir();
|
|
183
189
|
const dataDir = opts.dataDir ?? defaultDataDir();
|
|
184
190
|
// Admin password: generate if not provided, NEVER written to disk
|
|
@@ -220,7 +226,7 @@ program
|
|
|
220
226
|
console.log("Installing Harper...");
|
|
221
227
|
await new Promise((resolve, reject) => {
|
|
222
228
|
let output = "";
|
|
223
|
-
const install = spawn(process.execPath, [bin, "install"], { cwd:
|
|
229
|
+
const install = spawn(process.execPath, [bin, "install"], { cwd: flairPackageDir(), env });
|
|
224
230
|
install.stdout?.on("data", (d) => { output += d.toString(); });
|
|
225
231
|
install.stderr?.on("data", (d) => { output += d.toString(); });
|
|
226
232
|
install.on("exit", (code) => code === 0 ? resolve() : reject(new Error(`Harper install failed (${code}): ${output}`)));
|
|
@@ -229,7 +235,7 @@ program
|
|
|
229
235
|
});
|
|
230
236
|
// Start (detached)
|
|
231
237
|
console.log(`Starting Harper on port ${httpPort}...`);
|
|
232
|
-
const proc = spawn(process.execPath, [bin, "
|
|
238
|
+
const proc = spawn(process.execPath, [bin, "run", "."], { cwd: flairPackageDir(), env, detached: true, stdio: "ignore" });
|
|
233
239
|
proc.unref();
|
|
234
240
|
}
|
|
235
241
|
console.log("Waiting for Harper health check...");
|
|
@@ -292,7 +298,7 @@ agent
|
|
|
292
298
|
.option("--ops-port <port>", "Harper operations API port")
|
|
293
299
|
.action(async (id, opts) => {
|
|
294
300
|
const httpPort = Number(opts.port);
|
|
295
|
-
const opsPort = opts.opsPort ? Number(opts.opsPort) :
|
|
301
|
+
const opsPort = opts.opsPort ? Number(opts.opsPort) : DEFAULT_OPS_PORT;
|
|
296
302
|
const keysDir = opts.keysDir ?? defaultKeysDir();
|
|
297
303
|
const adminPass = opts.adminPass;
|
|
298
304
|
const adminUser = DEFAULT_ADMIN_USER;
|
|
@@ -342,7 +348,7 @@ agent
|
|
|
342
348
|
.option("--keys-dir <dir>", "Directory for Ed25519 keys")
|
|
343
349
|
.action(async (id, opts) => {
|
|
344
350
|
const httpPort = Number(opts.port);
|
|
345
|
-
const opsPort = opts.opsPort ? Number(opts.opsPort) :
|
|
351
|
+
const opsPort = opts.opsPort ? Number(opts.opsPort) : DEFAULT_OPS_PORT;
|
|
346
352
|
const adminPass = opts.adminPass ?? process.env.FLAIR_ADMIN_PASS ?? "";
|
|
347
353
|
const adminUser = DEFAULT_ADMIN_USER;
|
|
348
354
|
const keysDir = opts.keysDir ?? defaultKeysDir();
|
|
@@ -532,7 +538,7 @@ program
|
|
|
532
538
|
.option("--keys-dir <dir>", "Directory for Ed25519 keys (for from-agent Ed25519 auth)")
|
|
533
539
|
.action(async (fromAgent, toAgent, opts) => {
|
|
534
540
|
const httpPort = Number(opts.port);
|
|
535
|
-
const opsPort = opts.opsPort ? Number(opts.opsPort) :
|
|
541
|
+
const opsPort = opts.opsPort ? Number(opts.opsPort) : DEFAULT_OPS_PORT;
|
|
536
542
|
const adminPass = opts.adminPass ?? process.env.FLAIR_ADMIN_PASS ?? "";
|
|
537
543
|
const adminUser = DEFAULT_ADMIN_USER;
|
|
538
544
|
const scope = opts.scope ?? "read";
|
|
@@ -580,7 +586,7 @@ program
|
|
|
580
586
|
.option("--admin-pass <pass>", "Admin password (or set FLAIR_ADMIN_PASS env)")
|
|
581
587
|
.action(async (fromAgent, toAgent, opts) => {
|
|
582
588
|
const httpPort = Number(opts.port);
|
|
583
|
-
const opsPort = opts.opsPort ? Number(opts.opsPort) :
|
|
589
|
+
const opsPort = opts.opsPort ? Number(opts.opsPort) : DEFAULT_OPS_PORT;
|
|
584
590
|
const adminPass = opts.adminPass ?? process.env.FLAIR_ADMIN_PASS ?? "";
|
|
585
591
|
const adminUser = DEFAULT_ADMIN_USER;
|
|
586
592
|
if (!adminPass) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tpsdev-ai/flair",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
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",
|