omnius 1.0.587 → 1.0.589

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.
@@ -2764,8 +2764,8 @@ function runMemoryMaintenance(options) {
2764
2764
  result.compacted.walCheckpoints += graphResult.walCheckpoint ? 1 : 0;
2765
2765
  }
2766
2766
  result.stoppedEarly = shouldStop();
2767
- result.stores.episodes.sizeAfterBytes = fileSize(episodesPath);
2768
- result.stores.knowledge.sizeAfterBytes = fileSize(knowledgePath);
2767
+ refreshStoreStatsAfter(result.stores.episodes);
2768
+ refreshStoreStatsAfter(result.stores.knowledge);
2769
2769
  result.finishedAt = (/* @__PURE__ */ new Date()).toISOString();
2770
2770
  result.durationMs = Date.now() - started;
2771
2771
  return result;
@@ -2775,7 +2775,15 @@ function emptyResult(options, started) {
2775
2775
  path,
2776
2776
  exists: false,
2777
2777
  sizeBeforeBytes: 0,
2778
- sizeAfterBytes: 0
2778
+ sizeAfterBytes: 0,
2779
+ walBeforeBytes: 0,
2780
+ walAfterBytes: 0,
2781
+ shmBeforeBytes: 0,
2782
+ shmAfterBytes: 0,
2783
+ archiveBeforeBytes: 0,
2784
+ archiveAfterBytes: 0,
2785
+ physicalBeforeBytes: 0,
2786
+ physicalAfterBytes: 0
2779
2787
  });
2780
2788
  return {
2781
2789
  startedAt: new Date(started).toISOString(),
@@ -2816,13 +2824,38 @@ function emptyResult(options, started) {
2816
2824
  };
2817
2825
  }
2818
2826
  function storeStats(path) {
2827
+ const walPath = `${path}-wal`;
2828
+ const shmPath = `${path}-shm`;
2829
+ const archivePath = path.endsWith("knowledge.db") ? join2(dirname(path), "knowledge.archive.db") : "";
2830
+ const sizeBeforeBytes = fileSize(path);
2831
+ const walBeforeBytes = fileSize(walPath);
2832
+ const shmBeforeBytes = fileSize(shmPath);
2833
+ const archiveBeforeBytes = archivePath ? fileSize(archivePath) : 0;
2819
2834
  return {
2820
2835
  path,
2821
2836
  exists: existsSync2(path),
2822
- sizeBeforeBytes: fileSize(path),
2823
- sizeAfterBytes: fileSize(path)
2837
+ sizeBeforeBytes,
2838
+ sizeAfterBytes: sizeBeforeBytes,
2839
+ walBeforeBytes,
2840
+ walAfterBytes: walBeforeBytes,
2841
+ shmBeforeBytes,
2842
+ shmAfterBytes: shmBeforeBytes,
2843
+ archiveBeforeBytes,
2844
+ archiveAfterBytes: archiveBeforeBytes,
2845
+ physicalBeforeBytes: sizeBeforeBytes + walBeforeBytes + shmBeforeBytes + archiveBeforeBytes,
2846
+ physicalAfterBytes: sizeBeforeBytes + walBeforeBytes + shmBeforeBytes + archiveBeforeBytes
2824
2847
  };
2825
2848
  }
