modelstat 0.10.2 → 0.11.0

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
@@ -4843,14 +4843,27 @@ function detectReferences(text, source = "content") {
4843
4843
  }
4844
4844
  for (const m of text.matchAll(SLUG_HASH)) {
4845
4845
  const slug = m[1] ?? "";
4846
- out.issues.push({
4847
- provider: "github",
4848
- key: m[2] ?? "",
4849
- slug,
4850
- url: null,
4851
- source,
4852
- confidence: 0.55
4853
- });
4846
+ const lead = text.slice(Math.max(0, (m.index ?? 0) - 20), m.index ?? 0).toLowerCase();
4847
+ if (/\b(pr|pull[ -]?request|merge[ -]?request|mr|merged)\s*$/.test(lead)) {
4848
+ out.pull_requests.push({
4849
+ host: "github.com",
4850
+ slug,
4851
+ number: Number(m[2] ?? ""),
4852
+ url: null,
4853
+ source,
4854
+ confidence: 0.6
4855
+ });
4856
+ out.repos.push(repoFrom("github.com", slug, source));
4857
+ } else {
4858
+ out.issues.push({
4859
+ provider: "github",
4860
+ key: m[2] ?? "",
4861
+ slug,
4862
+ url: null,
4863
+ source,
4864
+ confidence: 0.55
4865
+ });
4866
+ }
4854
4867
  }
