modelstat 0.0.28 → 0.0.29

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
@@ -6,47 +6,45 @@
6
6
 
7
7
  ## Install
8
8
 
9
- The fastest way:
9
+ One command. Re-running it upgrades you to the newest published version (postinstall stops the running service, swaps the bundle, restarts it).
10
10
 
11
11
  ```bash
12
- curl -fsSL https://install.modelstat.ai | sh
12
+ npx modelstat@latest
13
13
  ```
14
14
 
15
- Or via Homebrew:
15
+ Same one-shot via Bun or pnpm:
16
16
 
17
17
  ```bash
18
- brew install modelstat/tap/modelstat
19
- modelstat connect
18
+ bunx modelstat@latest
19
+ pnpm dlx modelstat@latest
20
20
  ```
21
21
 
22
- Or via npm / pnpm / bun:
22
+ The first run downloads the on-device summariser model (~2.7 GB Qwen3.5-4B GGUF to `~/.modelstat/models/`), pairs the device, and installs a **launchd user agent** on macOS (at `~/Library/LaunchAgents/ai.modelstat.agent.plist`) or a **systemd user unit** on Linux (at `~/.config/systemd/user/modelstat.service`). The daemon starts automatically on login and watches your AI-tool session logs in the background. The CLI exits cleanly — there's no foreground process to keep open.
23
23
 
24
- ```bash
25
- npm install -g @modelstat/agent && modelstat connect
26
- pnpm add -g @modelstat/agent && modelstat connect
27
- bun add -g @modelstat/agent && modelstat connect
28
- ```
29
-
30
- `modelstat connect` installs a **launchd user agent** on macOS (at `~/Library/LaunchAgents/ai.modelstat.agent.plist`) or a **systemd user unit** on Linux (at `~/.config/systemd/user/modelstat.service`). The daemon starts automatically on login.
31
-
32
- Requires Node 20+ (or skip Node entirely with the Homebrew route). macOS and Linux (x86_64, arm64) supported.
24
+ Requires Node 20+. macOS and Linux (x86_64, arm64) supported.
33
25
 
34
26
  ## Commands
35
27
 
36
28
  ```bash
37
- modelstat connect # pair + install background service, then exit
38
- modelstat status # show pairing + service state
39
- modelstat paths [--json] # print state file + log paths + API URL
40
- modelstat stop # stop and uninstall the service
41
- modelstat scan # one-shot parse + upload of local JSONL
42
- modelstat watch # foreground watcher (no service install)
43
- modelstat discover # report detected tool installs + identities
29
+ npx modelstat@latest # install or upgrade. Default action.
30
+ npx modelstat@latest remove # stop and uninstall the background service
31
+ npx modelstat@latest reinstall # alias for the default explicit form
32
+
33
+ npx modelstat@latest status # show pairing + service state
34
+ npx modelstat@latest stats # live device summary: sessions · tokens · cost
35
+ npx modelstat@latest jobs # pipeline queue + recent processing ledger
36
+ npx modelstat@latest paths [--json] # state file + log dir + API URL
37
+
38
+ npx modelstat@latest scan # one-shot parse + upload of local JSONL
39
+ npx modelstat@latest rescan # wipe file cursors so next scan re-reads & re-summarises everything
40
+ npx modelstat@latest watch # foreground watcher (no service install)
41
+ npx modelstat@latest discover # report detected tool installs + identities
44
42
  ```
45
43
 
46
44
  **Programmatic pairing** (used by harness skills for OpenClaw, NanoClaw, etc.):
47
45
 
48
46
  ```bash
49
- modelstat connect --json --no-browser
47
+ npx modelstat@latest --json --no-browser
50
48
  ```
51
49
 
