@faithfulalabi/agent-lens 0.7.0 → 0.7.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.
@@ -1,7 +1,7 @@
1
1
  import { join } from 'node:path';
2
2
  import { buildDoctorReport, readCronLogStatus, resolveDataDir, } from '../../archive/index.js';
3
3
  import { CACHE_DB_FILE, openReadOnlyDb } from '../../db/open.js';
4
- import { readDriftRows, readHealthCounts, readMeta } from '../../db/read.js';
4
+ import { hasStructuralDrift, readDriftRows, readHealthCounts, readMeta } from '../../db/read.js';
5
5
  import { aggregateDrift, mergeBucket } from '../../server/drift-report.js';
6
6
  import { parseStringFlag } from './archive.js';
7
7
  const MAX_LISTED = 20;
@@ -40,7 +40,8 @@ export function readCacheStats(dataDir) {
40
40
  const row = census.get(session.harness_version ?? 'unknown');
41
41
  if (row === undefined)
42
42
  continue;
43
- row.drifting += 1;
43
+ if (hasStructuralDrift(session.counts))
44
+ row.drifting += 1;
44
45
  mergeNamed(row, 'unknown_line_types', session.counts.unknown_line_types);
45
46
  mergeNamed(row, 'unknown_top_level_fields', session.counts.unknown_top_level_fields);
46
47
  }
@@ -25,6 +25,10 @@ const SESSION_LIST_COLUMNS = `id, title, preview, project_path, git_branch, mode
25
25
  sub_tokens_cache_read, sub_tokens_cache_write, sub_est_cost, sub_models, rollup_state, drift_json`;
26
26
  const TOP_LEVEL_ONLY = 'parent_session_id IS NULL';
27
27
  const NO_DRIFT = '{}';
28
+ export const FIELD_TIER_BUCKETS = new Set(['unknown_top_level_fields']);
29
+ export function hasStructuralDrift(counts) {
30
+ return Object.keys(counts).some((bucket) => !FIELD_TIER_BUCKETS.has(bucket));
31
+ }
28
32
  const Q_PREDICATE = "(COALESCE(title,'') || ' ' || COALESCE(preview,'') || ' ' || project_path) LIKE ? ESCAPE '\\'";
29
33
  function likeContains(q) {
30
34
  return `%${q.replace(/[\\%_]/g, (ch) => `\\${ch}`)}%`;
@@ -38,7 +42,7 @@ function toSessionRow(row) {
38
42
  ...rest,
39
43
  models: modelIdsOf(models),
40
44
  sub_models: modelIdsOf(sub_models),
41
- has_drift: drift_json !== NO_DRIFT,
45
+ has_drift: drift_json !== NO_DRIFT && hasStructuralDrift(JSON.parse(drift_json)),
42
46
  };
43
47
  }
44
48
  export function buildSessionListSql(query) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faithfulalabi/agent-lens",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Local-first agentic tracing platform: inspect everything your agent did in a session.",
5
5
  "type": "module",
6
6
  "license": "MIT",