modelstat 0.0.27 → 0.0.28
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 +66 -1
- package/dist/cli.mjs.map +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.mjs +91 -1
package/dist/cli.mjs
CHANGED
|
@@ -43981,7 +43981,8 @@ var init_config2 = __esm({
|
|
|
43981
43981
|
claimUrl: null,
|
|
43982
43982
|
userEmail: null,
|
|
43983
43983
|
defaultOrgId: null,
|
|
43984
|
-
cursor: {}
|
|
43984
|
+
cursor: {},
|
|
43985
|
+
processingVersion: null
|
|
43985
43986
|
}
|
|
43986
43987
|
});
|
|
43987
43988
|
cachedIdentity = (() => {
|
|
@@ -44073,6 +44074,19 @@ var init_config2 = __esm({
|
|
|
44073
44074
|
map[path5] = v;
|
|
44074
44075
|
store.set("cursor", map);
|
|
44075
44076
|
},
|
|
44077
|
+
/** Drop every per-file cursor so the next scan re-reads every
|
|
44078
|
+
* JSONL from byte 0. Called when the local processing-pipeline
|
|
44079
|
+
* version bumps (see processing-version.ts) or via the
|
|
44080
|
+
* `modelstat rescan` CLI command. */
|
|
44081
|
+
wipeCursors() {
|
|
44082
|
+
store.set("cursor", {});
|
|
44083
|
+
},
|
|
44084
|
+
get processingVersion() {
|
|
44085
|
+
return store.get("processingVersion");
|
|
44086
|
+
},
|
|
44087
|
+
setProcessingVersion(v) {
|
|
44088
|
+
store.set("processingVersion", v);
|
|
44089
|
+
},
|
|
44076
44090
|
get storePath() {
|
|
44077
44091
|
return store.path;
|
|
44078
44092
|
}
|
|
@@ -45220,6 +45234,29 @@ var init_lock = __esm({
|
|
|
45220
45234
|
}
|
|
45221
45235
|
});
|
|
45222
45236
|
|
|
45237
|
+
// src/processing-version.ts
|
|
45238
|
+
var processing_version_exports = {};
|
|
45239
|
+
__export(processing_version_exports, {
|
|
45240
|
+
PROCESSING_VERSION: () => PROCESSING_VERSION,
|
|
45241
|
+
reconcileProcessingVersion: () => reconcileProcessingVersion
|
|
45242
|
+
});
|
|
45243
|
+
function reconcileProcessingVersion(state2) {
|
|
45244
|
+
const stored = state2.processingVersion ?? 1;
|
|
45245
|
+
if (stored >= PROCESSING_VERSION) {
|
|
45246
|
+
return { changed: false, from: stored, to: PROCESSING_VERSION };
|
|
45247
|
+
}
|
|
45248
|
+
state2.wipeCursors();
|
|
45249
|
+
state2.setProcessingVersion(PROCESSING_VERSION);
|
|
45250
|
+
return { changed: true, from: stored, to: PROCESSING_VERSION };
|
|
45251
|
+
}
|
|
45252
|
+
var PROCESSING_VERSION;
|
|
45253
|
+
var init_processing_version = __esm({
|
|
45254
|
+
"src/processing-version.ts"() {
|
|
45255
|
+
"use strict";
|
|
45256
|
+
PROCESSING_VERSION = 2;
|
|
45257
|
+
}
|
|
45258
|
+
});
|
|
45259
|
+
|
|
45223
45260
|
// ../../node_modules/.pnpm/readdirp@4.1.2/node_modules/readdirp/esm/index.js
|
|
45224
45261
|
import { stat as stat3, lstat, readdir as readdir2, realpath } from "fs/promises";
|
|
45225
45262
|
import { Readable as Readable2 } from "stream";
|
|
@@ -47077,6 +47114,13 @@ async function runDaemon(opts = {}) {
|
|
|
47077
47114
|
setPhase("error", `summariser preflight failed: ${err.message}`);
|
|
47078
47115
|
throw err;
|
|
47079
47116
|
}
|
|
47117
|
+
const { reconcileProcessingVersion: reconcileProcessingVersion2 } = await Promise.resolve().then(() => (init_processing_version(), processing_version_exports));
|
|
47118
|
+
const pv = reconcileProcessingVersion2(state);
|
|
47119
|
+
if (pv.changed) {
|
|
47120
|
+
console.log(
|
|
47121
|
+
`[modelstat] processing pipeline v${pv.from} \u2192 v${pv.to} \u2014 wiped file cursors so every session is re-processed by the new pipeline`
|
|
47122
|
+
);
|
|
47123
|
+
}
|
|
47080
47124
|
await runDiscovery();
|
|
47081
47125
|
await runScanCycle("startup");
|
|
47082
47126
|
const chokidar = (await Promise.resolve().then(() => (init_esm2(), esm_exports))).default;
|
|
@@ -47867,12 +47911,30 @@ async function cmdScan() {
|
|
|
47867
47911
|
const { preflightSummariser: preflightSummariser2 } = await Promise.resolve().then(() => (init_pipeline2(), pipeline_exports));
|
|
47868
47912
|
const sample = await preflightSummariser2();
|
|
47869
47913
|
console.log(`[modelstat] summariser preflight ok: "${sample}"`);
|
|
47914
|
+
const { reconcileProcessingVersion: reconcileProcessingVersion2 } = await Promise.resolve().then(() => (init_processing_version(), processing_version_exports));
|
|
47915
|
+
const pv = reconcileProcessingVersion2(state);
|
|
47916
|
+
if (pv.changed) {
|
|
47917
|
+
console.log(
|
|
47918
|
+
`[modelstat] processing pipeline v${pv.from} \u2192 v${pv.to} \u2014 wiped file cursors so every session is re-processed`
|
|
47919
|
+
);
|
|
47920
|
+
}
|
|
47870
47921
|
const r = await scanAll();
|
|
47871
47922
|
console.log();
|
|
47872
47923
|
console.log(
|
|
47873
47924
|
`Done: ${r.filesScanned} files scanned, ${r.filesUnchanged} unchanged, ${r.batchesUploaded} batches, ${r.eventsUploaded} events uploaded`
|
|
47874
47925
|
);
|
|
47875
47926
|
}
|
|
47927
|
+
async function cmdRescan() {
|
|
47928
|
+
const { PROCESSING_VERSION: PROCESSING_VERSION2 } = await Promise.resolve().then(() => (init_processing_version(), processing_version_exports));
|
|
47929
|
+
state.wipeCursors();
|
|
47930
|
+
state.setProcessingVersion(PROCESSING_VERSION2);
|
|
47931
|
+
console.log(
|
|
47932
|
+
`[modelstat] cursors wiped \u2014 next \`modelstat scan\` (or daemon scan cycle) will re-read every JSONL from the start and re-summarise every session at processing version v${PROCESSING_VERSION2}.`
|
|
47933
|
+
);
|
|
47934
|
+
console.log(
|
|
47935
|
+
" If the daemon is running, kick it with: modelstat stop && modelstat start"
|
|
47936
|
+
);
|
|
47937
|
+
}
|
|
47876
47938
|
async function cmdWatch() {
|
|
47877
47939
|
const { watchForever: watchForever2 } = await Promise.resolve().then(() => (init_watch(), watch_exports));
|
|
47878
47940
|
await watchForever2();
|
|
@@ -48061,6 +48123,8 @@ async function main() {
|
|
|
48061
48123
|
return cmdDiscover();
|
|
48062
48124
|
case "scan":
|
|
48063
48125
|
return cmdScan();
|
|
48126
|
+
case "rescan":
|
|
48127
|
+
return cmdRescan();
|
|
48064
48128
|
case "watch":
|
|
48065
48129
|
return cmdWatch();
|
|
48066
48130
|
case "stop":
|
|
@@ -48093,6 +48157,7 @@ async function main() {
|
|
|
48093
48157
|
console.log(" start \u2014 run the daemon (used by the installed service)");
|
|
48094
48158
|
console.log(" discover \u2014 one-shot report of installs/identities");
|
|
48095
48159
|
console.log(" scan \u2014 one-shot parse + upload of local JSONL");
|
|
48160
|
+
console.log(" rescan \u2014 wipe file cursors so next scan re-reads & re-summarises everything");
|
|
48096
48161
|
console.log(" watch \u2014 continuous (chokidar) with periodic backstop");
|
|
48097
48162
|
process.exit(1);
|
|
48098
48163
|
}
|