modelstat 0.8.0 → 0.8.2

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
@@ -85,10 +85,15 @@ function parseRemote(url) {
85
85
  return { host: null, slug: null };
86
86
  }
87
87
  }
88
+ function mainRepoPath(cwd) {
89
+ const i = cwd.indexOf("/.claude/");
90
+ return i === -1 ? cwd : cwd.slice(0, i);
91
+ }
88
92
  async function resolveGitContext(cwd) {
89
93
  if (!cwd) return null;
90
- if (cache.has(cwd)) return cache.get(cwd) ?? null;
91
- const root = findRepoRoot(cwd);
94
+ const target = mainRepoPath(cwd);
95
+ if (cache.has(target)) return cache.get(target) ?? null;
96
+ const root = findRepoRoot(target);
92
97
  if (!root) {
93
98
  const empty = {
94
99
  remote_url: null,
@@ -97,7 +102,7 @@ async function resolveGitContext(cwd) {
97
102
  branch: null,
98
103
  commit_sha: null
99
104
  };
100
- cache.set(cwd, empty);
105
+ cache.set(target, empty);
101
106
  return empty;
102
107
  }
103
108
  const ran = async (args) => {
@@ -119,7 +124,7 @@ async function resolveGitContext(cwd) {
119
124
  branch,
120
125
  commit_sha: sha
121
126
  };
122
- cache.set(cwd, ctx);
127
+ cache.set(target, ctx);
123
128
  return ctx;
124
129
  }
125
130
  function guessRepoSlugFromPath(cwd) {
@@ -36065,7 +36070,7 @@ var init_file_queue_store = __esm({
36065
36070
  });
36066
36071
 
36067
36072
  // ../../packages/daemon-core/src/node/llama.ts
36068
- import { existsSync as existsSync7 } from "fs";
36073
+ import { existsSync as existsSync7, rmSync, writeFileSync as writeFileSync4 } from "fs";
36069
36074
  import { mkdir } from "fs/promises";
36070
36075
  import { homedir as homedir4 } from "os";
36071
36076
  import { dirname as dirname5, join as join6 } from "path";
@@ -36173,9 +36178,21 @@ async function loadOnce(cfg) {
36173
36178
  loadPromise = (async () => {
36174
36179
  const llamaMod = await import("node-llama-cpp");
36175
36180
  const modelPath = await ensureLlamaModel(cfg);
36176
- const llama = await llamaMod.getLlama();
36181
+ const guardPath = `${dirname5(modelPath)}/.metal-load-guard`;
36182
+ const metalAborted = existsSync7(guardPath);
36183
+ if (!metalAborted) {
36184
+ try {
36185
+ writeFileSync4(guardPath, "probing metal\n");
36186
+ } catch {
36187
+ }
36188
+ }
36189
+ const llama = await llamaMod.getLlama(metalAborted ? { gpu: false } : void 0);
36177
36190
  llamaInstance = llama;
36178
36191
  const model = await llama.loadModel({ modelPath });
36192
+ try {
36193
+ rmSync(guardPath, { force: true });
36194
+ } catch {
36195
+ }
36179
36196
  const summariserContext = await model.createContext({
36180
36197
  contextSize: cfg.contextSize
36181
36198
  });
@@ -37176,7 +37193,7 @@ var init_scan = __esm({
37176
37193
  init_api();
37177
37194
  init_config2();
37178
37195
  init_pipeline2();
37179
- DAEMON_VERSION = true ? "daemon-0.8.0" : "daemon-dev";
37196
+ DAEMON_VERSION = true ? "daemon-0.8.2" : "daemon-dev";
37180
37197
  BATCH_MAX_EVENTS = INGEST_BATCH_MAX_EVENTS;
37181
37198
  BATCH_MAX_TOOL_CALLS = 2e4;
37182
37199
  BATCH_BUFFER_HARD_CAP = BATCH_MAX_EVENTS * 2;
@@ -37199,7 +37216,7 @@ import {
37199
37216
  readFileSync as readFileSync6,
37200
37217
  renameSync as renameSync3,
37201
37218
  unlinkSync as unlinkSync2,
37202
- writeFileSync as writeFileSync5,
37219
+ writeFileSync as writeFileSync6,
37203
37220
  writeSync
37204
37221
  } from "fs";
37205
37222
  import { join as join9 } from "path";
@@ -37331,7 +37348,7 @@ var init_lock = __esm({
37331
37348
 
37332
37349
  // src/update.ts
37333
37350
  import { spawn as spawn2, spawnSync as spawnSync3 } from "child_process";
37334
- import { mkdirSync as mkdirSync6, readFileSync as readFileSync8, renameSync as renameSync4, writeFileSync as writeFileSync6 } from "fs";
37351
+ import { mkdirSync as mkdirSync6, readFileSync as readFileSync8, renameSync as renameSync4, writeFileSync as writeFileSync7 } from "fs";
37335
37352
  import { platform as platform4 } from "os";
37336
37353
  function prefPath() {
37337
37354
  return homePath("auto-update.json");
@@ -37347,7 +37364,7 @@ function storedAutoUpdate() {
37347
37364
  function setStoredAutoUpdate(enabled) {
37348
37365
  mkdirSync6(modelstatHome(), { recursive: true, mode: 448 });
37349
37366
  const tmp = `${prefPath()}.${process.pid}.tmp`;
37350
- writeFileSync6(tmp, JSON.stringify({ autoUpdate: enabled }), { mode: 384 });
37367
+ writeFileSync7(tmp, JSON.stringify({ autoUpdate: enabled }), { mode: 384 });
37351
37368
  renameSync4(tmp, prefPath());
37352
37369
  }
37353
37370
  function parseFlag(v) {
@@ -37743,7 +37760,7 @@ var PROCESSING_VERSION;
37743
37760
  var init_processing_version = __esm({
37744
37761
  "src/processing-version.ts"() {
37745
37762
  "use strict";
37746
- PROCESSING_VERSION = 6;
37763
+ PROCESSING_VERSION = 7;
37747
37764
  }
37748
37765
  });
37749
37766
 
@@ -40103,7 +40120,7 @@ var init_daemon = __esm({
40103
40120
  init_scan();
40104
40121
  init_single_flight();
40105
40122
  init_update();
40106
- DAEMON_VERSION2 = true ? "daemon-0.8.0" : "daemon-dev";
40123
+ DAEMON_VERSION2 = true ? "daemon-0.8.2" : "daemon-dev";
40107
40124
  HEARTBEAT_INTERVAL_MS = 1e4;
40108
40125
  SCAN_INTERVAL_MS = 5 * 60 * 1e3;
40109
40126
  DISCOVERY_INTERVAL_MS = 6e4;
@@ -40244,7 +40261,7 @@ import {
40244
40261
  readFileSync as readFileSync5,
40245
40262
  realpathSync,
40246
40263
  unlinkSync,
40247
- writeFileSync as writeFileSync4
40264
+ writeFileSync as writeFileSync5
40248
40265
  } from "fs";
40249
40266
  import { createRequire } from "module";
40250
40267
  import { homedir as homedir6, platform as platform3, userInfo } from "os";
@@ -40406,7 +40423,7 @@ ${programArgs}
40406
40423
  </dict>
40407
40424
  </plist>
40408
40425
  `;
40409
- writeFileSync4(p, plist, { mode: 420 });
40426
+ writeFileSync5(p, plist, { mode: 420 });
40410
40427
  return p;
40411
40428
  }
40412
40429
  function launchctl(args) {
@@ -40480,7 +40497,7 @@ StandardError=append:${join8(logDir(), "err.log")}
40480
40497
  [Install]
40481
40498
  WantedBy=default.target
40482
40499
  `;
40483
- writeFileSync4(unitPath, unit, { mode: 420 });
40500
+ writeFileSync5(unitPath, unit, { mode: 420 });
40484
40501
  return unitPath;
40485
40502
  }
40486
40503
  function systemctl(args) {
@@ -40707,7 +40724,7 @@ function tryOpenBrowser(url) {
40707
40724
  return false;
40708
40725
  }
40709
40726
  }
40710
- var DAEMON_VERSION3 = true ? "daemon-0.8.0" : "daemon-dev";
40727
+ var DAEMON_VERSION3 = true ? "daemon-0.8.2" : "daemon-dev";
40711
40728
  function osFamily() {
40712
40729
  const p = platform6();
40713
40730
  if (p === "darwin") return "macos";