modelstat 0.9.0 → 0.10.1

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
@@ -36749,8 +36749,8 @@ var init_node = __esm({
36749
36749
  async function createPrivacyFilterRedactor(opts = {}) {
36750
36750
  const isBrowser = typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined";
36751
36751
  const device = opts.device ?? (isBrowser ? "webgpu" : "cpu");
36752
- const dtype = opts.dtype ?? "q4";
36753
- const modelId = opts.model ?? "openai/privacy-filter";
36752
+ const dtype = opts.dtype ?? "q8";
36753
+ const modelId = opts.model ?? "Xenova/bert-base-NER";
36754
36754
  const importModule2 = opts.importModule ?? ((id) => import(
36755
36755
  /* @vite-ignore */
36756
36756
  id
@@ -37315,7 +37315,7 @@ var init_scan = __esm({
37315
37315
  init_api();
37316
37316
  init_config2();
37317
37317
  init_pipeline2();
37318
- DAEMON_VERSION = true ? "daemon-0.9.0" : "daemon-dev";
37318
+ DAEMON_VERSION = true ? "daemon-0.10.1" : "daemon-dev";
37319
37319
  BATCH_MAX_EVENTS = INGEST_BATCH_MAX_EVENTS;
37320
37320
  BATCH_MAX_TOOL_CALLS = 2e4;
37321
37321
  BATCH_BUFFER_HARD_CAP = BATCH_MAX_EVENTS * 2;
@@ -37882,7 +37882,7 @@ var PROCESSING_VERSION;
37882
37882
  var init_processing_version = __esm({
37883
37883
  "src/processing-version.ts"() {
37884
37884
  "use strict";
37885
- PROCESSING_VERSION = 7;
37885
+ PROCESSING_VERSION = 9;
37886
37886
  }
37887
37887
  });
37888
37888
 
@@ -40262,7 +40262,7 @@ var init_daemon = __esm({
40262
40262
  init_scan();
40263
40263
  init_single_flight();
40264
40264
  init_update();
40265
- DAEMON_VERSION2 = true ? "daemon-0.9.0" : "daemon-dev";
40265
+ DAEMON_VERSION2 = true ? "daemon-0.10.1" : "daemon-dev";
40266
40266
  HEARTBEAT_INTERVAL_MS = 1e4;
40267
40267
  SCAN_INTERVAL_MS = 5 * 60 * 1e3;
40268
40268
  DISCOVERY_INTERVAL_MS = 6e4;
@@ -40448,15 +40448,16 @@ function setupRuntime() {
40448
40448
  return installBundle();
40449
40449
  }
40450
40450
  var NODE_LLAMA_CPP_FALLBACK_VERSION = "3.18.1";
40451
- function sourceLlamaVersion(sourceCli) {
40451
+ var HF_TRANSFORMERS_FALLBACK_VERSION = "3.8.1";
40452
+ function sourcePkgVersion(sourceCli, pkgName) {
40452
40453
  try {
40453
40454
  const req = createRequire(sourceCli);
40454
- let d = dirname6(realpathSync(req.resolve("node-llama-cpp")));
40455
+ let d = dirname6(realpathSync(req.resolve(pkgName)));
40455
40456
  for (let i = 0; i < 10; i++) {
40456
40457
  const pj = join8(d, "package.json");
40457
40458
  if (existsSync9(pj)) {
40458
40459
  const p = JSON.parse(readFileSync5(pj, "utf8"));
40459
- if (p.name === "node-llama-cpp" && p.version) return p.version;
40460
+ if (p.name === pkgName && p.version) return p.version;
40460
40461
  }
40461
40462
  const up = dirname6(d);
40462
40463
  if (up === d) break;
@@ -40466,21 +40467,21 @@ function sourceLlamaVersion(sourceCli) {
40466
40467
  }
40467
40468
  return null;
40468
40469
  }
40469
- function installNativeRuntime(sourceCli) {
40470
- const version = sourceLlamaVersion(sourceCli) ?? NODE_LLAMA_CPP_FALLBACK_VERSION;
40470
+ function stageNativePkg(sourceCli, pkgName, fallbackVersion, critical) {
40471
+ const version = sourcePkgVersion(sourceCli, pkgName) ?? fallbackVersion;
40471
40472
  const dest = binDir();
40473
+ const pkgJson = join8(dest, "node_modules", ...pkgName.split("/"), "package.json");
40472
40474
  try {
40473
- const have = JSON.parse(
40474
- readFileSync5(join8(dest, "node_modules", "node-llama-cpp", "package.json"), "utf8")
40475
- );
40476
- if (have.version === version) return [`node-llama-cpp@${version} (cached)`];
40475
+ const have = JSON.parse(readFileSync5(pkgJson, "utf8"));
40476
+ if (have.version === version) return [`${pkgName}@${version} (cached)`];
40477
40477
  } catch {
40478
40478
  }
40479
40479
  mkdirSync4(dest, { recursive: true });
40480
40480
  const childEnv = { ...process.env };
40481
40481
  delete childEnv.npm_config_global;
40482
40482
  delete childEnv.npm_config_prefix;
40483
- process.stderr.write(` \xB7 staging summariser runtime (node-llama-cpp@${version})\u2026
40483
+ const label = critical ? "summariser runtime" : "on-device embedder + PII/NER redactor";
40484
+ process.stderr.write(` \xB7 staging ${label} (${pkgName}@${version})\u2026
40484
40485
  `);
40485
40486
  const r = spawnSync2(
40486
40487
  "npm",
@@ -40493,27 +40494,38 @@ function installNativeRuntime(sourceCli) {
40493
40494
  "--omit=dev",
40494
40495
  "--no-audit",
40495
40496
  "--no-fund",
40496
- // Prefer the npm cache the current install already populated (node-llama-cpp
40497
- // is a direct dep, so the platform prebuilt is cached) an offline ~3s copy
40498
- // instead of a redundant network re-fetch. Only a genuine cache miss touches
40499
- // the network, and a capped per-request timeout makes that fail fast (the
40500
- // daemon's summariser preflight re-stages) rather than hang indefinitely.
40497
+ // Prefer the npm cache the current install already populated — an offline
40498
+ // ~3s copy instead of a redundant network re-fetch. Only a genuine cache
40499
+ // miss touches the network, and a capped per-request timeout makes that
40500
+ // fail fast (the daemon re-stages on its next preflight) rather than hang.
40501
40501
  "--prefer-offline",
40502
40502
  "--fetch-timeout=60000",
40503
40503
  "--loglevel=error",
40504
- `node-llama-cpp@${version}`
40504
+ `${pkgName}@${version}`
40505
40505
  ],
40506
40506
  { encoding: "utf8", stdio: "pipe", env: childEnv }
40507
40507
  );
40508
40508
  if (r.status !== 0) {
40509
40509
  process.stderr.write(
40510
- `[modelstat] couldn't stage the bundled summariser runtime via npm (node-llama-cpp@${version}); the daemon's summariser preflight will fail until this is resolved.
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.
40511
40511
  ${(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).
40512
40513
  `
40513
40514
  );
40514
40515
  return [];
40515
40516
  }
40516
- return [`node-llama-cpp@${version}`];
40517
+ return [`${pkgName}@${version}`];
40518
+ }
40519
+ 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
+ )
40528
+ ];
40517
40529
  }
40518
40530
  function nodeBinary() {
40519
40531
  return process.execPath;
@@ -40867,7 +40879,7 @@ function tryOpenBrowser(url) {
40867
40879
  return false;
40868
40880
  }
40869
40881
  }
40870
- var DAEMON_VERSION3 = true ? "daemon-0.9.0" : "daemon-dev";
40882
+ var DAEMON_VERSION3 = true ? "daemon-0.10.1" : "daemon-dev";
40871
40883
  function osFamily() {
40872
40884
  const p = platform6();
40873
40885
  if (p === "darwin") return "macos";