claw-insights 0.1.3 → 0.1.4

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/README.md CHANGED
@@ -59,10 +59,25 @@ Open the URL — token is exchanged for a session cookie, and you're in.
59
59
 
60
60
  ```bash
61
61
  claw-insights status # Show current access URL
62
+ claw-insights status --json # Machine-readable status (includes auth.accessUrl)
62
63
  claw-insights stop # Stop daemon
63
64
  claw-insights start --no-auth # Disable authentication
64
65
  ```
65
66
 
67
+ Example (`status --json`, trimmed):
68
+
69
+ ```json
70
+ {
71
+ "schemaVersion": 1,
72
+ "server": { "port": 41041, "url": "http://127.0.0.1:41041" },
73
+ "auth": {
74
+ "mode": "token-cookie",
75
+ "tokenUrlPresent": true,
76
+ "accessUrl": "http://127.0.0.1:41041/?token=..."
77
+ }
78
+ }
79
+ ```
80
+
66
81
  → Full install options, snapshot API, and troubleshooting: [docs/configuration.md](docs/configuration.md)
67
82
 
68
83
  ## 🤖 AI Agent Friendly
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claw-insights",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Real-time monitoring dashboard for OpenClaw gateway",
5
5
  "type": "module",
6
6
  "bin": {
@@ -29,6 +29,7 @@ interface StatusJsonPayload {
29
29
  auth: {
30
30
  mode: string;
31
31
  tokenUrlPresent: boolean;
32
+ accessUrl: string | null;
32
33
  };
33
34
  health: {
34
35
  ok: boolean;
@@ -519,7 +519,11 @@ async function daemonStatus(options = {}) {
519
519
  version,
520
520
  server: { state: "stopped", pid: null, port, url: `http://127.0.0.1:${port}` },
521
521
  web: { enabled: !serverOnly, port: webPort, url: `http://127.0.0.1:${webPort}` },
522
- auth: { mode: noAuth ? "none" : "token-cookie", tokenUrlPresent: false },
522
+ auth: {
523
+ mode: noAuth ? "none" : "token-cookie",
524
+ tokenUrlPresent: false,
525
+ accessUrl: noAuth ? `http://127.0.0.1:${port}/` : null
526
+ },
523
527
  health: { ok: false, ready: false, gateway: "unknown", db: "unknown" }
524
528
  });
525
529
  console.log(JSON.stringify(payload));
@@ -542,12 +546,25 @@ async function daemonStatus(options = {}) {
542
546
  const version = resolveCliVersion(process.env);
543
547
  const isOk = healthResponseOk && healthData?.status === "ok";
544
548
  const state = healthResponseOk ? isOk ? "running" : "degraded" : "degraded";
545
- const tokenUrlPresent = existsSync2(join(paths.dataDir, "auth-token"));
549
+ const tokenFile = join(paths.dataDir, "auth-token");
550
+ let token = null;
551
+ if (!noAuth) {
552
+ try {
553
+ const rawToken = readFileSync2(tokenFile, "utf-8").trim();
554
+ if (rawToken) {
555
+ token = rawToken;
556
+ }
557
+ } catch {
558
+ token = null;
559
+ }
560
+ }
561
+ const tokenUrlPresent = token !== null;
562
+ const accessUrl = noAuth ? `http://127.0.0.1:${port}/` : token ? `http://127.0.0.1:${port}/?token=${token}` : null;
546
563
  const payload = buildStatusJson({
547
564
  version,
548
565
  server: { state, pid, port, url: `http://127.0.0.1:${port}` },
549
566
  web: { enabled: !serverOnly, port: webPort, url: `http://127.0.0.1:${webPort}` },
550
- auth: { mode: noAuth ? "none" : "token-cookie", tokenUrlPresent },
567
+ auth: { mode: noAuth ? "none" : "token-cookie", tokenUrlPresent, accessUrl },
551
568
  health: {
552
569
  ok: isOk,
553
570
  ready: isOk,