52
50
  Emits one NDJSON event per line. Schema documented at [integrations/harness-skills/modelstat-connect/README.md](https://github.com/modelstat/modelstat/tree/main/integrations/harness-skills/modelstat-connect).
@@ -72,7 +70,7 @@ To point the agent at your own modelstat API (not the hosted SaaS):
72
70
 
73
71
  ```bash
74
72
  export AGENT_API_URL=https://your-modelstat-api.example.com
75
- modelstat connect
73
+ npx modelstat@latest
76
74
  ```
77
75
 
78
76
  `AGENT_API_URL` can also be set persistently via `.env` or in the systemd/launchd unit.
package/dist/cli.mjs CHANGED
@@ -47080,7 +47080,7 @@ function basename3(p) {
47080
47080
  }
47081
47081
  async function runDaemon(opts = {}) {
47082
47082
  if (!state.bearer || !state.deviceId) {
47083
- throw new Error("not enrolled \u2014 run `modelstat connect` first");
47083
+ throw new Error("not enrolled \u2014 run `npx modelstat@latest` first");
47084
47084
  }
47085
47085
  const lock = acquireDaemonLock({
47086
47086
  agentVersion: AGENT_VERSION2,
@@ -47830,7 +47830,7 @@ async function cmdConnect(opts) {
47830
47830
  "the background service will retry the download on its first scan"
47831
47831
  );
47832
47832
  }
47833
- step("Installing background service so the agent survives reboots");
47833
+ step("Installing/refreshing background service so the agent survives reboots");
47834
47834
  let serviceOk = false;
47835
47835
  try {
47836
47836
  const svc = installService();
@@ -47844,7 +47844,9 @@ async function cmdConnect(opts) {
47844
47844
  } catch (e) {
47845
47845
  emitEvent(opts, "service_install_failed", { error: e.message });
47846
47846
  warn(`couldn't install service: ${e.message}`);
47847
- warn("will run in the foreground instead \u2014 don't close this terminal");
47847
+ warn(
47848
+ "the agent will not run in the background \u2014 re-run after fixing the issue"
47849
+ );
47848
47850
  }
47849
47851
  if (!opts.json) {
47850
47852
  const tray = trayStatus();
@@ -48109,27 +48111,19 @@ async function main() {
48109
48111
  const rest = process.argv.slice(3);
48110
48112
  switch (cmd) {
48111
48113
  case void 0:
48112
- case "start":
48113
- if (!state.bearer || !state.deviceId)
48114
- return cmdConnect(parseConnectOpts(rest));
48115
- return cmdStart(rest);
48116
48114
  case "connect":
48117
48115
  return cmdConnect(parseConnectOpts(rest));
48118
- case "self-register":
48119
- return cmdSelfRegister();
48120
- case "await-claim":
48121
- return cmdAwaitClaim();
48122
- case "discover":
48123
- return cmdDiscover();
48124
- case "scan":
48125
- return cmdScan();
48126
- case "rescan":
48127
- return cmdRescan();
48128
- case "watch":
48129
- return cmdWatch();
48130
- case "stop":
48116
+ case "remove":
48131
48117
  case "uninstall":
48118
+ case "stop":
48132
48119
  return cmdStop();
48120
+ case "reinstall":
48121
+ return cmdConnect(parseConnectOpts(rest));
48122
+ // ── Internal / service entry point ─────────────────────────
48123
+ case "_daemon":
48124
+ case "start":
48125
+ return cmdStart(rest);
48126
+ // ── Diagnostics / dev one-shots ────────────────────────────
48133
48127
  case "status":
48134
48128
  return cmdStatus();
48135
48129
  case "stats":
@@ -48139,26 +48133,38 @@ async function main() {
48139
48133
  case "paths":
48140
48134
  cmdPaths(rest);
48141
48135
  return;
48136
+ case "discover":
48137
+ return cmdDiscover();
48138
+ case "scan":
48139
+ return cmdScan();
48140
+ case "rescan":
48141
+ return cmdRescan();
48142
+ case "watch":
48143
+ return cmdWatch();
48144
+ case "self-register":
48145
+ return cmdSelfRegister();
48146
+ case "await-claim":
48147
+ return cmdAwaitClaim();
48142
48148
  default:
48143
- console.log(
48144
- "usage: modelstat [connect|self-register|await-claim|status|stats|jobs|paths|stop|start|discover|scan|watch]"
48145
- );
48149
+ console.log("usage:");
48150
+ console.log(" npx modelstat@latest \u2014 install or upgrade. Registers the device, installs the background service, exits.");
48151
+ console.log(" flags: --json (NDJSON events on stdout), --no-browser, --fresh, -y");
48152
+ console.log(" npx modelstat@latest remove \u2014 stop and uninstall the background service. Keeps your identity.");
48153
+ console.log(" npx modelstat@latest reinstall \u2014 alias for the default. Useful when you want to be explicit.");
48154
+ console.log();
48155
+ console.log("Diagnostics:");
48156
+ console.log(" npx modelstat@latest status \u2014 show pairing + service state");
48157
+ console.log(" npx modelstat@latest stats \u2014 live device summary: sessions \xB7 tokens \xB7 cost (--json)");
48158
+ console.log(" npx modelstat@latest jobs \u2014 pipeline queue + recent processing ledger (--json)");
48159
+ console.log(" npx modelstat@latest paths \u2014 print state file + log dir + api URL (--json)");
48160
+ console.log();
48161
+ console.log("Dev / one-shots:");
48162
+ console.log(" npx modelstat@latest scan \u2014 one-shot parse + upload of local JSONL");
48163
+ console.log(" npx modelstat@latest rescan \u2014 wipe file cursors so the next scan re-reads & re-summarises everything");
48164
+ console.log(" npx modelstat@latest watch \u2014 continuous (chokidar) with periodic backstop");
48165
+ console.log(" npx modelstat@latest discover \u2014 one-shot report of installs/identities");
48146
48166
  console.log();
48147
- console.log(" (no args) \u2014 pair if needed, then run the daemon in the foreground");
48148
- console.log(" connect \u2014 self-register + install the background service; prints /d/:claim_code URL");
48149
- console.log(" flags: --json (NDJSON events on stdout), --no-browser");
48150
- console.log(" self-register \u2014 generate UUIDv7 + register; print claim URL and exit");
48151
- console.log(" await-claim \u2014 block until a human claims this self-registered device");
48152
- console.log(" status \u2014 show pairing + service state");
48153
- console.log(" stats \u2014 live device summary: sessions, tokens, cost (use --json)");
48154
- console.log(" jobs \u2014 pipeline queue + recent processing ledger (use --json)");
48155
- console.log(" paths \u2014 print state file + log dir + api URL (use --json for machine-readable)");
48156
- console.log(" stop \u2014 stop and uninstall the background service");
48157
- console.log(" start \u2014 run the daemon (used by the installed service)");
48158
- console.log(" discover \u2014 one-shot report of installs/identities");
48159
- console.log(" scan \u2014 one-shot parse + upload of local JSONL");
48160
- console.log(" rescan \u2014 wipe file cursors so next scan re-reads & re-summarises everything");
48161
- console.log(" watch \u2014 continuous (chokidar) with periodic backstop");
48167
+ console.log("Internal (called by launchd/systemd, not by humans): _daemon, start, self-register, await-claim");
48162
48168
  process.exit(1);
48163
48169
  }
48164
48170
  }