2849
+ function refreshStoreStatsAfter(stats) {
2850
+ const walPath = `${stats.path}-wal`;
2851
+ const shmPath = `${stats.path}-shm`;
2852
+ const archivePath = stats.path.endsWith("knowledge.db") ? join2(dirname(stats.path), "knowledge.archive.db") : "";
2853
+ stats.sizeAfterBytes = fileSize(stats.path);
2854
+ stats.walAfterBytes = fileSize(walPath);
2855
+ stats.shmAfterBytes = fileSize(shmPath);
2856
+ stats.archiveAfterBytes = archivePath ? fileSize(archivePath) : 0;
2857
+ stats.physicalAfterBytes = stats.sizeAfterBytes + stats.walAfterBytes + stats.shmAfterBytes + stats.archiveAfterBytes;
2858
+ }
2826
2859
  function fileSize(path) {
2827
2860
  try {
2828
2861
  return existsSync2(path) ? statSync(path).size : 0;
@@ -2903,7 +2936,7 @@ function maintainEpisodes(dbPath, options, shouldStop) {
2903
2936
  let walCheckpoint = false;
2904
2937
  try {
2905
2938
  db.pragma("busy_timeout = 5000");
2906
- if (!shouldStop()) {
2939
+ if (!options.dryRun && !shouldStop()) {
2907
2940
  try {
2908
2941
  const cycle = runConsolidationCycle(db, {
2909
2942
  slowWave: { topK: 24, lookbackMs: 24 * HOUR, minImportance: 6 },
@@ -2936,10 +2969,13 @@ function maintainEpisodes(dbPath, options, shouldStop) {
2936
2969
  stats.lowSignalDeleted = deleteEpisodes(db, lowSignalIds, !!options.dryRun);
2937
2970
  }
2938
2971
  }
2939
- walCheckpoint = checkpointWal(db);
2940
- if (!options.dryRun && options.vacuum !== false && stats.lowSignalDeleted + stats.duplicateDeleted + stats.sleepPruned > 0) {
2972
+ const changed = stats.lowSignalDeleted + stats.duplicateDeleted + stats.sleepPruned > 0;
2973
+ if (!options.dryRun && options.vacuum !== false && changed) {
2941
2974
  vacuumed = vacuum(db);
2942
2975
  }
2976
+ if (!options.dryRun && changed) {
2977
+ walCheckpoint = checkpointWal(db);
2978
+ }
2943
2979
  } finally {
2944
2980
  try {
2945
2981
  db.close();
@@ -3026,10 +3062,13 @@ function maintainGraph(dbPath, options, shouldStop) {
3026
3062
  stats.nodesArchived = capped.archived;
3027
3063
  }
3028
3064
  stats.nodesTotalAfter = countNodes(db);
3029
- walCheckpoint = checkpointWal(db);
3030
- if (!options.dryRun && options.vacuum !== false && stats.nodesMerged + stats.edgesDeduped + stats.inactiveEdgesDeleted + stats.orphanNodesDeleted + stats.lowSignalNodesPruned > 0) {
3065
+ const changed = stats.nodesMerged + stats.edgesDeduped + stats.inactiveEdgesDeleted + stats.orphanNodesDeleted + stats.lowSignalNodesPruned > 0;
3066
+ if (!options.dryRun && options.vacuum !== false && changed) {
3031
3067
  vacuumed = vacuum(db);
3032
3068
  }
3069
+ if (!options.dryRun && changed) {
3070
+ walCheckpoint = checkpointWal(db);
3071
+ }
3033
3072
  } finally {
3034
3073
  try {
3035
3074
  db.close();
@@ -3569,7 +3608,7 @@ function readNumber(name, fallback) {
3569
3608
  }
3570
3609
  async function inferSignalProtectSet(stateDir, options) {
3571
3610
  const model = process.env["OMNIUS_KG_PRUNE_MODEL"] || process.env["OMNIUS_MODEL"] || "";
3572
- const inferenceOn = readBool("OMNIUS_KG_PRUNE_INFERENCE", Boolean(model));
3611
+ const inferenceOn = readBool("OMNIUS_KG_PRUNE_INFERENCE", false);
3573
3612
  if (!inferenceOn || !model) return { protectIds: [], reinforced: 0 };
3574
3613
  const knowledgePath = join3(stateDir, "knowledge.db");
3575
3614
  const candidates = selectGraphPruneCandidates(knowledgePath, options);
@@ -3590,6 +3629,10 @@ async function inferSignalProtectSet(stateDir, options) {
3590
3629
  async function main() {
3591
3630
  const stateDir = process.env["OMNIUS_MEMORY_MAINTENANCE_STATE_DIR"];
3592
3631
  if (!stateDir) throw new Error("OMNIUS_MEMORY_MAINTENANCE_STATE_DIR is required");
3632
+ const runId = process.env["OMNIUS_MEMORY_MAINTENANCE_RUN_ID"] || "unscoped";
3633
+ const trigger = process.env["OMNIUS_MEMORY_MAINTENANCE_TRIGGER"] || "idle";
3634
+ const admission = process.env["OMNIUS_MEMORY_MAINTENANCE_ADMISSION"] || void 0;
3635
+ const startedAt = (/* @__PURE__ */ new Date()).toISOString();
3593
3636
  const options = {
3594
3637
  stateDir,
3595
3638
  dryRun: readBool("OMNIUS_MEMORY_MAINTENANCE_DRY_RUN", false),
@@ -3617,16 +3660,31 @@ async function main() {
3617
3660
  options.graphProtectNodeIds = inference.protectIds;
3618
3661
  }
3619
3662
  const result = runMemoryMaintenance(options);
3620
- process.stdout.write(
3621
- `${JSON.stringify({
3663
+ const physicalBeforeBytes = result.stores.episodes.physicalBeforeBytes + result.stores.knowledge.physicalBeforeBytes;
3664
+ const physicalAfterBytes = result.stores.episodes.physicalAfterBytes + result.stores.knowledge.physicalAfterBytes;
3665
+ process.stdout.write(`${JSON.stringify({
3666
+ schemaVersion: 1,
3667
+ runId,
3668
+ trigger,
3669
+ ownerPid: process.pid,
3670
+ startedAt,
3671
+ finishedAt: (/* @__PURE__ */ new Date()).toISOString(),
3672
+ outcome: "completed",
3673
+ admission,
3674
+ storage: {
3675
+ physicalBeforeBytes,
3676
+ physicalAfterBytes,
3677
+ deltaBytes: physicalAfterBytes - physicalBeforeBytes
3678
+ },
3679
+ result: {
3622
3680
  ...result,
3623
3681
  inference: {
3624
3682
  protectedSignal: inference.protectIds.length,
3625
3683
  reinforced: inference.reinforced
3626
3684
  }
3627
- })}
3628
- `
3629
- );
3685
+ }
3686
+ })}
3687
+ `);
3630
3688
  }
3631
3689
  main().catch((error) => {
3632
3690
  const message = error instanceof Error ? error.message : String(error);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.587",
3
+ "version": "1.0.589",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.587",
9
+ "version": "1.0.589",
10
10
  "bundleDependencies": [
11
11
  "image-to-ascii"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.587",
3
+ "version": "1.0.589",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",