modelstat 0.0.38 → 0.0.39

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
@@ -45518,7 +45518,7 @@ var init_scan = __esm({
45518
45518
  init_pipeline2();
45519
45519
  init_config2();
45520
45520
  init_api();
45521
- AGENT_VERSION = "agent-0.0.38";
45521
+ AGENT_VERSION = "agent-0.0.39";
45522
45522
  BATCH_MAX_EVENTS = 2e3;
45523
45523
  }
45524
45524
  });
@@ -47588,6 +47588,11 @@ async function runDaemon(opts = {}) {
47588
47588
  });
47589
47589
  const backstop = setInterval(() => void runScanCycle("interval"), SCAN_INTERVAL_MS);
47590
47590
  backstop.unref();
47591
+ const discoveryTimer = setInterval(
47592
+ () => void runDiscovery(),
47593
+ DISCOVERY_INTERVAL_MS
47594
+ );
47595
+ discoveryTimer.unref();
47591
47596
  const shutdown = async () => {
47592
47597
  setPhase("offline", "Shutting down");
47593
47598
  await sendHeartbeat();
@@ -47599,7 +47604,7 @@ async function runDaemon(opts = {}) {
47599
47604
  await new Promise(() => {
47600
47605
  });
47601
47606
  }
47602
- var import_undici2, AGENT_VERSION2, HEARTBEAT_INTERVAL_MS, SCAN_INTERVAL_MS, status, lastStatusPath;
47607
+ var import_undici2, AGENT_VERSION2, HEARTBEAT_INTERVAL_MS, SCAN_INTERVAL_MS, DISCOVERY_INTERVAL_MS, status, lastStatusPath;
47603
47608
  var init_daemon = __esm({
47604
47609
  "src/daemon.ts"() {
47605
47610
  "use strict";
@@ -47610,9 +47615,10 @@ var init_daemon = __esm({
47610
47615
  init_config2();
47611
47616
  init_lock();
47612
47617
  init_scan();
47613
- AGENT_VERSION2 = "agent-0.0.38";
47618
+ AGENT_VERSION2 = "agent-0.0.39";
47614
47619
  HEARTBEAT_INTERVAL_MS = 1e4;
47615
47620
  SCAN_INTERVAL_MS = 5 * 60 * 1e3;
47621
+ DISCOVERY_INTERVAL_MS = 6e4;
47616
47622
  status = {
47617
47623
  phase: "starting",
47618
47624
  message: null,
@@ -48044,7 +48050,7 @@ function tryOpenBrowser(url) {
48044
48050
  return false;
48045
48051
  }
48046
48052
  }
48047
- var AGENT_VERSION3 = "agent-0.0.38";
48053
+ var AGENT_VERSION3 = "agent-0.0.39";
48048
48054
  function osFamily() {
48049
48055
  const p = platform4();
48050
48056
  if (p === "darwin") return "macos";
@@ -48266,6 +48272,30 @@ async function cmdConnect(opts) {
48266
48272
  "the agent will not run in the background \u2014 re-run after fixing the issue"
48267
48273
  );
48268
48274
  }
48275
+ step("Detecting installed AI tools and signed-in accounts");
48276
+ let discovered = null;
48277
+ if (state.deviceId) {
48278
+ try {
48279
+ const d = await discover();
48280
+ await reportDiscovery({
48281
+ device_id: state.deviceId,
48282
+ installations: d.installations,
48283
+ identities: d.identities,
48284
+ scanned_at: (/* @__PURE__ */ new Date()).toISOString()
48285
+ });
48286
+ discovered = {
48287
+ installations: d.installations.length,
48288
+ identities: d.identities.length
48289
+ };
48290
+ emitEvent(opts, "discovered", discovered);
48291
+ ok(
48292
+ `${discovered.installations} installs \xB7 ${discovered.identities} accounts`
48293
+ );
48294
+ } catch (e) {
48295
+ emitEvent(opts, "discovery_failed", { error: e.message });
48296
+ warn(`couldn't detect accounts: ${e.message}`);
48297
+ }
48298
+ }
48269
48299
  if (!opts.json) {
48270
48300
  const tray = trayStatus();
48271
48301
  const line = "\u2501".repeat(60);
@@ -48276,6 +48306,11 @@ async function cmdConnect(opts) {
48276
48306
  console.log(
48277
48307
  ` service : \x1B[${serviceOk ? "32" : "33"}m${serviceOk ? "installed" : "foreground"}\x1B[0m`
48278
48308
  );
48309
+ if (discovered) {
48310
+ console.log(
48311
+ ` detected: \x1B[32m${discovered.installations} installs \xB7 ${discovered.identities} accounts\x1B[0m`
48312
+ );
48313
+ }
48279
48314
  if (platform4() === "darwin") {
48280
48315
  console.log(
48281
48316
  ` tray : \x1B[${tray.installed ? "32" : "2"}m${tray.installed ? "menu-bar icon ready" : "not installed"}\x1B[0m`