modelstat 0.0.37 → 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
@@ -44362,7 +44362,7 @@ var COGNITION_SYSTEM_PROMPT, MAX_COGNITION_TAGS_PER_FIELD, MAX_COGNITION_TAG_CHA
44362
44362
  var init_cognition = __esm({
44363
44363
  "../../packages/companion-core/src/pipeline/cognition.ts"() {
44364
44364
  "use strict";
44365
- COGNITION_SYSTEM_PROMPT = 'You read a one-sentence summary of an AI-coding work session and identify the user\'s emotional state and meta-cognitive state. Output JSON only \u2014 first character of reply is `{`. Schema: {"emotions":[],"meta":[]}. emotions: \u2264 3 short lowercase mood tags such as frustrated, curious, excited, focused, calm, confused, anxious, satisfied, proud, bored, energised. meta: \u2264 3 short lowercase tags about cognitive mode, such as debugging, exploring, planning, designing, learning, deciding, reviewing, refactoring, investigating, documenting. Each tag \u2264 24 chars, single word or hyphenated, no punctuation. Only emit a tag if the summary gives clear evidence \u2014 return [] for either field when unsure. Do not invent emotions the user did not display. No prose, no markdown.';
44365
+ COGNITION_SYSTEM_PROMPT = 'You read a one-sentence summary of an AI-coding work session and identify the user\'s emotional state and meta-cognitive state. Output JSON only \u2014 first character of reply is `{`. Schema: {"emotions":[],"meta":[]}. emotions: \u2264 3 short lowercase MOOD tags \u2014 how the user FEELS \u2014 such as frustrated, curious, excited, calm, confused, anxious, satisfied, proud, bored, energised, overwhelmed, confident. meta: \u2264 3 short lowercase MENTAL-MODE tags \u2014 HOW the user is THINKING, never what they are doing. Valid examples: focused, scattered, in-flow, deliberate, hurried, stuck, open, exploratory, methodical, distracted. DO NOT emit ACTIVITY verbs (debugging, refactoring, designing, reviewing, deploying, planning, documenting, implementing) under meta \u2014 those describe the WORK, not the MIND. If the only candidate tag would be an activity verb, return [] for meta instead. Each tag \u2264 24 chars, single word or hyphenated, no punctuation. Only emit a tag if the summary gives clear evidence \u2014 return [] for either field when unsure. Do not invent emotions or mental modes the user did not display. No prose, no markdown.';
44366
44366
  MAX_COGNITION_TAGS_PER_FIELD = 3;
44367
44367
  MAX_COGNITION_TAG_CHARS = 24;
44368
44368
  COGNITION_MAX_TOKENS = 80;
@@ -45343,12 +45343,12 @@ async function getAdapters() {
45343
45343
  `[modelstat] ollama up at ${ollamaCfg.baseUrl} \u2014 using ${ollamaCfg.chatModel} for summarisation`
45344
45344
  );
45345
45345
  adapters = {
45346
- // BGE-small via transformers.js — same model the server uses
45347
- // via fastembed, so segment vectors land in the same 384-dim
45348
- // space as leaf-description vectors and cosine similarity is
45349
- // directly meaningful. We do NOT use ollamaEmbed here because
45350
- // Ollama's library doesn't host bge-small (404 on pull) and
45351
- // shipping MiniLM-via-Ollama vs BGE-small-server would break
45346
+ // BGE-small via transformers.js — same model the server uses,
45347
+ // so segment vectors land in the same 384-dim space as
45348
+ // leaf-description vectors and cosine similarity is directly
45349
+ // meaningful. We do NOT use ollamaEmbed here because Ollama's
45350
+ // library doesn't host bge-small (404 on pull) and shipping
45351
+ // MiniLM via Ollama vs BGE-small server-side would break
45352
45352
  // cross-source similarity.
45353
45353
  embed: createTransformersJsEmbedder(),
45354
45354
  summarize: ollamaSummarize(ollamaCfg),
@@ -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.37";
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.37";
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.37";
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`
@@ -48361,7 +48396,7 @@ async function cmdWatch() {
48361
48396
  }
48362
48397
  async function cmdStart(rest) {
48363
48398
  if (!state.bearer || !state.deviceId) {
48364
- console.error("not paired yet. Run `modelstat connect` first.");
48399
+ console.error("not paired yet. Run `modelstat` first.");
48365
48400
  process.exit(1);
48366
48401
  }
48367
48402
  const force = rest.includes("--force") || rest.includes("-f");
@@ -48373,7 +48408,7 @@ async function cmdStop() {
48373
48408
  uninstallService();
48374
48409
  console.log("\u2713 service stopped and uninstalled");
48375
48410
  console.log(` Your device pairing is still in ${state.storePath}`);
48376
- console.log(" Run `modelstat connect` again to re-enable.");
48411
+ console.log(" Run `modelstat` again to re-enable.");
48377
48412
  } catch (err) {
48378
48413
  console.error(`\u2717 ${err.message}`);
48379
48414
  process.exit(1);
@@ -48487,7 +48522,7 @@ async function cmdJobs(args) {
48487
48522
  process.stdout.write(`${JSON.stringify({ paired: false, reason: "no_claim_code" })}
48488
48523
  `);
48489
48524
  } else {
48490
- console.log("no claim code on record \u2014 run `modelstat connect` first");
48525
+ console.log("no claim code on record \u2014 run `modelstat` first");
48491
48526
  }
48492
48527
  return;
48493
48528
  }