4855
4868
  if (source === "model") {
4856
4869
  for (const m of text.matchAll(BARE_TICKET)) {
@@ -37315,7 +37328,7 @@ var init_scan = __esm({
37315
37328
  init_api();
37316
37329
  init_config2();
37317
37330
  init_pipeline2();
37318
- DAEMON_VERSION = true ? "daemon-0.10.2" : "daemon-dev";
37331
+ DAEMON_VERSION = true ? "daemon-0.11.0" : "daemon-dev";
37319
37332
  BATCH_MAX_EVENTS = INGEST_BATCH_MAX_EVENTS;
37320
37333
  BATCH_MAX_TOOL_CALLS = 2e4;
37321
37334
  BATCH_BUFFER_HARD_CAP = BATCH_MAX_EVENTS * 2;
@@ -40262,7 +40275,7 @@ var init_daemon = __esm({
40262
40275
  init_scan();
40263
40276
  init_single_flight();
40264
40277
  init_update();
40265
- DAEMON_VERSION2 = true ? "daemon-0.10.2" : "daemon-dev";
40278
+ DAEMON_VERSION2 = true ? "daemon-0.11.0" : "daemon-dev";
40266
40279
  HEARTBEAT_INTERVAL_MS = 1e4;
40267
40280
  SCAN_INTERVAL_MS = 5 * 60 * 1e3;
40268
40281
  DISCOVERY_INTERVAL_MS = 6e4;
@@ -40467,21 +40480,21 @@ function sourcePkgVersion(sourceCli, pkgName) {
40467
40480
  }
40468
40481
  return null;
40469
40482
  }
40470
- function stageNativePkg(sourceCli, pkgName, fallbackVersion, critical) {
40471
- const version = sourcePkgVersion(sourceCli, pkgName) ?? fallbackVersion;
40472
- const dest = binDir();
40473
- const pkgJson = join8(dest, "node_modules", ...pkgName.split("/"), "package.json");
40483
+ function stagedVersion(pkgName) {
40474
40484
  try {
40475
- const have = JSON.parse(readFileSync5(pkgJson, "utf8"));
40476
- if (have.version === version) return [`${pkgName}@${version} (cached)`];
40485
+ const pj = join8(binDir(), "node_modules", ...pkgName.split("/"), "package.json");
40486
+ return JSON.parse(readFileSync5(pj, "utf8")).version ?? null;
40477
40487
  } catch {
40488
+ return null;
40478
40489
  }
40490
+ }
40491
+ function stageNativePkgs(specs) {
40492
+ const dest = binDir();
40479
40493
  mkdirSync4(dest, { recursive: true });
40480
40494
  const childEnv = { ...process.env };
40481
40495
  delete childEnv.npm_config_global;
40482
40496
  delete childEnv.npm_config_prefix;
40483
- const label = critical ? "summariser runtime" : "on-device embedder + PII/NER redactor";
40484
- process.stderr.write(` \xB7 staging ${label} (${pkgName}@${version})\u2026
40497
+ process.stderr.write(` \xB7 staging native runtime (${specs.join(", ")})\u2026
40485
40498
  `);
40486
40499
  const r = spawnSync2(
40487
40500
  "npm",
@@ -40501,31 +40514,46 @@ function stageNativePkg(sourceCli, pkgName, fallbackVersion, critical) {
40501
40514
  "--prefer-offline",
40502
40515
  "--fetch-timeout=60000",
40503
40516
  "--loglevel=error",
40504
- `${pkgName}@${version}`
40517
+ ...specs
40505
40518
  ],
40506
40519
  { encoding: "utf8", stdio: "pipe", env: childEnv }
40507
40520
  );
40508
40521
  if (r.status !== 0) {
40509
40522
  process.stderr.write(
40510
- critical ? `[modelstat] couldn't stage the bundled summariser runtime via npm (${pkgName}@${version}); the daemon's summariser preflight will fail until this is resolved.
40523
+ `[modelstat] npm couldn't stage [${specs.join(", ")}] into ~/.modelstat/bin:
40511
40524
  ${(r.stderr || r.stdout || "").trim()}
40512
- ` : `[modelstat] couldn't stage the on-device embedder/redactor (${pkgName}@${version}); the daemon falls back to server-side embedding + regex/LLM redaction (non-fatal).
40513
40525
  `
40514
40526
  );
40515
- return [];
40527
+ return false;
40516
40528
  }
40517
- return [`${pkgName}@${version}`];
40529
+ return true;
40518
40530
  }
40519
40531
  function installNativeRuntime(sourceCli) {
40520
- return [
40521
- ...stageNativePkg(sourceCli, "node-llama-cpp", NODE_LLAMA_CPP_FALLBACK_VERSION, true),
40522
- ...stageNativePkg(
40523
- sourceCli,
40524
- "@huggingface/transformers",
40525
- HF_TRANSFORMERS_FALLBACK_VERSION,
40526
- false
40527
- )
40532
+ const pkgs = [
40533
+ {
40534
+ name: "node-llama-cpp",
40535
+ version: sourcePkgVersion(sourceCli, "node-llama-cpp") ?? NODE_LLAMA_CPP_FALLBACK_VERSION
40536
+ },
40537
+ {
40538
+ name: "@huggingface/transformers",
40539
+ version: sourcePkgVersion(sourceCli, "@huggingface/transformers") ?? HF_TRANSFORMERS_FALLBACK_VERSION
40540
+ }
40528
40541
  ];
40542
+ if (pkgs.every((p) => stagedVersion(p.name) === p.version)) {
40543
+ return pkgs.map((p) => `${p.name}@${p.version} (cached)`);
40544
+ }
40545
+ const specs = pkgs.map((p) => `${p.name}@${p.version}`);
40546
+ if (stageNativePkgs(specs)) return specs;
40547
+ process.stderr.write(
40548
+ "[modelstat] retrying with just the summariser runtime; the embedder/redactor will fall back\u2026\n"
40549
+ );
40550
+ const llamaSpec = `node-llama-cpp@${pkgs[0].version}`;
40551
+ if (stageNativePkgs([llamaSpec])) return [llamaSpec];
40552
+ process.stderr.write(
40553
+ `[modelstat] couldn't stage the summariser runtime (${llamaSpec}); the daemon uses the extractive fallback until this is resolved.
40554
+ `
40555
+ );
40556
+ return [];
40529
40557
  }
40530
40558
  function nodeBinary() {
40531
40559
  return process.execPath;
@@ -40879,7 +40907,7 @@ function tryOpenBrowser(url) {
40879
40907
  return false;
40880
40908
  }
40881
40909
  }
40882
- var DAEMON_VERSION3 = true ? "daemon-0.10.2" : "daemon-dev";
40910
+ var DAEMON_VERSION3 = true ? "daemon-0.11.0" : "daemon-dev";
40883
40911
  function osFamily() {
40884
40912
  const p = platform6();
40885
40913
  if (p === "darwin") return "macos";