modelstat 0.0.32 → 0.0.34
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 +57 -62
- package/dist/cli.mjs.map +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.mjs +88 -25
- package/vendor/tray-mac/Sources/ModelstatTray/main.swift +18 -18
package/dist/cli.mjs
CHANGED
|
@@ -21132,7 +21132,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
21132
21132
|
"../../node_modules/.pnpm/undici@7.25.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
|
|
21133
21133
|
"use strict";
|
|
21134
21134
|
var { writeFile, readFile, mkdir: mkdir2 } = __require("fs/promises");
|
|
21135
|
-
var { dirname:
|
|
21135
|
+
var { dirname: dirname8, resolve: resolve6 } = __require("path");
|
|
21136
21136
|
var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("timers");
|
|
21137
21137
|
var { InvalidArgumentError, UndiciError } = require_errors();
|
|
21138
21138
|
var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -21363,7 +21363,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
21363
21363
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
21364
21364
|
}
|
|
21365
21365
|
const resolvedPath = resolve6(path5);
|
|
21366
|
-
await mkdir2(
|
|
21366
|
+
await mkdir2(dirname8(resolvedPath), { recursive: true });
|
|
21367
21367
|
const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
21368
21368
|
hash,
|
|
21369
21369
|
snapshot
|
|
@@ -44343,9 +44343,24 @@ async function buildForOneSession(sessionId, events, adapters2) {
|
|
|
44343
44343
|
}
|
|
44344
44344
|
}
|
|
44345
44345
|
const segments = [];
|
|
44346
|
+
let failed = 0;
|
|
44347
|
+
let lastError = null;
|
|
44346
44348
|
for (const slice of merged) {
|
|
44347
|
-
|
|
44348
|
-
|
|
44349
|
+
try {
|
|
44350
|
+
const seg = await summariseSlice(sessionId, slice, adapters2);
|
|
44351
|
+
if (seg) segments.push(seg);
|
|
44352
|
+
} catch (err) {
|
|
44353
|
+
failed += 1;
|
|
44354
|
+
lastError = err instanceof Error ? err.message : String(err);
|
|
44355
|
+
console.warn(
|
|
44356
|
+
`[modelstat] slice failed in session ${sessionId}: ${lastError}`
|
|
44357
|
+
);
|
|
44358
|
+
}
|
|
44359
|
+
}
|
|
44360
|
+
if (failed > 0) {
|
|
44361
|
+
console.warn(
|
|
44362
|
+
`[modelstat] session ${sessionId}: ${segments.length} segments built, ${failed} slices failed (last error: ${lastError ?? "?"}). Continuing with the healthy slices.`
|
|
44363
|
+
);
|
|
44349
44364
|
}
|
|
44350
44365
|
return segments;
|
|
44351
44366
|
}
|
|
@@ -45114,7 +45129,7 @@ var init_scan = __esm({
|
|
|
45114
45129
|
init_pipeline2();
|
|
45115
45130
|
init_config2();
|
|
45116
45131
|
init_api();
|
|
45117
|
-
AGENT_VERSION = "agent-
|
|
45132
|
+
AGENT_VERSION = "agent-0.0.34";
|
|
45118
45133
|
BATCH_MAX_EVENTS = 2e3;
|
|
45119
45134
|
}
|
|
45120
45135
|
});
|
|
@@ -45994,9 +46009,9 @@ var init_handler = __esm({
|
|
|
45994
46009
|
if (this.fsw.closed) {
|
|
45995
46010
|
return;
|
|
45996
46011
|
}
|
|
45997
|
-
const
|
|
46012
|
+
const dirname8 = sysPath.dirname(file);
|
|
45998
46013
|
const basename4 = sysPath.basename(file);
|
|
45999
|
-
const parent = this.fsw._getWatchedDir(
|
|
46014
|
+
const parent = this.fsw._getWatchedDir(dirname8);
|
|
46000
46015
|
let prevStats = stats;
|
|
46001
46016
|
if (parent.has(basename4))
|
|
46002
46017
|
return;
|
|
@@ -46023,7 +46038,7 @@ var init_handler = __esm({
|
|
|
46023
46038
|
prevStats = newStats2;
|
|
46024
46039
|
}
|
|
46025
46040
|
} catch (error) {
|
|
46026
|
-
this.fsw._remove(
|
|
46041
|
+
this.fsw._remove(dirname8, basename4);
|
|
46027
46042
|
}
|
|
46028
46043
|
} else if (parent.has(basename4)) {
|
|
46029
46044
|
const at = newStats.atimeMs;
|
|
@@ -46988,9 +47003,6 @@ __export(daemon_exports, {
|
|
|
46988
47003
|
setQueue: () => setQueue
|
|
46989
47004
|
});
|
|
46990
47005
|
import { existsSync as existsSync8, statSync as statSync2 } from "fs";
|
|
46991
|
-
import { readFileSync as readFileSync4 } from "fs";
|
|
46992
|
-
import { dirname as dirname8, join as join9 } from "path";
|
|
46993
|
-
import { fileURLToPath as __agentFileURLToPath } from "url";
|
|
46994
47006
|
function setPhase(phase, message) {
|
|
46995
47007
|
status.phase = phase;
|
|
46996
47008
|
status.message = message ?? null;
|
|
@@ -47039,15 +47051,15 @@ async function sendHeartbeat() {
|
|
|
47039
47051
|
}
|
|
47040
47052
|
async function writeLocalStatus(snapshot) {
|
|
47041
47053
|
const { homedir: homedir9 } = await import("os");
|
|
47042
|
-
const { join:
|
|
47054
|
+
const { join: join10 } = await import("path");
|
|
47043
47055
|
const { writeFile, mkdir: mkdir2, rename } = await import("fs/promises");
|
|
47044
47056
|
if (!lastStatusPath) {
|
|
47045
|
-
const dir =
|
|
47057
|
+
const dir = join10(homedir9(), ".modelstat");
|
|
47046
47058
|
try {
|
|
47047
47059
|
await mkdir2(dir, { recursive: true });
|
|
47048
47060
|
} catch {
|
|
47049
47061
|
}
|
|
47050
|
-
lastStatusPath =
|
|
47062
|
+
lastStatusPath = join10(dir, "last-status.json");
|
|
47051
47063
|
}
|
|
47052
47064
|
const tmp = `${lastStatusPath}.tmp`;
|
|
47053
47065
|
try {
|
|
@@ -47149,18 +47161,18 @@ async function runDaemon(opts = {}) {
|
|
|
47149
47161
|
await runScanCycle("startup");
|
|
47150
47162
|
const chokidar = (await Promise.resolve().then(() => (init_esm2(), esm_exports))).default;
|
|
47151
47163
|
const { homedir: homedir9, platform: platform5 } = await import("os");
|
|
47152
|
-
const { join:
|
|
47164
|
+
const { join: join10 } = await import("path");
|
|
47153
47165
|
const home2 = homedir9();
|
|
47154
47166
|
const dirs = [
|
|
47155
|
-
|
|
47156
|
-
|
|
47157
|
-
|
|
47158
|
-
|
|
47167
|
+
join10(home2, ".claude/projects"),
|
|
47168
|
+
join10(home2, ".codex/sessions"),
|
|
47169
|
+
join10(home2, ".cursor/ai-tracking"),
|
|
47170
|
+
join10(home2, ".gemini"),
|
|
47159
47171
|
...platform5() === "darwin" ? [
|
|
47160
|
-
|
|
47161
|
-
|
|
47172
|
+
join10(home2, "Library/Application Support/Cursor/User/workspaceStorage"),
|
|
47173
|
+
join10(home2, "Library/Application Support/Claude")
|
|
47162
47174
|
] : [
|
|
47163
|
-
|
|
47175
|
+
join10(home2, ".config/Cursor/User/workspaceStorage")
|
|
47164
47176
|
]
|
|
47165
47177
|
].filter((p) => existsSync8(p) && statSync2(p).isDirectory());
|
|
47166
47178
|
setPhase("watching", `Watching ${dirs.length} directories`);
|
|
@@ -47209,24 +47221,7 @@ var init_daemon = __esm({
|
|
|
47209
47221
|
init_config2();
|
|
47210
47222
|
init_lock();
|
|
47211
47223
|
init_scan();
|
|
47212
|
-
AGENT_VERSION2 =
|
|
47213
|
-
try {
|
|
47214
|
-
const here2 = dirname8(__agentFileURLToPath(import.meta.url));
|
|
47215
|
-
const candidates = [
|
|
47216
|
-
join9(here2, "..", "package.json"),
|
|
47217
|
-
join9(here2, "..", "..", "package.json")
|
|
47218
|
-
];
|
|
47219
|
-
for (const c of candidates) {
|
|
47220
|
-
try {
|
|
47221
|
-
const v = JSON.parse(readFileSync4(c, "utf8")).version;
|
|
47222
|
-
if (typeof v === "string") return `agent-${v}`;
|
|
47223
|
-
} catch {
|
|
47224
|
-
}
|
|
47225
|
-
}
|
|
47226
|
-
} catch {
|
|
47227
|
-
}
|
|
47228
|
-
return "agent-unknown";
|
|
47229
|
-
})();
|
|
47224
|
+
AGENT_VERSION2 = "agent-0.0.34";
|
|
47230
47225
|
HEARTBEAT_INTERVAL_MS = 1e4;
|
|
47231
47226
|
SCAN_INTERVAL_MS = 5 * 60 * 1e3;
|
|
47232
47227
|
status = {
|
|
@@ -47249,32 +47244,32 @@ __export(watch_exports, {
|
|
|
47249
47244
|
});
|
|
47250
47245
|
import { existsSync as existsSync9 } from "fs";
|
|
47251
47246
|
import { homedir as homedir8, platform as platform3 } from "os";
|
|
47252
|
-
import { join as
|
|
47247
|
+
import { join as join9 } from "path";
|
|
47253
47248
|
function resolveWatchDirs() {
|
|
47254
47249
|
const home2 = homedir8();
|
|
47255
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ??
|
|
47256
|
-
const xdgData = process.env.XDG_DATA_HOME ??
|
|
47250
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME ?? join9(home2, ".config");
|
|
47251
|
+
const xdgData = process.env.XDG_DATA_HOME ?? join9(home2, ".local/share");
|
|
47257
47252
|
const candidates = [
|
|
47258
47253
|
// universal (default HOME-rooted CLI data dirs)
|
|
47259
|
-
|
|
47260
|
-
|
|
47261
|
-
|
|
47262
|
-
|
|
47263
|
-
|
|
47254
|
+
join9(home2, ".claude/projects"),
|
|
47255
|
+
join9(home2, ".codex/sessions"),
|
|
47256
|
+
join9(home2, ".cursor/ai-tracking"),
|
|
47257
|
+
join9(home2, ".gemini"),
|
|
47258
|
+
join9(home2, ".aider"),
|
|
47264
47259
|
// XDG / Linux
|
|
47265
|
-
|
|
47266
|
-
|
|
47267
|
-
|
|
47268
|
-
|
|
47269
|
-
|
|
47270
|
-
|
|
47260
|
+
join9(xdgConfig, "claude/projects"),
|
|
47261
|
+
join9(xdgConfig, "codex/sessions"),
|
|
47262
|
+
join9(xdgConfig, "Cursor/User/workspaceStorage"),
|
|
47263
|
+
join9(xdgConfig, "Code/User/workspaceStorage"),
|
|
47264
|
+
join9(xdgConfig, "Code - Insiders/User/workspaceStorage"),
|
|
47265
|
+
join9(xdgData, "claude/projects"),
|
|
47271
47266
|
// macOS
|
|
47272
47267
|
...platform3() === "darwin" ? [
|
|
47273
|
-
|
|
47274
|
-
|
|
47275
|
-
|
|
47276
|
-
|
|
47277
|
-
|
|
47268
|
+
join9(home2, "Library/Application Support/Cursor/User/workspaceStorage"),
|
|
47269
|
+
join9(home2, "Library/Application Support/Claude"),
|
|
47270
|
+
join9(home2, "Library/Application Support/Code/User/workspaceStorage"),
|
|
47271
|
+
join9(home2, "Library/Application Support/Windsurf/User/workspaceStorage"),
|
|
47272
|
+
join9(home2, "Library/Application Support/Zed")
|
|
47278
47273
|
] : []
|
|
47279
47274
|
];
|
|
47280
47275
|
return Array.from(new Set(candidates)).filter((p) => existsSync9(p));
|
|
@@ -47651,7 +47646,7 @@ function tryOpenBrowser(url) {
|
|
|
47651
47646
|
return false;
|
|
47652
47647
|
}
|
|
47653
47648
|
}
|
|
47654
|
-
var AGENT_VERSION3 = "agent-
|
|
47649
|
+
var AGENT_VERSION3 = "agent-0.0.34";
|
|
47655
47650
|
function osFamily() {
|
|
47656
47651
|
const p = platform4();
|
|
47657
47652
|
if (p === "darwin") return "macos";
|
|
@@ -48017,9 +48012,9 @@ function fmtTokens(v) {
|
|
|
48017
48012
|
async function readLocalStatus() {
|
|
48018
48013
|
try {
|
|
48019
48014
|
const { homedir: homedir9 } = await import("os");
|
|
48020
|
-
const { join:
|
|
48015
|
+
const { join: join10 } = await import("path");
|
|
48021
48016
|
const { readFile } = await import("fs/promises");
|
|
48022
|
-
const p =
|
|
48017
|
+
const p = join10(homedir9(), ".modelstat", "last-status.json");
|
|
48023
48018
|
const txt = await readFile(p, "utf8");
|
|
48024
48019
|
return JSON.parse(txt);
|
|
48025
48020
|
} catch {
|