modelstat 0.0.44 → 0.0.45

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.mjs CHANGED
@@ -4688,6 +4688,16 @@ import { createReadStream, existsSync as existsSync2, readdirSync } from "fs";
4688
4688
  import { stat } from "fs/promises";
4689
4689
  import { dirname as dirname2, join } from "path";
4690
4690
  import { createInterface } from "readline";
4691
+ function countToolCalls(content) {
4692
+ const counts = {};
4693
+ if (!Array.isArray(content)) return counts;
4694
+ for (const block of content) {
4695
+ if (block && block.type === "tool_use" && typeof block.name === "string" && block.name) {
4696
+ counts[block.name] = (counts[block.name] ?? 0) + 1;
4697
+ }
4698
+ }
4699
+ return counts;
4700
+ }
4691
4701
  function extractExcerpt(content) {
4692
4702
  if (!content) return void 0;
4693
4703
  let text = "";
@@ -4825,7 +4835,7 @@ async function parseClaudeCodeJsonl(ctx) {
4825
4835
  reasoning: 0
4826
4836
  },
4827
4837
  duration_ms: null,
4828
- tool_calls: {},
4838
+ tool_calls: countToolCalls(a.message?.content),
4829
4839
  files_touched: [],
4830
4840
  ...excerpt ? { content_excerpt: excerpt } : {},
4831
4841
  source_file: ctx.sourceFile,
@@ -45719,7 +45729,7 @@ var init_scan = __esm({
45719
45729
  init_pipeline2();
45720
45730
  init_config2();
45721
45731
  init_api();
45722
- AGENT_VERSION = true ? "agent-0.0.44" : "agent-dev";
45732
+ AGENT_VERSION = true ? "agent-0.0.45" : "agent-dev";
45723
45733
  BATCH_MAX_EVENTS = 2e3;
45724
45734
  ZERO_TOKENS = {
45725
45735
  input: 0,
@@ -47919,7 +47929,7 @@ var init_daemon = __esm({
47919
47929
  init_lock();
47920
47930
  init_scan();
47921
47931
  init_single_flight();
47922
- AGENT_VERSION2 = true ? "agent-0.0.44" : "agent-dev";
47932
+ AGENT_VERSION2 = true ? "agent-0.0.45" : "agent-dev";
47923
47933
  HEARTBEAT_INTERVAL_MS = 1e4;
47924
47934
  SCAN_INTERVAL_MS = 5 * 60 * 1e3;
47925
47935
  DISCOVERY_INTERVAL_MS = 6e4;
@@ -48429,7 +48439,7 @@ function tryOpenBrowser(url) {
48429
48439
  return false;
48430
48440
  }
48431
48441
  }
48432
- var AGENT_VERSION3 = true ? "agent-0.0.44" : "agent-dev";
48442
+ var AGENT_VERSION3 = true ? "agent-0.0.45" : "agent-dev";
48433
48443
  function osFamily() {
48434
48444
  const p = platform4();
48435
48445
  if (p === "darwin") return "macos";
@@ -48959,6 +48969,22 @@ function cmdPaths(args) {
48959
48969
  console.log(`${k.padEnd(8)} ${String(v)}`);
48960
48970
  }
48961
48971
  }
48972
+ function cmdToken(args) {
48973
+ if (!state.bearer) {
48974
+ console.error("not paired \u2014 run `npx modelstat@latest` first");
48975
+ process.exit(1);
48976
+ }
48977
+ if (args.includes("--json")) {
48978
+ process.stdout.write(`${JSON.stringify({ token: state.bearer, api: state.apiUrl })}
48979
+ `);
48980
+ return;
48981
+ }
48982
+ process.stdout.write(`${state.bearer}
48983
+ `);
48984
+ if (process.stderr.isTTY) {
48985
+ console.error("(device token \u2014 treat it like a password; rotate via the dashboard if leaked)");
48986
+ }
48987
+ }
48962
48988
  function parseConnectOpts(argv) {
48963
48989
  return {
48964
48990
  json: argv.includes("--json"),
@@ -48999,6 +49025,9 @@ async function main() {
48999
49025
  case "paths":
49000
49026
  cmdPaths(rest);
49001
49027
  return;
49028
+ case "token":
49029
+ cmdToken(rest);
49030
+ return;
49002
49031
  case "discover":
49003
49032
  return cmdDiscover();
49004
49033
  case "scan":
@@ -49023,6 +49052,7 @@ async function main() {
49023
49052
  console.log(" npx modelstat@latest stats \u2014 live device summary: sessions \xB7 tokens \xB7 cost (--json)");
49024
49053
  console.log(" npx modelstat@latest jobs \u2014 pipeline queue + recent processing ledger (--json)");
49025
49054
  console.log(" npx modelstat@latest paths \u2014 print state file + log dir + api URL (--json)");
49055
+ console.log(" npx modelstat@latest token \u2014 print the device token for hosted MCP / API access (--json)");
49026
49056
  console.log();
49027
49057
  console.log("Dev / one-shots:");
49028
49058
  console.log(" npx modelstat@latest scan \u2014 one-shot parse + upload of local JSONL");